VLOOKUP by Combining 2 Columns to Form a Unique Key

前端 未结 3 1025
故里飘歌
故里飘歌 2020-12-18 01:52

For the following table,

\"excel

I want to look up the value in col C. Since the values in col A an

相关标签:
3条回答
  • 2020-12-18 02:30

    You can use VLOOKUP if your lookup value is a concatenation of your two or more key fields (A2&B2). Then, add a first sorted column in your LUT sheet with the array that is the concatenation of the same key fields. Viola.

    0 讨论(0)
  • 2020-12-18 02:34

    The way I usually do it is by concatenating the values separated by a pipe character (|). See the formula in the screenshot below.

    =A1&"|"&B1

    Then you can vlookup using the concatenated key.

    =VLOOKUP("1|foo",$C$1:$D$7,2,FALSE)
    
    0 讨论(0)
  • 2020-12-18 02:42

    You can use an array formula:

    =INDEX($C$1:$C$7,MATCH("1foo",$A$1:$A$7 & $B$1:$B$7,0))
    

    just select in example D1, enter formula in formula bar and press CTRL+SHIFT+ENTER to evaluate it

    0 讨论(0)
提交回复
热议问题