Cannot Get Needed Results Attempting to Trim

meppwc

Well-known Member
Joined
May 16, 2003
Messages
626
Office Version
  1. 365
Platform
  1. Windows
I am trying to remove preceding characters in front of specific text. I have a formula but I am not getting the needed results. Can someone assist me?

The text in cell C2 is \\stlwrchprnprd01\a1_café2r2852
The formula in D2 is =RIGHT(C2,LEN(C2)-FIND("01",C2))
The result is "1\a1_café2r2852"
The needed result is "a1_café2r2852"

Note, I have a long list of values that I need to apply this formula to and every value in column C begins with \\stlwrchprnprd01\
I want to capture ONLY the value that follows \\stlwrchprnprd01\
To add to this, the value that follows \\stlwrchprnprd01\ is always a combination of letter and/or numbers but can vary in length.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
The FIND is finding where the "01" starts. Your desired result begins 2 characters after that.

=RIGHT(C2,LEN(C2)-FIND("01",C2)+2)

Or, to protect against errors when C2 doesn't contain "01",
=RIGHT(C2,LEN(C2)-FIND("01",C2&"01")+2)

Or, the more generic
=RIGHT(C2,LEN(C2)-FIND("01",C2&"01")+LEN("01"))
 
Upvote 0
Note, I have a long list of values that I need to apply this formula to and every value in column C begins with \\stlwrchprnprd01\
I want to capture ONLY the value that follows \\stlwrchprnprd01\
To add to this, the value that follows \\stlwrchprnprd01\ is always a combination of letter and/or numbers but can vary in length.
Use this formula instead:
Code:
=TRIM(RIGHT(SUBSTITUTE(D2,"\",REPT(" ",100)),100))
This will always return whatever is after the last "", regardless of what is before it (and is not necessarily dependent on the presence of "01", and won't have issues if that exists more than once in the string).
 
Last edited:
Upvote 0
I think I figured it out
=RIGHT(C2,LEN(C2)-FIND("01",C2)-2)

Sorry but thanks to all who read my post.
 
Upvote 0
I think I figured it out
=RIGHT(C2,LEN(C2)-FIND("01",C2)-2)
Just note that might not work if you have any values that have "01" appear more than once in your string.
You might want to add the slash after the "01" in your find command, to make sure it only identifies that one.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

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