Mix of Vlookup, find and substitute

Cooki

Board Regular
Joined
Jul 31, 2018
Messages
86
Hi All

Have issues with this formula

=VLOOKUP(FIND("*",SUBSTITUTE(A8,".","*",LEN(A8)-LEN(SUBSTITUTE(A8,".","")))),Data!B:C,2,0)

What i want is to do a Vlookup on everything in the cell up to the full STOP (.).

This formula is giving me the position of the last full stop

FIND("*",SUBSTITUTE(A8,".","*",LEN(A8)-LEN(SUBSTITUTE(A8,".",""))))

but now i want to include vlookup everything up to the full stop

Any ideas?
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
5,195
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
try Add your Lookup formula to
=LEFT(A8,FIND("*",SUBSTITUTE(A8,".","*",LEN(A8)-LEN(SUBSTITUTE(A8,".",""))))-1)
 

Cooki

Board Regular
Joined
Jul 31, 2018
Messages
86
1595428595183.png


Changed formula just for the screen shot

=VLOOKUP(FIND("*",SUBSTITUTE(A8,".","*",LEN(A8)-LEN(SUBSTITUTE(A8,".","")))),$A$16:$B$20,2,0)
 
Last edited:

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
5,195
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
You left out part of the suggestion.
Try using Excel's Formula Evaluate.
The info below also shows an alternative
I just read your message again. You may not need the minus 1 since your Table has a decimal at the end.

T202007b.xlsm
ABCDE
8abc.def.a99899
5c
Cell Formulas
RangeFormula
B8B8=VLOOKUP(LEFT(A8,FIND("*",SUBSTITUTE(A8,".","*",LEN(A8)-LEN(SUBSTITUTE(A8,".",""))))-1),A16:B20,2,0)
C8C8=FIND("~",SUBSTITUTE(A8,".","~",2))
E8E8=VLOOKUP(LEFT(A8,FIND("~",SUBSTITUTE(A8,".","~",2))-1),A16:B20,2,0)


T202007b.xlsm
ABCDEF
8abc.def.a9999
5c
Cell Formulas
RangeFormula
B8B8=VLOOKUP(LEFT(A8,FIND("*",SUBSTITUTE(A8,".","*",LEN(A8)-LEN(SUBSTITUTE(A8,".",""))))),A16:B20,2,0)
E8E8=VLOOKUP(LEFT(A8,FIND("~",SUBSTITUTE(A8,".","~",2))),A16:B20,2,0)
 
Last edited:

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
5,195
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
My suggestions assumed that there were 2 "." and you wanted to stop at the last "."

To post a clear example of your challenge with information that we can use, see the link to XL2BB.
T202007b.xlsm
ABCDE
8HT/HP Report:HHDC.XXXXXXX99991899
5c
Cell Formulas
RangeFormula
B8B8=VLOOKUP(LEFT(A8,FIND("*",SUBSTITUTE(A8,".","*",LEN(A8)-LEN(SUBSTITUTE(A8,".",""))))),A16:B20,2,0)
C8C8=VLOOKUP(LEFT(A8,FIND("~",SUBSTITUTE(A8,".","~",1))),A16:B20,2,0)
D8D8=FIND(".",A8,1)
E8E8=VLOOKUP(LEFT(A8,FIND(".",A8,1)),A16:B20,2,0)
 
Last edited:

Cooki

Board Regular
Joined
Jul 31, 2018
Messages
86
You left out part of the suggestion.
Try using Excel's Formula Evaluate.
The info below also shows an alternative
I just read your message again. You may not need the minus 1 since your Table has a decimal at the end.

T202007b.xlsm
ABCDE
8abc.def.a99899
5c
Cell Formulas
RangeFormula
B8B8=VLOOKUP(LEFT(A8,FIND("*",SUBSTITUTE(A8,".","*",LEN(A8)-LEN(SUBSTITUTE(A8,".",""))))-1),A16:B20,2,0)
C8C8=FIND("~",SUBSTITUTE(A8,".","~",2))
E8E8=VLOOKUP(LEFT(A8,FIND("~",SUBSTITUTE(A8,".","~",2))-1),A16:B20,2,0)


T202007b.xlsm
ABCDEF
8abc.def.a9999
5c
Cell Formulas
RangeFormula
B8B8=VLOOKUP(LEFT(A8,FIND("*",SUBSTITUTE(A8,".","*",LEN(A8)-LEN(SUBSTITUTE(A8,".",""))))),A16:B20,2,0)
E8E8=VLOOKUP(LEFT(A8,FIND("~",SUBSTITUTE(A8,".","~",2))),A16:B20,2,0)

Worked prefect thanks
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,446
Messages
5,837,299
Members
430,494
Latest member
abhi_is_yours

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
Top