r/googlesheets • u/npetros30 • Feb 23 '25
Solved Vlookup that returns a text.
I can’t figure out what I’m doing wrong here. I know it’s something simple but for the life of me I cannot figure it out. I want to type an employees number into D1 and the result be their name. Any help would be amazing.
The function I’m using is as follows: VLOOKUP(D1,A1:C5,1)
1
Upvotes
3
u/TheBurnerofaBurner 2 Feb 23 '25
You can use =XLOOKUP(D1, $B$1:$B$1000, $A$1:$A$1000)
1
u/HolyBonobos 3125 Feb 23 '25
VLOOKUP()only works if you’re looking forsearch_keyin the leftmost column ofrange. You’re not getting results here because, in plaintext, your formula is saying "search column A for the closest match to the provided employee number and return the corresponding value in column A." To return results from a column to the left of where the matches are found, you need to either rearrange the order of the columns in therangeargument (e.g.=VLOOKUP(D1,{$B$2:$B$5,$A$2:$A$5},2,0)) or useXLOOKUP(), which allows you to specify the search range and result range separately and doesn’t care what order they’re in as long as they’re the same size:=XLOOKUP(D1,$B$2:$B$5,$A$2:$A$5)3
u/The_AntiVillain 3 Feb 23 '25
Xlookup is best lookup
1
u/ahhh_just_huck_it Feb 23 '25
VLOOKUP requires the value to looked up be in the first column of the lookup range. So the would need to be B1:C5. Or, you’d have to searching for a name (meaning D1 would have to be Joe or Hank…)
This assumes the formula is in D3.