3

Link here to spreadsheet

As the title says, how can I end up with cells that don't match in value, the difference/complement (set theory)?

I would prefer it with only FUNCTIONS and no script.

{1,2,3,4}\{1,3} = {2, 4}

or with letters

{a,b,c,d}\{a,c} = {b, d}

or with with space.

{xyz zyx, abc cba, qwe ewq}\{xyz zyx, qwe ewq} = {abc cba}
KaZyKa
  • 325
  • 2
  • 10

2 Answers2

3

You can add one single formula at the top of your result column like this :

=arrayformula(if(B2:B=A2:A,,A2:A))
Aurielle Perlmann
  • 5,323
  • 1
  • 15
  • 26
  • 2
    That works. If you don't want any blank spaces between the values, you can use `=filter(A2:A,A2:A<>B2:B)` instead – daniel Feb 18 '16 at 14:41
2

Having two arrays:

Array1  Array2
  1       1
  2       b
  b 
  4 
  c 

you can get resulting array:

Result
  2
  4
  c

Try this formula:

=FILTER(A2:A6,ROUND(MMULT(ArrayFormula(--(A2:A6<>TRANSPOSE(B2:B4))),TRANSPOSE(SPLIT(REPT(1/ROWS(B2:B4)&"/",Rows(B2:B4)),"/"))),5)=1)

May be too complex for this task, could somebody edit it? Please, look at sample sheet


Edit

I've found more simple way to do this, using Regular Expressions:

=FILTER(A2:A6,REGEXMATCH(ARRAYFORMULA("'"&A2:A6),JOIN("|",B2:B3))=false)
Max Makhrov
  • 17,309
  • 5
  • 55
  • 81