Is this a trim issue

B

Box666

I have been given somebody's library to catalogue and provide a search
engine for. At the moment it is in text format in column A.

The following is an example.

G:\Books\N O P\Nigel R Clough\Nigel R Clough - How To Make and Use
Mirrors.pdf

Or sometimes it appears as
G:\Books\N O P\Nigel R Clough - How To Make and Use Mirrors.pdf

So I want to move everything to the right of the last “\” into column
B and the rest into column C. So in the first example above:-

Nigel R Clough - How To Make and Use Mirrors.pdf would be in Column B
And
G:\Books\N O P\Nigel R Clough\ would be on Column C.

While in the 2nd example
Nigel R Clough - How To Make and Use Mirrors.pdf would be in Column B
And
G:\Books\N O P\ would be on Column C.

Any help in this matter would be much appreciated.
 
R

Ron Rosenfeld

I have been given somebody's library to catalogue and provide a search
engine for. At the moment it is in text format in column A.

The following is an example.

G:\Books\N O P\Nigel R Clough\Nigel R Clough - How To Make and Use
Mirrors.pdf

Or sometimes it appears as
G:\Books\N O P\Nigel R Clough - How To Make and Use Mirrors.pdf

So I want to move everything to the right of the last “\” into column
B and the rest into column C. So in the first example above:-

Nigel R Clough - How To Make and Use Mirrors.pdf would be in Column B
And
G:\Books\N O P\Nigel R Clough\ would be on Column C.

While in the 2nd example
Nigel R Clough - How To Make and Use Mirrors.pdf would be in Column B
And
G:\Books\N O P\ would be on Column C.

Any help in this matter would be much appreciated.

B1:

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

C1:

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



--ron
 
A

Alejandro Medinilla elMedex

first create a function to reverse the string

Function InvertStr(str As String)
InvertStr = StrReverse(str)
End Function

then use that function as formula

b1:
=LEFT(A1,LEN(InvertStr(A1))-FIND("\",InvertStr(A1))+1)
c1:
=InvertStr(LEFT(InvertStr(A1),FIND("\",InvertStr(A1))-1))


Regards

elMedex
 
B

Box666

B1:

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

C1:

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

--ron- Hide quoted text -

- Show quoted text -

Ron,
Thank you B1 works great but C1 brings up a #VALUE! error
 
R

Ron Rosenfeld

Ron,
Thank you B1 works great but C1 brings up a #VALUE! error

I don't know why or how the C1 formula got changed from what I posted. Must be
an idiosyncrasy of how you are accessing the newsgroup.

In any event, there should not be a hyphen prior to the slash in the last
substitute function.

Perhaps if I put it on two lines, it'll "come through" properly:

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

--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top