extract a substring between the first and second backslash from the right

Andreas Hermle
Andreas Hermle used Ask the Experts™
on
Dear Experts:

I would like to extract string between first and second back slash from the RIGHT using a formula (bolded string)

Any idea how I can achieve this? The string to be extracted always starts with PM_

Help is much appreciated. Thank you very much in advance.

Regards, Andreras

\\172.20.10.68\DATEN$\KLS_Allgemein\NEW\Lot2\DMD\PM_4\Sample_File_2_bw.pdf
\\172.20.10.68\DATEN$\KLS_Allgemein\DMD\PM_2_3\Sample_File_4_bw_new_2.pdf
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015
Commented:
Maybe this...

Assuming your string is in A2, then try this...

=REPLACE(REPLACE(A2,1,FIND("\PM_",A2),""),FIND("\",REPLACE(A2,1,FIND("\PM_",A2),"")),255,"")

Open in new window

Andreas HermleTeam leader

Author

Commented:
Hi Neeraj,

great, works like a charm, very professional, I highly appreciate it.

Regards, Andreas
Subodh Tiwari (Neeraj)Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015

Commented:
You're welcome Andreas! Glad it worked as desired.
Thanks for the feedback.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial