1

We have a list with 1000's of values in a single column.The values will be in this format

W:\RT_QAQC\Received\20160411_GDM_QA\VD\RegRef\Afr\Geology\IAE_Geology_Africa_10M
W:\RT_QAQC\Received\20160411_GDM_QA\VD\GlobRef\Ind\GIS\SS_GIS_Ind

I would like to split it using the last backslash a delemiter. So the result will be

W:\RT_QAQC\Received\20160411_GDM_QA\VD\RegRef\Afr\Geology
W:\RT_QAQC\Received\20160411_GDM_QA\VD\GlobRef\Ind\GIS

And in the next column,

IAE_Geology_Africa_10M
SS_GIS_Ind

I've tried with this one

=TRIM(RIGHT(SUBSTITUTE(A1,"\",REPT(" ",LEN(A1))),LEN(A1))) 

But it's only copying the characters after the last backslash

joseph_k
  • 149
  • 1
  • 9

2 Answers2

2

How about:

=MID(A1,1,FIND(CHAR(1),SUBSTITUTE(A1,"\",CHAR(1),LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))))-1)

enter image description here

This uses a simple technique to determine the position of the last occurrence of a substring in a string.

Another approach is to use tigeravatar's approach

Community
  • 1
  • 1
Gary's Student
  • 95,722
  • 10
  • 59
  • 99
0

Assuming your source data is in column A and you do not have a header row and your data start in row 1. In C1 use the formula you posted as it seems to do what you want for the second column. It also makes our life easIer on how to deal with the first column. In B1 place the following.

=LEFT(A1,LEN(A1)-LEN(C1)-1)

Results

enter image description here

Forward Ed
  • 9,484
  • 3
  • 22
  • 52