Wayne W.
Wayne W.

Reputation: 117

Query values from separate sheet

I am trying to figure out how to query values from Sheet2 into Sheet1 where column A in Sheet1 matches column A (strings) in Sheet2, and return only the max value of column D (integer) from Sheet2.

Here's what I am using:

=Query(Sheet2!A:F,CONCATENATE("Select D where Name =",A2))

I have tried using Select max(d)... and =MAX(Query(...)) but neither worked for me.

What would be the correct way to do this?

Example data:

Sheet1
Name      ColB      Date      Check      Oldest
Bob       Y         2/14/2013 4/14/2013     5

Sheet2
Name      Title     Date      Age
Bob       Foo       2/1/2013  3
Boo       Bar       2/4/2013  5

Upvotes: 1

Views: 447

Answers (1)

pnuts
pnuts

Reputation: 59450

This may serve, if entered in the cell presently containing Oldest (which would then be overwritten with max Age:

=query(Sheet2!A:D,"select max(D) where A ='Bob' ")  

but the result for your sample would be 3 rather than the 5 as shown to be required.

Upvotes: 1

Related Questions