Forum Discussion

jtrick's avatar
jtrick
Copper Contributor
Aug 11, 2024
Solved

VLOOKUP Issue

Hi, 

 

My apologies as this is a very basic VLOOKUP question but I can't figure it out. I have data where every person has a research partner. I'm trying to create a Partner_ID variable that contains the ID of the person the participant is partnered with. I'm pretty sure VLOOKUP is the best way to do this but it isn't working for me. I have put an example with fake data in the screenshot below. Essentially, I want VLOOKUP to search for the name "Cox" in the Table and find the name under the LastName column, then print the ID that is next to it (in this case, cell D2 should print a 3, indicating that Perry's Partner is ID#3). As you can see, however, Excel is returning error messages that it can't find the expected value. I've looked at various tutorials and I can't figure out what I'm doing wrong. Thank you! 

 

The formula I'm using is =VLOOKUP(C2,$A$2:$B$7,1,FALSE)

 

  • Hi jtrick 

     

    The two options I've found are either change the order of your columns so that the lookup value (PartnerLast) is in the first column in the range (MS Advice here).

     

    Alternatively, you can use XLOOKUP:
    Formula used: =XLOOKUP(C2,$B$2:$B$7,$A$2:$A$7)

     

     

     

3 Replies

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    jtrick Alternatively, if your Excel does not have XLOOKUP and you are not able/allowed to change the order of the columns you could try this:

     

  • PewPewProject's avatar
    PewPewProject
    Brass Contributor

    Hi jtrick 

     

    The two options I've found are either change the order of your columns so that the lookup value (PartnerLast) is in the first column in the range (MS Advice here).

     

    Alternatively, you can use XLOOKUP:
    Formula used: =XLOOKUP(C2,$B$2:$B$7,$A$2:$A$7)

     

     

     

Resources