LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Splitting complex string into 3 numbers with a formula - Please help!

After using my corrected formula for B2 posted elsewhere in this thread, of
course.<g

Rick


"T. Valko" wrote in message
...
D1: =IF(A2="","",MID(A2,FIND("-",A2,FIND("-",A2)+1)+1,99))


A few keystrokes shorter:

=SUBSTITUTE(A2,B2&"-"&C2&"-","")

--
Biff
Microsoft Excel MVP


"Rick Rothstein (MVP - VB)" wrote in
message ...
Cliff's suggested Data/Text To Columns would be the most efficient
method; but. of course, it requires you to repeat it as new entries are
made. Assuming you want the splitting apart to be automatic, you can use
the following formulas for that. Assuming your first ID number is in A2
(with A1 being a header), put the following formula in the indicated
cells and then copy them all down as far as you expect to ever have to...

B1: =IF(A2="","",LEFT(A2,FIND("-",A2)-1))

C1: =IF(A2="","",SUBSTITUTE(SUBSTITUTE(A2,B2&"-",""),"-"&D2,""))

D1: =IF(A2="","",MID(A2,FIND("-",A2,FIND("-",A2)+1)+1,99))

Rick


"Jason" wrote in message
...
Hi--

I have a string that is a unique ID number in the form XXX-XXX-XXX.
However, the number of digits in each segment of the string varies.
For example, all of the following are valid:
2-5895-223
1213-23-257676
55-1-2

I am trying to write a formula to split the string into three separate
numbers. Using the first example, the three numbers would be:
2
5895
223

I am having trouble writing a formula flexible enough to identify
where the dash is and to split the string in the right place. Any
suggestions?

Thanks,
Jason





 
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
String splitting for inconsistent strings Richard Excel Worksheet Functions 3 June 22nd 06 03:55 AM
Splitting a concatenated string into separate rows... Natarajan Excel Worksheet Functions 1 May 4th 06 05:57 PM
Splitting a text string into string and number mcambrose Excel Discussion (Misc queries) 4 February 21st 06 03:47 PM
Inserting a string seach within a complex function DJ_Swammi Excel Worksheet Functions 3 December 15th 05 08:30 PM
Splitting Character String mcertini Excel Worksheet Functions 2 September 12th 05 09:41 AM


All times are GMT +1. The time now is 01:59 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"