A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Extracting the last word from a string.



 
 
Thread Tools Display Modes
  #1  
Old March 19th, 2010, 01:58 PM posted to microsoft.public.excel.worksheet.functions
Ciarán
external usenet poster
 
Posts: 8
Default Extracting the last word from a string.

I have a list in excel like the one below.
The filename is always after the last "/".
What formula can I use to extract the filename?
The number of instances of "/" is not cosistent in every path string.


../ABCD/home/ABCD/EFGH/ciaran
../ABCD/home/ABCD/EFGH/bin/paul
../ABCD/home/james
../ABCD/home/ABCD/EFGH/bin/partition

The results I would like a
ciaran
paul
james
partition
  #2  
Old March 19th, 2010, 02:56 PM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default Extracting the last word from a string.

Hi,

Try this

=RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1,"/","*",LEN(A1)-LEN(SUBSTITUTE(A1,"/","")))))
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Ciarán" wrote:

I have a list in excel like the one below.
The filename is always after the last "/".
What formula can I use to extract the filename?
The number of instances of "/" is not cosistent in every path string.


../ABCD/home/ABCD/EFGH/ciaran
../ABCD/home/ABCD/EFGH/bin/paul
../ABCD/home/james
../ABCD/home/ABCD/EFGH/bin/partition

The results I would like a
ciaran
paul
james
partition
.

  #3  
Old March 19th, 2010, 03:21 PM posted to microsoft.public.excel.worksheet.functions
Teethless mama
external usenet poster
 
Posts: 3,722
Default Extracting the last word from a string.

=TRIM(RIGHT(SUBSTITUTE(A1,"/",REPT(" ",99)),99))


"Ciarán" wrote:

I have a list in excel like the one below.
The filename is always after the last "/".
What formula can I use to extract the filename?
The number of instances of "/" is not cosistent in every path string.


../ABCD/home/ABCD/EFGH/ciaran
../ABCD/home/ABCD/EFGH/bin/paul
../ABCD/home/james
../ABCD/home/ABCD/EFGH/bin/partition

The results I would like a
ciaran
paul
james
partition
.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:06 PM.


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