Formula to return value if cell contains a character within the first 10 characters

DataBlake

Well-known Member
Joined
Jan 26, 2015
Messages
781
Office Version
  1. 2016
Platform
  1. Windows
I am stumped. i don't know why i can't figure this out.
Or maybe theres a more efficient way to do this so i'll be super descriptive.

adXSyPa.png


So in column C:
#1 is how it is supposed to look, but it may also have a P or LT in front of it.
#2 & #3 are examples of P and LT, but they are also supposed to have a "/" where the " " is
So what i need in column D is the value as shown for #1 .
#2 should be "LT245/75R16" and #3 should be "P245/50R20"

so if there is an easier way let me know, but what i was thinking is a formula that check the first 5 letters for "P" and "LT" and if it is LT return the first 11 characters, P returns the first 10 characters, and neither returns the first 9 characters.

=IF(FIND("LT",LEFT(C804,5),0),LEFT(C804,11),"") was my thought process but it returns #Value
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi,

Here's one way:


Book1
CD
1245/35ZR21 XL AZENIS FK510245/35ZR21
2LT245 75R16 Pirelli Scorpionn ATR E 120 116R RBLT245/75R16
3P245 50R20 Pirelli Scorpion STR 102H RBP245/50R20
Sheet288
Cell Formulas
RangeFormula
D1=SUBSTITUTE(LEFT(C1,FIND(" ",SUBSTITUTE(SUBSTITUTE(C1," ","/"),"/"," ",2))-1)," ","/")


Formula copied down.
 
Upvote 0
Thank you SO much. i didn't know substitute was a thing.
 
Upvote 0
...and neither returns the first 9 characters.
This is apparently not correct... the first shown example line (Row 791) does not start with either a P or an LT and it has 10 characters. It appears that some of these non-P, non-LT codes are either 9 or 10 characters. Can you please clarify this for us?

Also, are the codes always followed by a space character? If so, this formula would work...

=SUBSTITUTE(LEFT(C1,FIND(" ",C1,9)-1)," ","/")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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