#1   Report Post  
Steve
 
Posts: n/a
Default Find Function

Hi
Cell A2=aaaa-bbb-cccc-d
in A1 I would like a formula to find the second "-" from the right and
return cccc-d. The number of characters in each segement of A2 can vary and
thennumber of segments may vary as well, so the search will have to be from
the right.
Thanks
  #2   Report Post  
Vasant Nanavati
 
Posts: n/a
Default

Brute force :-):

=RIGHT(A2,LEN(A2)-FIND("/",SUBSTITUTE(A2,"-","/",LEN(A2)-LEN(SUBSTITUTE(A2,"
-",""))-1)))

--

Vasant

"Steve" wrote in message
...
Hi
Cell A2=aaaa-bbb-cccc-d
in A1 I would like a formula to find the second "-" from the right and
return cccc-d. The number of characters in each segement of A2 can vary

and
thennumber of segments may vary as well, so the search will have to be

from
the right.
Thanks



  #3   Report Post  
Harlan Grove
 
Posts: n/a
Default

Vasant Nanavati wrote...
Brute force :-):

=3DRIGHT(A2,LEN(A2)-FIND("/",SUBSTITUTE(A2,"-","/",
LEN(A2)-LEN(SUBSTITUTE(A2,"-",""))-1)))

..=2E.

You could save a function call and shorten this to

=3DMID(A2,FIND("=AC",SUBSTITUTE(A2,"-","=AC",
LEN(A2)-LEN(SUBSTITUTE(A2,"-",""))-1))+1,256)

but that leaves the quibble that if the string could contain any
characters, the robust approach would be an array formula like

=3DMID(A2,LARGE(IF(MID(A2,ROW(INDIRECT("1:256")),1 )=3D"-",
ROW(INDIRECT("1:256"))),2)+1,256)

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
What function would let me find Batting Averages? pertimesco Excel Worksheet Functions 2 March 1st 05 01:38 PM
What function would let me find Batting Averages? pertimesco Excel Worksheet Functions 1 March 1st 05 01:03 PM
What function would let me find Batting Averages? pertimesco Excel Worksheet Functions 0 March 1st 05 10:11 AM
ISNULL function - can't find it KitKat Excel Worksheet Functions 6 December 3rd 04 04:55 AM
Find a Function to use accross different worksheets R. Hale Excel Worksheet Functions 3 November 25th 04 07:07 AM


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

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

About Us

"It's about Microsoft Excel"