Search code examples
excelexcel-formulaworksheet-function

Formula to get the Nth substring between a seperator


I have this Image Path on Cell A1: E:\Test\Coll\01\Red\Example\Untitled-1.jpg BEFORE

I want cells B2 to whatever it takes (in my case H2) to show the Nth substring between the separator "\", meaning: AFTER

I know the Data to Columns does the exact same thing, but i need it to be dynamic.

Any ideas please?


Solution

  • Formula for B2

    =TRIM(MID(SUBSTITUTE($A2,"\",REPT(" ",100)),(B$1-1)*100+1,100))
    

    Copy accross as far as needed