简体   繁体   中英

In Google Sheets, how can I find the value in a column of a row when you know the lookup column name and result column name?

I have a Sheet1 with data like this:

one two three four
a b c d
e f g h
i j k l
m n o p

I have Sheet2 with data like this:

alpha value
c
k
g
c

For each row in Sheet2 , I want to look up Sheet2 . alpha in Sheet1 . three and return the value of Sheet1 . one . I want to do this by putting an array formula in B2 .

So, the expected result is:

alpha value
c a
k i
g e
c a

I can use the new Google Sheet formulas they just released -- except named ranges. I feel like there is some clever trick using them, but I can't come up with it.

BYROW() and XLOOKUP() are your friend in this case.

=BYROW(A2:INDEX(A2:A,COUNTA(A2:A)),LAMBDA(x,XLOOKUP(x,Sheet1!C2:C,Sheet1!A2:A,"Not Found")))

在此处输入图像描述

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