Find Location of a Specific Character in a Cell With Multiple Occurrences of that Character

jeffgibson55

New Member
Joined
Aug 22, 2011
Messages
17
I'm using Excel 2007. I'm looking for a way to reference a specific cell to determine the exact location of a specific character that occurs multiple times in the string. In this case I want the numeric location of the last occurrence of the character "-" so I can extract all the text to the right of it. I've done this in the past using the find function but that always starts left to right and in my data set each cell has a different number of occurrences of the delimiting text ("-") and in this case I only care about the last occurrence of this character.

For what it's worth I'm able to count the number of the occurrences of the character ("-") in a cell with this formula: =SUM(LEN(<range>)-LEN(SUBSTITUTE(<range>,"text","")))/LEN("text") where "range" is the cell and "text" is "-", but I don't know how to find the position of the final occurrence of "-".

Any help would be most appreciated.

Thanks,
Jeff
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Welcome to the board...

If you already have a formula to COUNT the number of occurances, then you can do this..

=SEARCH("^^",SUBSTITUTE(range,"text","^^",countofoccurances))

Where ^^ is simply any string of your choice that is most UNlikely to actually appear in the original string.

Hope that helps.
 
Upvote 0
Thanks jonmo1 and VoG - I really appreciate the help and the quick replies. Both of your solutions worked perfectly - I think I'll go with VoG's just because it's a shorter formula but I got the same results with both. Thank you both for the education and for saving me a lot of time I would have otherwise spent dinking around with this and probably ending up manually running a text to columns on my data set!!!

Much Thanks!
Jeff
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top