# vlookup a table with a value before a comma

#### Dares2

##### New Member
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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

#### Fluff

##### MrExcel MVP, Moderator
You can do that like
Excel Formula:
``=VLOOKUP(X2&"*",A2:D100,4,0)``
where X2 is the cell with the value to find.

#### Peter_SSs

##### MrExcel MVP, Moderator
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)

#### Dares2

##### New Member
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

 Name Gross pf new Fnights Total Baker, Annie \$1,000.00 4.00 =SUM(C5*D5)+VLOOKUP(A5&"*",C9:E11,2,FALSE) Baker Blue 2237 Bawden Red 2273 Smith Green 2283

#### Dares2

##### New Member

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

 Name Gross pf new Fnights Total Baker, Annie \$1,000.00 4.00 =SUM(C5*D5)+VLOOKUP(A5&"*",C9:E11,2,FALSE) Baker Blue 2237 Bawden Red 2273 Smith Green 2283

#### Peter_SSs

##### MrExcel MVP, Moderator
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)

#### Dares2

##### New Member
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

#### Peter_SSs

##### MrExcel MVP, Moderator
thanks so much..worked a treat
You're welcome. Glad we could help. Thanks for the follow-up.

Replies
6
Views
223
Replies
6
Views
131
Replies
4
Views
198
Replies
3
Views
177
Replies
8
Views
448

1,148,171
Messages
5,745,173
Members
423,931
Latest member
thangvan114

### 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.

### Which adblocker are you using?

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

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