VLookup with multiple conditions

noltron

New Member
Joined
May 16, 2014
Messages
2
Hello,
Excel semi-noob here, I have a vlookup issue that has been driving me crazy.

I am working from a sheet (in workbook A) that has a list of usernames in column E. These usernames also exist in column B of Workbook B but they contain an extra five or six charactes at the end of the string.

Example:
Column E of Workbook A
username

Column B of Workbook B
username (xyz)
or
username (xy)

I want to use these usernames in workbook A to lookup their associated 'machine name' in column C of workbook B, BUT only if that row in column D (of worksheet B) contains '5.1'.

I imagine I need some kind of nested if statement within the vlookup to only look at rows of worksheet B where column D contains '5.1'. But also, I need to figure out how to dynamically trim the trailing 5 or 6 characters from the usernames in column B or worksheet B so that the vlookup will recognize the usernames.

I hope this was clear enough, please let me know if you need further clarification. I will be feverishly working on this all day today and any help would be appreciated beyond words.

Thanks,

Noltron
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Welcome to MrExcel.

See if you can adapt this:

=INDEX(Sheet2!C1:C100,MATCH(1,INDEX((LEFT(Sheet2!B1:B100,LEN(E1))=E1)*(Sheet2!D1:D100=5.1),),FALSE))
 
Upvote 0
try also this:


Excel 2010
ABCDEF
1username (xyz)5.1username5.1
2username1 (xy)
Sheet1
Cell Formulas
RangeFormula
B1=IFERROR(VLOOKUP(LEFT(A1,FIND(" ",A1)-1),$E$1:$F$22,2,0),"")



EDIT: To late... see Andrews post above
 
Last edited:
Upvote 0
Welcome to MrExcel.

See if you can adapt this:

=INDEX(Sheet2!C1:C100,MATCH(1,INDEX((LEFT(Sheet2!B1:B100,LEN(E1))=E1)*(Sheet2!D1:D100=5.1),),FALSE))

Good formula, but I see 1 possible problem in there. If you would search name say "John" and in other table would be name "Johne" formula will match it
 
Upvote 0
If there's always a space before the extra data:

=INDEX(Sheet2!C1:C100,MATCH(1,INDEX((LEFT(Sheet2!B1:B100,LEN(E1&" "))=E1&" ")*(Sheet2!D1:D100=5.1),),FALSE))
 
Upvote 0

Forum statistics

Threads
1,217,367
Messages
6,136,148
Members
449,994
Latest member
Rocky Mountain High

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