Vlookup after LEFT, TRIM and still receiving ERROR

StickyNote1

New Member
Joined
Jul 19, 2019
Messages
10
Good day new to this community. I've been trying to use the following formula to have data on the LEFT of the same CELL to clean it and use it to VLOOK up another sheet and brining in a code.

Formula: =
VLOOKUP(LEFT(H4,(FIND("V.",TRIM(SUBSTITUTE(H4,CHAR(160),CHAR(32))))-2)),'Vlookup Data'!B:C,2,FALSE)

The Cell: contains the following( see below in BOLD and that's where im trying to get the AS FAUSTINA from and do Vlookup from another table.

[TABLE="width: 287"]
<tbody>[TR]
[TD="class: xl67, width: 287"]AS FAUSTINA V. 22[/TD]
[/TR]
</tbody>[/TABLE]

-------Tried to include small Sample excel sheet with but didn't see upload feature."
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi, your formula is working for me and giving AS FAUSTINA. Can you check if the value you are getting from the LEFT function is equal to AS FAUSTINA in Vlookup Data tab of the excel ?

Also try below:

Code:
=VLOOKUP(LEFT(H4,SEARCH("/",SUBSTITUTE(H4," ","/",2))-1),'Vlookup Data'!B:C,2,FALSE)
 
Upvote 0
Hi, your formula is working for me and giving AS FAUSTINA. Can you check if the value you are getting from the LEFT function is equal to AS FAUSTINA in Vlookup Data tab of the excel ?

Also try below:

Code:
=VLOOKUP(LEFT(H4,SEARCH("/",SUBSTITUTE(H4," ","/",2))-1),'Vlookup Data'!B:C,2,FALSE)
----------------------- @Aryatect Thank you for your feedback yes the formula works fine when its text. Thats what i wanted to include my sample sheet as the cell was pulled from a database and appears to have funky type of spacing. How can I share/upload my small sheet with the sample for you to look at?
 
Upvote 0
You can use dropbox or googledrive to upload your file and share the link here.
 
Upvote 0
Hi, So this you have Char(160) in the first tab but second tab has CHAR(32) - "space" that is why it is not matching, below should work:

Code:
=VLOOKUP(SUBSTITUTE(LEFT(G4,SEARCH("/",SUBSTITUTE(G4,CHAR(160),"/",2))-1),CHAR(160)," "),'Vlookup Data'!B:C,2,FALSE)
 
Upvote 0
Hi,

Formula in Sheet 1 I4 copied down:


Book1
GHI
4ASFAUSTINAV.22AFA
5ASFAUSTINAV.22AFA
6ASFAUSTINAV.22AFA
Sheet1
Cell Formulas
RangeFormula
I4=VLOOKUP(TRIM(LEFT(SUBSTITUTE(G4,CHAR(160)," "),SEARCH("V.",G4)-1)),'Vlookup Data'!B:C,2,0)
 
Upvote 0
Thank you very much this worked like a charm. I now need to review your MAGIC formula to understand for future. But greatly appreciate your time and help. Cheers
 
Upvote 0
Glad we could help and thanks for the feedback.

Basically we are swapping the CHAR(160) with CHAR(32) which you did too, I was just searching for the second "space" and calculated from there and jtakw used TRIM after getting the data.
 
Upvote 0
Not sure who's formula you're referring to, but just want to point out, formula posted in Post # 6 will fail for Single Word or more than 2 word Vessel names since it relies on the 2nd CHAR(160), whereas my formula in Post # 7 will work for Any number of words for Vessel names.

Anyhow, you're welcome, and welcome to the forum.


Book1
GHIJ
4ASFAUSTINAV.22AFAAFA
5AcapulcoV.22ACA#N/A
6ASFAUSTINAV.22AFAAFA
7My formulaPost #6
Sheet1
Cell Formulas
RangeFormula
I4=VLOOKUP(TRIM(LEFT(SUBSTITUTE(G4,CHAR(160)," "),SEARCH("V.",G4)-1)),'Vlookup Data'!B:C,2,0)
J4=VLOOKUP(SUBSTITUTE(LEFT(G4,SEARCH("/",SUBSTITUTE(G4,CHAR(160),"/",2))-1),CHAR(160)," "),'Vlookup Data'!B:C,2,FALSE)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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