Google Sheets Completely exclude duplicates

天大地大妈咪最大 提交于 2021-01-28 21:50:43

问题


This formula:

=FILTER(SORT(UNIQUE(flatten(C3:H14));1;1); SORT(UNIQUE(flatten(C3:H14));1;1)<>"")

Merges all values in C3:H14 into a single column then removes duplicates and sorts the result in ascending order.

It is possible to compare the result with a second list and then leave only the values that never repeat?

Like, First Range

   A      B       
Orange  Grapes  
Apple   Carrot  

Flattened Range (A + B)

   C
Apple
Carrot
Grapes
Orange

Comparison range

   D  
Apple  
Banana  
Carrot
Grapes
Orange  
Peach

So the final result will be (D - C):

   E     
Banana
Peach          

Although using UNIQUE function is possible to remove duplicates while keeping one copy of each value.

How can we approach this situation to leave only values that never repeat? Also, it would be possible to use a Named Range as comparison range? Thanks for the attention.


回答1:


You mention

So the final result will be (D - C)

And further down

How can we approach this situation to leave only values that never repeat?

Please use following formula

=FILTER(B2:B,ISERROR(MATCH(B2:B,A2:A,0)))

As for the named range please see more here


EDIT (copying @Mateo's great comment)

To provide a bit more of information on how this function works.

  • First it looks for exact matches between your two columns returning the relative position of these matches.
  • If there are any values that don't match, they will be returned as an error #N/A which are caught by the function ISERROR.
  • Finally, to get these "unmatches" you filter your biggest range column B with these values that did not match and you return them.

Functions used:

  • FILTER
  • ISERROR
  • MATCH



回答2:


you can use just:

=FILTER(D:D; NOT(COUNTIF(FLATTEN(A:B); D:D))))


来源:https://stackoverflow.com/questions/64797312/google-sheets-completely-exclude-duplicates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!