Vlookup with Partial Text Match

OkampoVictory

New Member
Joined
Jan 22, 2018
Messages
6
Hello Everyone,

I am hoping to populate a cell in a worksheet using Vlookup and a lookup value. The lookup value is a First and a Last Name (e.g. Serena Williams). The table array is on a separate worksheet containing the staff details for all the staff in this company. However, the first and last name are on two separate columns (e.g. B1: Williams C1:Serena). The Vlookup formula I entered was not working. I have attached the example below:

Worksheet 1:
Staff
Rank
Serena Williams
(Want Result Here)

<tbody>
</tbody>

Worksheet 2

<colgroup><col span="2"></colgroup><tbody>
</tbody>
Surname
Forename
Position
Reporting Unit
Joining Date
Grade
Rank
Williams
Serena
Manager
Finance
12/12/2012
B
Senior Manager

<tbody>
</tbody>

Ideally, the Vlookup formula will return the rank based on part of the name present in worksheet 1.

Many thanks for your help!

Victory
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Which part of the name? first name or surname?

You will get errors when only partially checking and the same first name or surname appear. dependant on how you want to search
 
Upvote 0
Hi Cooper645,

I am searching by the first name (Serena). Her name does not appear again on worksheet 2.

Thanks.

Victory
 
Upvote 0
Hi, welcome to the board!

Here are a couple of options, the Option1 uses both the first name and the second, Option 2 just uses the first name.


Excel 2013/2016
ABC
1StaffOption 1Option 2
2Serena WilliamsSenior ManagerSenior Manager
3Tim HenmanTeam LeaderTeam Leader
Sheet1
Cell Formulas
RangeFormula
B2=INDEX(Sheet2!$G$2:$G$1000,MATCH(A2,INDEX(Sheet2!$B$2:$B$1000&" "&Sheet2!$A$2:$A$1000,0),0))
C2=VLOOKUP(LEFT(A2,FIND(" ",A2&" ")-1),Sheet2!$B$1:$G$1000,6,0)



Excel 2013/2016
ABCDEFG
1SurnameForenamePositionReporting UnitJoining DateGradeRank
2WilliamsSerenaManagerFinance12/12/2012BSenior Manager
3BeckerBorisTea BoyCatering01/01/2001AManager
4HenmanTimPlayerHR01/01/2001CTeam Leader
Sheet2
 
Last edited:
Upvote 0
this should do the trick

=VLOOKUP(LEFT(A2,SEARCH(" ",A2,1)-1),Sheet2!B2:G13,5,0)



​Explained
=VLOOKUP(LEFT(A2,SEARCH(" ",A2,1)-1),Sheet2!B2:G13,5,0)

This looks in A2 and finds the space character and takes one from that number, essentially how long the first name is

this extracts the first name determined by the length found in red

The rest of the formula simply is the Vlookup for the entire first name from your data range on sheet 2.
 
Upvote 0
Hello Everyone,

I am hoping to populate a cell in a worksheet using Vlookup and a lookup value. The lookup value is a First and a Last Name (e.g. Serena Williams). The table array is on a separate worksheet containing the staff details for all the staff in this company. However, the first and last name are on two separate columns (e.g. B1: Williams C1:Serena). The Vlookup formula I entered was not working. I have attached the example below:

Worksheet 1:
StaffRank
Serena Williams(Want Result Here)

<tbody>
</tbody>

Worksheet 2

<tbody>
</tbody>
SurnameForenamePositionReporting UnitJoining DateGradeRank
WilliamsSerenaManagerFinance12/12/2012BSenior Manager

<tbody>
</tbody>

Ideally, the Vlookup formula will return the rank based on part of the name present in worksheet 1.

Many thanks for your help!

Victory

Assuming U have 5 rows of names, this will be the formula:

=INDEX(Worksheet2!G$2:G$5,MATCH(1,(LEFT(A2,(FIND(" ",A2)-1))=Worksheet2!B$2:B$6)*(MID(A2,FIND(" ",A2)+1,256)=Worksheet2!A$2:A$6),0))
 
Last edited:
Upvote 0
Hi Simon4s,

Unfortunately I am a bit of a novice still with Excel but your solution gives me something to learn and understand. Thanks for your help!
Victory
 
Upvote 0

Forum statistics

Threads
1,215,443
Messages
6,124,890
Members
449,194
Latest member
JayEggleton

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