简体   繁体   中英

excel lookup in multiple columns

I have below 2 sheets. Sheet 1

id review_name
1  Test1
2  Test2
3  Test3

Sheet 2

Review_name Date_range
Test1       B2:B248
Test2       AC2:A248
Test3       U2:U248

Here the Date_range refers to column names in sheet3.I should pick the review names and based on the above date_range(column range) of sheet 3,i should look for matching value.

Expected result

   Col1 Col2 Col3
    1 test1 LOOKUP(1,Sheet3A2:A248,<Here i should use sheet2 lookup date_range>

Any suggestions, i used concatenate of sheet name and the range, like LOOKUP(1,Sheet3A2:A248,Sheet3&B2:B248) but dint work

You'll need function =INDIRECT() to convert a string holding a sheet/range name into an actual range. Otherwise it just stays as a string which is meaningless. In your case something like:

=lookup(A1, Sheet3!A2:A248, indirect("Sheet3!" & vlookup(B1, Sheet2!A:B, 2, false)))

That last parameter of your lookup function is going to concatenate the string Sheet3! to the results of the vlookup, which will be the string range in Column B of Sheet2. That is then interpreted by indirect() into an actual range that will function in your lookup() formula.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM