Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Extract characters from Right of string

Hi all,

I have a spreadsheet containing 65,000 rows. Each row has a cell containing
a string in the following format:

Data\Docs\20011018\kaateec\20114.Tif

What I need to be able to do is extract the last characters from the right
of the string until we reach the last '\' character. For example, the above
would result in:

20114.Tif

So yes, I'm trying to extract a filename only here. The filename vary in
length, some 4 characters and some up to 8 characters so using this:

Right(A1,9)

....simply does not work on all occasions.

Should be straight forward but I simply cannot get it to work.

Many Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,646
Default Extract characters from Right of string

This UDF does the job:
Function fname(inpstr)
fname = Mid(inpstr, InStrRev(inpstr, "\") + 1)
End Function
Regards,
Stefi

€žashg657€ť ezt Ă*rta:

Hi all,

I have a spreadsheet containing 65,000 rows. Each row has a cell containing
a string in the following format:

Data\Docs\20011018\kaateec\20114.Tif

What I need to be able to do is extract the last characters from the right
of the string until we reach the last '\' character. For example, the above
would result in:

20114.Tif

So yes, I'm trying to extract a filename only here. The filename vary in
length, some 4 characters and some up to 8 characters so using this:

Right(A1,9)

...simply does not work on all occasions.

Should be straight forward but I simply cannot get it to work.

Many Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 42
Default Extract characters from Right of string

=RIGHT(A1,LEN(A1)-FIND("\",A1,FIND("\",A1,FIND("\",A1,FIND("\",A1,1) +1)+1)+1))

Vijay

"ashg657" wrote:

Hi all,

I have a spreadsheet containing 65,000 rows. Each row has a cell containing
a string in the following format:

Data\Docs\20011018\kaateec\20114.Tif

What I need to be able to do is extract the last characters from the right
of the string until we reach the last '\' character. For example, the above
would result in:

20114.Tif

So yes, I'm trying to extract a filename only here. The filename vary in
length, some 4 characters and some up to 8 characters so using this:

Right(A1,9)

...simply does not work on all occasions.

Should be straight forward but I simply cannot get it to work.

Many Thanks in advance.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Extract characters from Right of string

With your full path in A1; try the below formula..

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

If this post helps click Yes
---------------
Jacob Skaria


"ashg657" wrote:

Hi all,

I have a spreadsheet containing 65,000 rows. Each row has a cell containing
a string in the following format:

Data\Docs\20011018\kaateec\20114.Tif

What I need to be able to do is extract the last characters from the right
of the string until we reach the last '\' character. For example, the above
would result in:

20114.Tif

So yes, I'm trying to extract a filename only here. The filename vary in
length, some 4 characters and some up to 8 characters so using this:

Right(A1,9)

...simply does not work on all occasions.

Should be straight forward but I simply cannot get it to work.

Many Thanks in advance.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 272
Default Extract characters from Right of string

You could also do an editreplace...
Find what: *\
Replace with: (blank)

Do this on a copy of the column if you want to keep the original values.

"ashg657" wrote:

Hi all,

I have a spreadsheet containing 65,000 rows. Each row has a cell containing
a string in the following format:

Data\Docs\20011018\kaateec\20114.Tif

What I need to be able to do is extract the last characters from the right
of the string until we reach the last '\' character. For example, the above
would result in:

20114.Tif

So yes, I'm trying to extract a filename only here. The filename vary in
length, some 4 characters and some up to 8 characters so using this:

Right(A1,9)

...simply does not work on all occasions.

Should be straight forward but I simply cannot get it to work.

Many Thanks in advance.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Extract characters from Right of string

Many thanks for your assistance guys. Solutions have worked very well.

Cheers.

"Jacob Skaria" wrote:

With your full path in A1; try the below formula..

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

If this post helps click Yes
---------------
Jacob Skaria


"ashg657" wrote:

Hi all,

I have a spreadsheet containing 65,000 rows. Each row has a cell containing
a string in the following format:

Data\Docs\20011018\kaateec\20114.Tif

What I need to be able to do is extract the last characters from the right
of the string until we reach the last '\' character. For example, the above
would result in:

20114.Tif

So yes, I'm trying to extract a filename only here. The filename vary in
length, some 4 characters and some up to 8 characters so using this:

Right(A1,9)

...simply does not work on all occasions.

Should be straight forward but I simply cannot get it to work.

Many Thanks in advance.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Leading Characters If String Is Only 7 Characters Paperback Writer Excel Discussion (Misc queries) 2 April 21st 09 09:07 PM
How to extract specific text from a string of characters rushdhih Excel Worksheet Functions 7 February 19th 09 09:58 AM
Extract Certain Characters and Numbers JavyD Excel Worksheet Functions 3 March 28th 06 04:09 PM
Extract the first few characters MC_blur Excel Worksheet Functions 6 January 13th 06 05:18 PM
HOW DO I EXTRACT ALL CHARACTERS AFTER 5 CHARACTERS ON LEFT GRYSYF Excel Worksheet Functions 5 October 12th 05 10:58 AM


All times are GMT +1. The time now is 05:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"