vlookup a table with a value before a comma

Dares2

New Member
Joined
Feb 27, 2017
Messages
24
hi, I have a need to vlookup a surname in a list but the lookup range has both surname, comma then first name so eg vlookup(smith in a list that has smith,david and take the forth value along) Im not sure how to write this formula thanks.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
You can do that like
Excel Formula:
=VLOOKUP(X2&"*",A2:D100,4,0)
where X2 is the cell with the value to find.
 
Upvote 0
I would suggest including the comma in the lookup value (Y2 formula) to avoid a possible incorrect result (Z2 formula)

21 05 03.xlsm
ABCDEWXYZ
1post #3post #2
2jones, alan147smith98
3smithson, anne258
4smith, david369
VLOOKUP
Cell Formulas
RangeFormula
Y2Y2=VLOOKUP(X2&",*",A2:D100,4,0)
Z2Z2=VLOOKUP(X2&"*",A2:D100,4,0)
 
Upvote 0
I would suggest including the comma in the lookup value (Y2 formula) to avoid a possible incorrect result (Z2 formula)

21 05 03.xlsm
ABCDEWXYZ
1post #3post #2
2jones, alan147smith98
3smithson, anne258
4smith, david369
VLOOKUP
Cell Formulas
RangeFormula
Y2Y2=VLOOKUP(X2&",*",A2:D100,4,0)
Z2Z2=VLOOKUP(X2&"*",A2:D100,4,0)
Thanks although I couldnt get this to work. May because this is the otherway round ie looking up eg smith within a lookup range of smith,peter

NameGross pf
new
FnightsTotal
Baker, Annie$1,000.004.00=SUM(C5*D5)+VLOOKUP(A5&"*",C9:E11,2,FALSE)
BakerBlue2237
BawdenRed2273
SmithGreen2283
 
Upvote 0
You can do that like
Excel Formula:
=VLOOKUP(X2&"*",A2:D100,4,0)
where X2 is the cell with the value to find.
Not sure but couldnt get this to work

NameGross pf
new
FnightsTotal
Baker, Annie$1,000.004.00=SUM(C5*D5)+VLOOKUP(A5&"*",C9:E11,2,FALSE)
BakerBlue2237
BawdenRed2273
SmithGreen2283
 
Upvote 0
May because this is the otherway round
Yes, it appears that you described this the wrong way around in your original post. But it also looks like you have the wrong column referenced in the lookup range in your latest attempt.
Is below what you want?

BTW, I suggest that you
  • Update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
  • Investigate XL2BB for providing sample data to make it easier for helpers.

21 05 03.xlsm
ABCDE
4NameGross pf newFnightsTotal
5Baker, Annie$1,000.004$6,237.00
6
7
8
9BakerBlue2237
10BawdenRed2273
11SmithGreen2283
VLOOKUP (2)
Cell Formulas
RangeFormula
E5E5=C5*D5+VLOOKUP(LEFT(A5,FIND(",",A5)-1),C9:E11,3,FALSE)
 
Upvote 0
Yes, it appears that you described this the wrong way around in your original post. But it also looks like you have the wrong column referenced in the lookup range in your latest attempt.
Is below what you want?

BTW, I suggest that you
  • Update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
  • Investigate XL2BB for providing sample data to make it easier for helpers.

21 05 03.xlsm
ABCDE
4NameGross pf newFnightsTotal
5Baker, Annie$1,000.004$6,237.00
6
7
8
9BakerBlue2237
10BawdenRed2273
11SmithGreen2283
VLOOKUP (2)
Cell Formulas
RangeFormula
E5E5=C5*D5+VLOOKUP(LEFT(A5,FIND(",",A5)-1),C9:E11,3,FALSE)
thanks so much..worked a treat
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top