查询以列出未在另一列中列出的数据

问题描述 投票:1回答:2
=QUERY({startingdates!D2:D, Cancelledtours!D2:D},"Select Col1 where not(Col1) matches Col2")

这似乎适用于A列,但不适用于D列。我处于死胡同。谁能帮忙?

Sheet- https://docs.google.com/spreadsheets/d/1zEQmNs48CsaaioQOcwuK97kcmnDLDfX-57nuXFaLujc/edit?usp=sharing

Screenshot

google-sheets filter google-sheets-formula array-formulas google-sheets-query
2个回答
1
投票

您必须在开始日期进行查找-所显示的查询仅在同一行中查找以查看是否存在匹配项:

=ArrayFormula(QUERY({StartingDates!D2:D, isnumber(vlookup(StartingDates!D2:D,CancelledTours!D2:D,1,false))},"Select Col1 where Col2=false"))

或使用match稍短一些:

=ArrayFormula(QUERY({StartingDates!D2:D, isnumber(match(StartingDates!D2:D,CancelledTours!D2:D,0))},"Select Col1 where Col2=false"))

enter image description here

反转逻辑,这也有效:

=ArrayFormula(QUERY({StartingDates!D2:D, isna(match(StartingDates!D2:D,CancelledTours!D2:D,0))},"Select Col1 where Col2=true"))

1
投票

尝试:

=FILTER(startingdates!D2:D, NOT(COUNTIF(Cancelledtours!D2:D, startingdates!D2:D)))

0

© www.soinside.com 2019 - 2024. All rights reserved.