2
=QUERY({startingdates!D2:D, Cancelledtours!D2:D},"Select Col1 where not(Col1) matches Col2")

This seems to work for Column A but not column D. I'm at a dead-end. Can anyone help?

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

Screenshot

player0
  • 124,011
  • 12
  • 67
  • 124
user198561
  • 49
  • 4

2 Answers2

1

You have to do a lookup on the starting date - the query as it stands only looks in the same row to see if there is a match:

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

or slightly shorter using match:

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

enter image description here

Reversing the logic, this also works:

=ArrayFormula(QUERY({StartingDates!D2:D, isna(match(StartingDates!D2:D,CancelledTours!D2:D,0))},"Select Col1 where Col2=true"))
Tom Sharpe
  • 30,727
  • 5
  • 24
  • 37
  • 1
    Interesting, though irrelevant, that this bypasses the [date literal](https://developers.google.com/chart/interactive/docs/querylanguage#literals) "rule" in QUERY – Tedinoz Dec 07 '19 at 11:08
  • Good point, I didn't really think about that, but I wasn't sure until I tried it (confirmed by your reference) that literals true and false are allowed. I wondered if you could put 'where not Col2' - no you can't, 'not' only works with a boolean expression so you would have to say 'where not Col2=true':-) – Tom Sharpe Dec 07 '19 at 11:35
1

try:

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

0

player0
  • 124,011
  • 12
  • 67
  • 124