+ Reply to Thread
Results 1 to 22 of 22

Numerical expressions of multiply numbers embedded in text string

  1. #1
    Registered User
    Join Date
    09-26-2014
    Location
    UK
    MS-Off Ver
    2010, 2007
    Posts
    23

    Numerical expressions of multiply numbers embedded in text string

    Hi,

    Is there a one formula that could take the numbers from A column ( i. e. 1 x 28, 10 x 100 etc.) ignoring any text description, multiply by each other and express the result numerically.

    In example:

    1 x 100 mL Bottle - result 100
    100 x 1000 Single Use Unit Pack - result 100000
    12 x 300 Pre-Filled Syringe Pack - result 3600

    Spreadsheet attached.
    Attached Files Attached Files

  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

    Re: Numerical expressions of multiply numbers embedded in text string

    Using your posted workbook
    this regular formula multiplies the first number in your example cells times the second number
    Please Login or Register  to view this content.
    Example:
    With A2: 12 x 300 Pre-Filled Syringe Pack
    that formula returns: 3600


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

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Numerical expressions of multiply numbers embedded in text string

    Hi,

    Not pretty and there may be a more elegant way but on a Sunday afternoon with a barbecue beckoning try
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Obviously that can be 'simplified' by using a helper column B

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

    and then in column C
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    09-26-2014
    Location
    UK
    MS-Off Ver
    2010, 2007
    Posts
    23

    Re: Numerical expressions of multiply numbers embedded in text string

    Quote Originally Posted by Ron Coderre View Post
    Using your posted workbook
    this regular formula multiplies the first number in your example cells times the second number
    Please Login or Register  to view this content.
    Example:
    With A2: 12 x 300 Pre-Filled Syringe Pack
    that formula returns: 3600


    Is that something you can work with?

    That looks great and i think solves the problem. The only ones that weren't succesfully expressed are:

    1 x 13.5 mL Bottle
    1 x 2.5 mL Bottle
    1 x 3.5 g Pack

    To work out those halves will probably require a different approach. I that right?

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Numerical expressions of multiply numbers embedded in text string

    so if there is a volume or weight it should just be 1 ? or however many there are?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Registered User
    Join Date
    09-26-2014
    Location
    UK
    MS-Off Ver
    2010, 2007
    Posts
    23

    Re: Numerical expressions of multiply numbers embedded in text string

    Quote Originally Posted by martindwilson View Post
    so if there is a volume or weight it should just be 1 ? or however many there are?
    The volume or weight description is not really relevant. I need to focus on getting the correct numbers and results.

    If:
    1 x 13.5 mL Bottle result 13.5
    2 x 13.5 mL Bottle result 27

    1 x 2.5 mL Bottle result 2.5
    2 x 2.5 mL Bottle result 5

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Numerical expressions of multiply numbers embedded in text string

    works for me
    A
    B
    C
    D
    1
    2
    1 x 13.5 mL Bottle
    13.5
    Bottle result 13.5 b2 =LEFT(A2,FIND(" ",A2)-1)*TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),LEN(A2)*2,LEN(A2)))
    3
    2 x 13.5 mL Bottle
    27
    Bottle result 27
    4
    1 x 2.5 mL Bottle
    2.5
    Bottle result 2.5
    5
    2 x 2.5 mL Bottle
    5
    Bottle result 5

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

    Re: Numerical expressions of multiply numbers embedded in text string

    I'm not understanding.
    Those values calculate correctly with the formula I posted. Perhaps your number format is not displaying enough decimal places.

  9. #9
    Registered User
    Join Date
    09-26-2014
    Location
    UK
    MS-Off Ver
    2010, 2007
    Posts
    23

    Re: Numerical expressions of multiply numbers embedded in text string

    Quote Originally Posted by Ron Coderre View Post
    I'm not understanding.
    Those values calculate correctly with the formula I posted. Perhaps your number format is not displaying enough decimal places.
    I get the #VALUE! error on these. I've also set the number format to display more than 2 decimal places so it should work. What's going on?

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Numerical expressions of multiply numbers embedded in text string

    here is your workbook with formula applied
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    09-26-2014
    Location
    UK
    MS-Off Ver
    2010, 2007
    Posts
    23

    Re: Numerical expressions of multiply numbers embedded in text string

    Quote Originally Posted by martindwilson View Post
    here is your workbook with formula applied
    When I open the file I can see that the output is fine but after enabling editing it goes back to the #VALUE! error. It's my Excels fault but WHY?!??!?

  12. #12
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Numerical expressions of multiply numbers embedded in text string

    Have a look..
    Ist Alternative..
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

    check the attached file..
    Attached Files Attached Files
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  13. #13
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: Numerical expressions of multiply numbers embedded in text string

    Try

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Click just below left if it helps, Boo?ath?

  14. #14
    Registered User
    Join Date
    09-26-2014
    Location
    UK
    MS-Off Ver
    2010, 2007
    Posts
    23

    Re: Numerical expressions of multiply numbers embedded in text string

    Quote Originally Posted by Vikas_Gautam View Post
    Have a look..
    Ist Alternative..
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

    check the attached file..
    Those formulas don't multiply the numbers.
    In Example:
    If

    2 x 50 g Pack

    the result I'm looking for is 100.

    The formula:
    =LEFT(A2,FIND(" ",A2)-1)*TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),LEN(A2)*2,LEN(A2)))

    Does it job but for some reason my excel on fields
    1 x 13.5 mL Bottle
    1 x 2.5 mL Bottle
    1 x 3.5 g Pack

    Shows the #VALUE! error which. It must something small in the excel set up but I can't find it.

  15. #15
    Registered User
    Join Date
    09-26-2014
    Location
    UK
    MS-Off Ver
    2010, 2007
    Posts
    23

    Re: Numerical expressions of multiply numbers embedded in text string

    Quote Originally Posted by boopathiraja View Post
    Try

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Again, works for all fields except
    1 x 13.5 mL Bottle
    1 x 2.5 mL Bottle
    1 x 3.5 g Pack
    And showing the #VALUE! error.

  16. #16
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Numerical expressions of multiply numbers embedded in text string

    perhaps your original hasn't got spaces (char 32) but some other space and trim isn't removing it
    or there are more spaces than you have shown
    try adding a few more trims()!!
    =LEFT(TRIM(A2),FIND(" ",TRIM(A2))-1)*TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",LEN(TRIM(A2)))),LEN(TRIM(A2))*2,LEN(TRIM(A2))))

  17. #17
    Registered User
    Join Date
    09-26-2014
    Location
    UK
    MS-Off Ver
    2010, 2007
    Posts
    23

    Re: Numerical expressions of multiply numbers embedded in text string

    Quote Originally Posted by martindwilson View Post
    perhaps your original hasn't got spaces (char 32) but some other space and trim isn't removing it
    or there are more spaces than you have shown
    try adding a few more trims()!!
    =LEFT(TRIM(A2),FIND(" ",TRIM(A2))-1)*TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",LEN(TRIM(A2)))),LEN(TRIM(A2))*2,LEN(TRIM(A2))))
    Still the same
    error.gif
    Attached Images Attached Images
    Last edited by wraithu; 09-28-2014 at 01:29 PM.

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

    Re: Numerical expressions of multiply numbers embedded in text string

    Evidently, your formulas use semicolons, instead of commas, in formulas.
    What are your region settings and, more importantly, how do periods work in your region settings?

  19. #19
    Registered User
    Join Date
    09-26-2014
    Location
    UK
    MS-Off Ver
    2010, 2007
    Posts
    23

    Re: Numerical expressions of multiply numbers embedded in text string

    Quote Originally Posted by Ron Coderre View Post
    Evidently, your formulas use semicolons, instead of commas, in formulas.
    What are your region settings and, more importantly, how do periods work in your region settings?
    Ron

    That's what it was. My windows regional settings where wrong. The decimal separator was set as , and that's why excel couldn't catch 2.5 number.

    Everything is fine now. Your original formula works perfectly.

    Thank you very much for your help as well as other other guys -thank you for your effort!

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

    Re: Numerical expressions of multiply numbers embedded in text string

    This seems to work ok with your supplied data.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------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

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

    Re: Numerical expressions of multiply numbers embedded in text string

    Glad you got something you can use!

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

    Re: Numerical expressions of multiply numbers embedded in text string

    The shortest that I could reduce the formula to is

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

+ 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. [SOLVED] Linking two formulas for text conversions to numerical expressions
    By wraithu in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-26-2014, 03:56 PM
  2. [SOLVED] remove specific text from certain cells, then multiply the numerical value left by 0.001
    By jeffnoone in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 06-21-2014, 02:25 PM
  3. Find most common (x5) numbers within numerical string range
    By JEWB in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-03-2014, 06:59 AM
  4. How do I capture Numbers Embedded in a String
    By scrags in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-13-2012, 08:56 PM
  5. Assign Numerical Value to a Text String
    By getblended in forum Excel General
    Replies: 3
    Last Post: 01-12-2012, 11:40 AM

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