KuSpa
KuSpa

Reputation: 325

date comparision google sheet query

I am using Google-sheets.

I have a Data-table like:

x|A           | B          | C
1|date        |randomNumber|
2| 20.02.2018 | 1243       |
3| 18.01.2018 | 2          |
4| 17.01.2018 | 1          |

and a overview table:

x|A           | B          | C
1|date        |randomNumber|
2| 20.02.2018 |            |
3| 17.01.2018 |            |

I want to lookup the dates on the overview table and lookup their value in my data table. Not every date of the data sheet has to appear in the overview table. All colums are date-formatted.

My approach so far was:

=QUERY(Data ;"select B where A = date '"&TEXT(A2;"yyyy-mm-dd")&"'")

but i get an empty output, which should not be the case, I should get 1243.

Thanks already :)

Upvotes: 0

Views: 439

Answers (2)

pnuts
pnuts

Reputation: 59475

With QUERY (copied down from B2 to suit):

=QUERY(Data!A:C;"select B where A = date '"&TEXT(A2;"yyyy-mm-dd")&"'";0)  

Upvotes: 2

TheMaster
TheMaster

Reputation: 50482

=ARRAYFORMULA(VLOOKUP(A2:A3;DATA!A1:B4;2;0))

Upvotes: 3

Related Questions