+ Reply to Thread
Results 1 to 18 of 18

Extract just numbers from the cell and multiply them

  1. #1
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Extract just numbers from the cell and multiply them

    I have columns that contain data similar to this :
    • 3/4" STL. PL 17 7/8" X 16"
    • 3/4" STL. PL 118 1/4" X 30 1/8"
    • 5/8" STL. PL 94 1/2" x 17 3/8"


    The code has to :

    Answer to first one :
    it should multiply: 3/4 * 17 7/8 * 16
    second one :
    5/8* 94 1/2 * 17 3/8
    1. Extract just the numbers and multiply it.
    2. Display this answer in adjoining row.
    3. All columns are in same format except that the numbers keep changing. Spacing between the numbers and the letters is constant.
    4. The code probably will have to check if there is a letter or a number after the space. Eg. 94 ½” vs STL. PL
    5. Ignore the inches symbol ("). ignore the multiplication symbol (x)



    How to proceed ?
    Is this how something to be done with LEN command ?
    Last edited by subbby; 01-15-2014 at 03:32 PM. Reason: Solved

  2. #2
    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: Extract just numbers from the cell and multiply them

    Oh dear!

    Sounds like a real tricky one.

    I can't help thinking that the easier solution would be to ensure your data is captured in a more sensible format if you wish to manipulate it. Any other solution is going to involve an awful lot of string slicing logic and will probably mean a user defined function at the end of the day.

    Where does this data come from?
    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.

  3. #3
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Extract just numbers from the cell and multiply them

    Quote Originally Posted by Richard Buttrey View Post
    Oh dear!

    Where does this data come from?
    Hello..

    This is a part list of a coal breaking machine. So each example i gave is a plate size. first one will be : steel plate (STL. PL) .. 0.75" thickness and length and breadth are 17 7/8" and 16" respectively.

    And I have millions of such data. Very time consuming to rewrite them in standard decimal format.

    Any approach you familiar with ? I mean I can try working too...

  4. #4
    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: Extract just numbers from the cell and multiply them

    Maybe this?

    =TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(UPPER(A2),CHAR(34),""),"STL. PL","*"),"X","*"))


    A
    B
    2
    3/4" STL. PL 17 7/8" X 16" 3/4 * 17 7/8 * 16
    3
    3/4" STL. PL 118 1/4" X 30 1/8" 3/4 * 118 1/4 * 30 1/8
    4
    5/8" STL. PL 94 1/2" x 17 3/8" 5/8 * 94 1/2 * 17 3/8
    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

  5. #5
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Extract just numbers from the cell and multiply them

    Quote Originally Posted by AlKey View Post
    Maybe this?

    =TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(UPPER(A2),CHAR(34),""),"STL. PL","*"),"X","*"))

    ]
    This one is just showing up as 3/4 * 17 7/8 * 7 1/8. It isnt multiplying and giving a value.

    Is tehre a way to make it multiply ?

  6. #6
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: Extract just numbers from the cell and multiply them

    This extracts all 3 measures out of the string. You will have to do the conversion of whole numbers and fractions also replace the special characters ½ with the actual 1/2.

    Please Login or Register  to view this content.

  7. #7
    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: Extract just numbers from the cell and multiply them

    I didn't think you want to go that far.LOL

  8. #8
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Extract just numbers from the cell and multiply them

    Quote Originally Posted by slx View Post
    This extracts all 3 measures out of the string. You will have to do the conversion of whole numbers and fractions also replace the special characters ½ with the actual 1/2.
    Hi...

    This kind of worked...

    Range B1 : its spitting out in date format
    in Range D1 : the inches symbol also accompanies. is there a way I could get rid of that ?

  9. #9
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: Extract just numbers from the cell and multiply them

    Hi, if this is a one-time task you might consider using Text-to-Columns to gradually break-down into each individual value then sum/multiply respective columns accordingly



    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin

  10. #10
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: Extract just numbers from the cell and multiply them

    Date format is done on the worksheet, if u set the whole column to format general. if you see the quotation marks then the spacing is off, you see the - 1, that's what you change. You change it to -2 or + 1 to move the spacing left or right, increase or decrease the number to move it farther.

  11. #11
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Extract just numbers from the cell and multiply them

    hello slx.

    it is still giving teh same answer with the inches symbol on.
    I tried this

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    still the same problem

  12. #12
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: Extract just numbers from the cell and multiply them

    Change to this, i am guessing you have a lot of spaces after your quotation marks

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Extract just numbers from the cell and multiply them

    Quote Originally Posted by slx View Post
    Change to this, i am guessing you have a lot of spaces after your quotation marks
    There is no space at all SLX.


    3/4" STL. PL 44 1/4" X 7 1/8".. its posting D1 as 7 1/8"

  14. #14
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Extract just numbers from the cell and multiply them

    tried this
    Please Login or Register  to view this content.
    it worked for above example but did not work for

    1" STL. PL 10 15/16" X 4 13/16"

  15. #15
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: Extract just numbers from the cell and multiply them

    This will remove the quotation marks
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Extract just numbers from the cell and multiply them

    Thanks SLX. that worked...

    REPUTATIONS ADDED

  17. #17
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Extract just numbers from the cell and multiply them

    Final code in my program :

    Please Login or Register  to view this content.
    Worked well and gave desired answers

  18. #18
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: Extract just numbers from the cell and multiply them

    I noticed that excel will pick up "3 1/2" or "12 5/8", properly as fractional if you preset the columns to be fractional. Format Cells > Number > Fraction > {choose your accuracy}. You can include the final formula of =product() in the last column

+ 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. Macro to multiply a series of numbers by -1 if target cell matches a list
    By ameinfrank in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-26-2013, 04:25 PM
  2. [SOLVED] Pull 2 Numbers From Cell Then Multiply Them
    By icschenholm in forum Excel General
    Replies: 3
    Last Post: 07-18-2012, 03:51 PM
  3. Multiply a range of numbers by a cell ?
    By Table10sHotShot in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-26-2006, 04:05 PM
  4. Extract numbers from cell with Text and Numbers
    By wiredwrx in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 04-18-2006, 06:00 PM
  5. [SOLVED] How do I extract numbers from a cell with both text and numbers?
    By SHANNON in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-01-2005, 10:35 PM

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