Closed Thread
Results 1 to 11 of 11

separate text and numbers

  1. #1
    Registered User
    Join Date
    08-22-2007
    Posts
    3

    separate text and numbers

    I need help creating a formula to separate the text from the numbers into 2 separate columns.

    Examples are:
    A1= Angel Romero 260.00
    A2= Wieben Chiropractic Clinic 74.00
    A3= R Ricardo Ramirez Dds 340.00

    The 'Text to Column' function does not work because there is no fixed width and no deliminater. To add in a deliminater, like a "\", is an option but there are thousands of cells to do this to.

    As you can see, using LEFT, RIGHT and MID functions become tricky since the deliminater would be a "space" but there are often several "spaces" in the string of characters.

    Is there a way to SEARCH or FIND the first number and let that be the deliminater?

    Thanks, Derek

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    separate text and numbers

    This might be the easiest approach....

    With A1 containing text (ending with a space and numbers)

    Try this
    B1: =SUBSTITUTE(A1," ","|",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))
    Copy that formula down as far as you need

    If A1: Angel Romero 260.00
    Then B1 returns: Angel Romero|260.00

    Copy the Col_B formulas....<edit><paste special>...Check: Values...Click [OK]

    That will hardcode the formula results
    Last, <data><text-to-columns>...Delimited...Use | to break the text.

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Contributor
    Join Date
    11-23-2005
    Location
    Perth, Australia
    Posts
    218

    separate text and numbers

    I would use text to columns, there is an option to treat consecutive delimiters as one. If you select this it should not matter if there is more then one space.....

  4. #4
    Registered User
    Join Date
    08-22-2007
    Posts
    3

    substitution works great

    Ron,

    thanks for your solution. it worked great. I don't quite understand the formula but it works.

    Thanks a million,
    Derek

  5. #5
    Registered User
    Join Date
    08-22-2007
    Posts
    3

    consecutive delimiters

    Steel Monkey,

    The consecutive delimiters option in "text to column" does not work for my problem because "consecutive" is taken to mean immediately consecutive, i.e. one character after another. The delimiters I could use are the spaces but these are at 2+ positions in the string that are not side by side.

    anyways, thanks for your suggestion.

    Derek

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    separate text and numbers

    Quote Originally Posted by dvandaniker
    Ron,

    thanks for your solution. it worked great. I don't quite understand the formula but it works.

    Thanks a million,
    Derek
    Yes, it does look a little cryptic, doesn't it?

    RE: =SUBSTITUTE(A1," ","|",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))

    Basically, this part: LEN(A1)-LEN(SUBSTITUTE(A1," ",""))
    takes the length of cell A1's displayed value and subtracts the length of the value without spaces. The difference is the number of spaces in that cell.

    The wrap around SUBSTITUTE function replaces the last space (which is the count we calculated) with a pipe: |

    So, if there were 3 spaces in A1 the formula partially resolves to this:
    =SUBSTITUTE(A1," ","|",3)

    I hope that helps.

  7. #7
    GrandLake
    Guest

    Seperate number and text in a cell to column

    I have reviewed the blog there you have the number last in a cell. How can I change the function to state if the number is first in the cell?

  8. #8
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    GrandLake,

    You should start a new thread with your problem rather than joining in an existing one.
    Ed
    _____________________________
    Always learning, but never enough!
    _____________________________

  9. #9
    GrandLake
    Guest

    one cell starting w numbers then text - seperate

    Thank you for the prompt reply.
    I have one cell that looks like
    01 11 13 Work Covered by contract Documents
    I wanted to have all the numbers in one column and the all the text in the next column.
    I did a convertion on text to column that seperated into 8 columns. then I Concatenate the columns into one. this all worked out, but I was just wondering if there would have been an esier way to perform the task at hand. Thank you!!
    Bea

  10. #10
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    Talk to myself

  11. #11
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

    Old Thread closed. Please start you're own thread as already suggested

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1