+ Reply to Thread
Results 1 to 15 of 15

Extracting multiple numbers in alphanumeric string

  1. #1
    Registered User
    Join Date
    05-06-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    7

    Extracting multiple numbers in alphanumeric string

    Hi All,

    I need help extracting multiple numbers in an alphanumeric string.

    Example:

    A) Gift Set -- 3.4 oz Eau De Toilette Spray + 3 oz After Shave Balm + 2.75 oz Deodorant Stick + .25 oz Mini EDT Spray
    B) Gift Set -- 4 oz Eau De Cologne Spray + 1 oz Eau De Cologne Spray
    C) Gift Set -- 1.7 oz Eau De Toilette Spray + 1.7 oz Body Lotion + 1.7 oz Shower Gel
    D) Gift Set -- 3.4 oz Eau De Toilette Spray + 4.4 oz Shower Gel
    E) Gift Set -- 3.4 oz Cologne Spray + 3.3 oz Hair & Body Wash + 2.5 oz Deodorant Stick + 3 oz Soap

    Prefered results:

    A) 3.4, 3, 2.75, .25
    B) 4,1
    C) 1.7, 1.7, 1.7
    D) 3.4,4.4
    E) 3.4, 3.3, 2.5, 3

    I want to extract the numbers so I could add them. If there's a way to bypass the extraction, it'd be better.

    I'd appreciate any help. Thanks!

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Extracting multiple numbers in alphanumeric string

    Wrong reply!!
    Last edited by Glenn Kennedy; 06-08-2014 at 08:23 AM. Reason: I goofed up. Ignore this post!!
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    05-16-2014
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Extracting multiple numbers in alphanumeric string

    Hi,

    try this ARRAY formula into B1 for A:

    =SUM(MID(A1;LARGE(ISNUMBER(--MID(A1;ROW($1:$140);1))*
    ROW($1:$140);ROW($A$1:INDEX($A:$A;COUNT(--MID(A1;ROW($1:$140);1)))));1)*
    10^(ROW(INDEX($1:$140;COUNT(--MID(A1;ROW(INDEX($1:$140;1;1):
    INDEX($1:$140;LEN(A1);1));1));1):INDEX($1:$140;1;1))-1))

    it will add all the numbers together, however I'm not sure how to proceed further, perhaps others will :-)

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Extracting multiple numbers in alphanumeric string

    Don't ask... This is truly horrendous, especially for the 4th numerical entry.

    It will work PROVIDING the 1st number is preceded by a -- and that subsequent numbers are preceded by a +. Otherwise it goes belly up.
    Attached Files Attached Files

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Extracting multiple numbers in alphanumeric string

    Minor adjustment to the above attachment -removing redundant & potentially confusing cells.
    Attached Files Attached Files

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Extracting multiple numbers in alphanumeric string

    Here is my horrendous formula that returns all the elements into 1 cell separated by commas.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This is the result:
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Extracting multiple numbers in alphanumeric string

    If you are open to a VBA solution, please find the attached sheet to see if this works as per your requirement.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting multiple numbers in alphanumeric string

    Or maybe a UDF (by DonkeyOte)

    1. Copy code below
    2. Press Alt and F11 on your keyboard to open VB Editor
    3. Click on Insert and select Module
    4. Paste code into Module and close VB Editor.

    Please Login or Register  to view this content.
    user formula in B1

    =SUBSTITUTE(TRIM(NumberOnly(A1))," ",", ")

    A
    B
    1
    A) Gift Set -- 3.4 oz Eau De Toilette Spray + 3 oz After Shave Balm + 2.75 oz Deodorant Stick + .25 oz Mini EDT Spray 3.4, 3, 2.75, .25
    2
    B) Gift Set -- 4 oz Eau De Cologne Spray + 1 oz Eau De Cologne Spray 4, 1
    3
    C) Gift Set -- 1.7 oz Eau De Toilette Spray + 1.7 oz Body Lotion + 1.7 oz Shower Gel 1.7, 1.7, 1.7
    4
    D) Gift Set -- 3.4 oz Eau De Toilette Spray + 4.4 oz Shower Gel 3.4, 4.4
    5
    E) Gift Set -- 3.4 oz Cologne Spray + 3.3 oz Hair & Body Wash + 2.5 oz Deodorant Stick + 3 oz Soap 3.4, 3.3, 2.5, 3
    Last edited by AlKey; 06-08-2014 at 02:18 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Extracting multiple numbers in alphanumeric string

    Quote Originally Posted by AlKey View Post

    Please Login or Register  to view this content.
    user formula in B1

    =SUBSTITUTE(TRIM(RemoveTxt(A1))," ",", ")
    Looks like a conflict in the function name.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  10. #10
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting multiple numbers in alphanumeric string

    @Tony Valko

    Thank you Tony for catching it. I was experimenting with two very similar udfs and copied wrong formula. Error as has been corrected now.

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Extracting multiple numbers in alphanumeric string

    ______

  12. #12
    Registered User
    Join Date
    05-06-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Extracting multiple numbers in alphanumeric string

    didn't work. thanks though

    Quote Originally Posted by Amik555 View Post
    Hi,

    try this ARRAY formula into B1 for A:

    =SUM(MID(A1;LARGE(ISNUMBER(--MID(A1;ROW($1:$140);1))*
    ROW($1:$140);ROW($A$1:INDEX($A:$A;COUNT(--MID(A1;ROW($1:$140);1)))));1)*
    10^(ROW(INDEX($1:$140;COUNT(--MID(A1;ROW(INDEX($1:$140;1;1):
    INDEX($1:$140;LEN(A1);1));1));1):INDEX($1:$140;1;1))-1))

    it will add all the numbers together, however I'm not sure how to proceed further, perhaps others will :-)

  13. #13
    Registered User
    Join Date
    05-06-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Extracting multiple numbers in alphanumeric string

    2nd-4th number seem okay but i have a problem with the first number... instead of 3.4, it shows 4.

    Quote Originally Posted by Glenn Kennedy View Post
    Minor adjustment to the above attachment -removing redundant & potentially confusing cells.

  14. #14
    Registered User
    Join Date
    05-06-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Extracting multiple numbers in alphanumeric string

    This is the solution. I had to double check for some word inclusion, minimal errors nonetheless. Great job! Thanks a lot!


    Quote Originally Posted by newdoverman View Post
    Here is my horrendous formula that returns all the elements into 1 cell separated by commas.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This is the result:

  15. #15
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting multiple numbers in alphanumeric string

    Thank you for the feedback!

    Please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Trouble extracting and keeping numbers from an alphanumeric string
    By hammer32 in forum Excel Formulas & Functions
    Replies: 23
    Last Post: 06-08-2013, 02:31 PM
  2. Extracting Numbers from a Alphanumeric String
    By martinhardy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-01-2013, 11:02 AM
  3. Extracting Numbers from an Alphanumeric String
    By martinhardy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-31-2013, 04:53 PM
  4. Extracting Text/Numbers from an AlphaNumeric String.
    By e4excel in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-05-2010, 01:48 PM
  5. Extracting Letters and Numbers in a random Alphanumeric String
    By rajbhar_s in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-03-2010, 08:07 AM

Tags for this Thread

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