+ Reply to Thread
Results 1 to 8 of 8

Use number portion only of a cell in a function?

  1. #1
    Registered User
    Join Date
    05-08-2006
    Posts
    77

    Use number portion only of a cell in a function?

    Cell D85 is 6000 LBS

    All I want to do is a simple multiplication: 6000 * .10

    Really, my equation needs to be "number portion of D85" * .10

    Is there a way to write this in a function?

  2. #2
    Registered User
    Join Date
    04-04-2008
    Posts
    4
    Hi Leah,

    Does =6000*0.10 not work?
    What answer are you expecting to see?

    Emma

  3. #3
    Registered User
    Join Date
    05-08-2006
    Posts
    77
    The problem is that the cell is actually [6000 LBS] - all in one cell. How do I extract only the 6000 for my equation?

  4. #4
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852
    Hi,

    You can add this user defined function to your sheet:
    ^
    Please Login or Register  to view this content.
    Then use the following formula
    =ExtractNumber(D85)*0.1

    Good thing about this function is that you dont have to worry how many digits it has, or where is the number located within the cell, or if there are any leading spaces or end spaces.
    Last edited by Portuga; 04-04-2008 at 10:26 AM.
    If you found the solution to your question. Mark the thread as "Solved"
    Thank everyone that helped you with a valid solution by clicking on their

    There is no such thing as a problem, only a temporary lack of a solution

  5. #5
    Registered User
    Join Date
    04-04-2008
    Posts
    4
    Ahh sorry I misunderstood. As far as I can there isn't an easy way to do this (someone correct me if I'm wrong) but all I would do is extract the 6000 into a different cell and use that cell in the equation.
    To extract it you could use a number of different text equations, e.g.

    =LEFT(A1,4)
    You would use this one if there will always be LBS and a space at the end of the number. It just counts backwards from the end of the cell however many characters you've told it to.
    =MID(A1,1,4)
    You would use this one if there will always be a four digit weight at the begining of the cell. It looks at the cell and the two numbers are the positions in the text you want it to return values between (so the value between the first and fourth characters)

    I hope this has been of some help!
    Emma

  6. #6
    Registered User
    Join Date
    05-08-2006
    Posts
    77
    Thank you both!

  7. #7
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    Emma,
    Technically, Left counts forward from the beginning of the cell, rather than backwards from the end. =Left(A1,4) returns the same number whether A1 is 6000 or 600000. I would modify it slightly to =Left(A1,Find(" ",A1)-1)

  8. #8
    Registered User
    Join Date
    04-04-2008
    Posts
    4
    Ah - You learn something new every day! Thanks

+ 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