+ Reply to Thread
Results 1 to 4 of 4

How to pull out numbers from a text string...advanced "text to columns" question

  1. #1
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    147

    How to pull out numbers from a text string...advanced "text to columns" question

    I have a spreadsheet with a column that contains text descriptions of various products. All of the descriptions end with the size of the bottle listed. I need to pull out the bottle size into a separate column. Basically seems like an advanced "text to columns" issue, if I could do the breaks any time there is a number I would be fine, but sadly that isn't an option in Excel and I do not have very good VB skills so a self written macro is out of the question.

    Sample data looks like this:

    STRAIGHT SHAMPOO 4.5OZ
    WINDEX 10.3OZ
    DIET CHERRY PEPSI 32OZ

    So basically I want the 4.5OZ, 10.3OZ, 32OZ, etc in a different column.

    Thanks in advance for any help.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try:

    =RIGHT(A1,LEN(A1)-MIN(FIND(0,SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9},0)&0))+1)

    where A1 houses first text string.

    copied down
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    This formula assumes the space before the number is not more than 7 characters away from the end:

    =RIGHT(A1,LEN(A1)-FIND(" ",A1,LEN(A1)-7))

    EDIT: I think NBVC's formula is a safer bet!

  4. #4
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    147
    Guys, thanks, that works perfectly... I thought I knew quite a bit about excel but never would have put those functions together like that. Brilliant.

+ Reply to 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