Return right-most text in a string with multiple delimiters using functions...

spacely

Board Regular
Joined
Oct 26, 2007
Messages
248
Hello,

I am trying to stay out of VBA.

Just want to return the last bit of text..

firstbit\secondbit\lastbit

delimiters will always be \ but could be many. Just need that last bit after the last \.

Thanks in advance!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
to find the position of the last '\' you can do this... kinda complicated haha

Code:
=Find("@", Substitute(A1, "/", "@", Len(A1) - Len(Substitute(A1, "/", ""))))

i converted it from a udf i used so let me know if it works or not

i need to use / slashes cause mrexcel thinks \ is a control character... the @ character can be any character as long as the character is not in the text to begin with

you are replacing the last \ with a unique character which then you can get the position with Find
 
Last edited:
Upvote 0
Hello,

I am trying to stay out of VBA.

Just want to return the last bit of text..

firstbit\secondbit\lastbit

delimiters will always be \ but could be many. Just need that last bit after the last \.

Thanks in advance!

Try this:

Code:
[COLOR=#0000ff]=TRIM(RIGHT(SUBSTITUTE(A1,"\",REPT(" ",99)),99))[/COLOR]

Markmzz
 
Last edited:
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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