vlookup to select query range

35 Views Asked by At
query({A:A,B:B,vlookup()}, "Select Col1, Col2, max(Col3) group by Col1"}

Is there a way to make this work? Trying to avoid a bunch of nested if statements.

Vlookup is returning correct range/text, i.e. '_1'!A:A but getting error:

Function ARRAY_ROW parameter 3 has mismatched row size. 

Also depending on which range is returned, I want to use vlookup to modify Col3 to either max, min, sum. Something like

query({A:A,B:B,vlookup(1)}, "Select Col1, Col2, vlookup(2) group by Col1"}

Where vlookup(2) returns cell value max(col3) etc

1

There are 1 best solutions below

0
z.. On

Try

=query({A:A,B:B,INDIRECT(vlookup())},"Select Col1, Col2,"&vlookup()&"(Col3) group by Col1")