返回不包含另一个列表的唯一列表

时间:2019-04-08 16:38:58

标签: google-sheets google-sheets-formula

我想返回一组具有跨多个类别的分类变量的唯一值,该值将另一个列表中的值排除在外。

Image link since I can't embed images in my question yet

=UNIQUE(QUERY({J2:J,K2:K},"select * where Col1 is not null"))

这正确地返回了带有分类变量的唯一值集,但是我似乎无法弄清楚如何从另一个列表中排除值。

=UNIQUE(FILTER(J2:K,ISNA(MATCH(M2:N,J2:K,0))))

我尝试使用此方法,但它返回

#VALUE! FILTER range must be a single row or a single column.

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:1)

=ARRAYFORMULA(IFERROR(SPLIT(FILTER(
 TRANSPOSE(QUERY(TRANSPOSE(UNIQUE(A2:B)), , 999^99)), NOT(COUNTIF(
 TRANSPOSE(QUERY(TRANSPOSE(       D2:E) , , 999^99)), 
 TRANSPOSE(QUERY(TRANSPOSE(UNIQUE(A2:B)), , 999^99))))), " ")))

0


要考虑带有空格的项目:

=ARRAYFORMULA(SUBSTITUTE(IFERROR(SPLIT(FILTER(
 TRANSPOSE(QUERY(TRANSPOSE(UNIQUE(SUBSTITUTE(A2:B," ","♦"))),,999^99)), NOT(COUNTIF(
 TRANSPOSE(QUERY(TRANSPOSE(       SUBSTITUTE(D2:E," ","♦")) ,,999^99)), 
 TRANSPOSE(QUERY(TRANSPOSE(UNIQUE(SUBSTITUTE(A2:B," ","♦"))),,999^99)))))," ")),"♦"," "))

0