+ Reply to Thread
Results 1 to 14 of 14

Subtracting from a decimal number - strange question

  1. #1
    Registered User
    Join Date
    03-08-2004
    Posts
    50

    Subtracting from a decimal number - strange question

    I need to subtract a whole a number, which tells me how many digits to subtract from a decimal number. How do I do this?

    It's better if i give an example:

    Let's say, I need to first divide
    Cell B18 by B22, = B18/B22

    let's say the data entered will be
    B18 = 36
    B22 = .3

    that equals 120

    And, in cell C22, I have a number that has 3-5 decimal places.
    Say, C22=1.92348

    Now, the number 120 tells me, how many digits I need to subtract from 1.92348.

    So the answer would be 1.92348 - 120 digits from the decimals, i.e. = 1.92228

    The problem is not all the digits will be 5 decimal places, some will be 4, 3 or 2, etc. So for example, if the number on C22 is 1.92, then we will be subtracting 120 digits from 1.92 = .77

    It's easy if it's always a certain number of decimal places. For example if two decimal places, then we can just make a set formula to turn the decimal number to a whole number then convert it back, say 1.92, would just be 1.92*100= 192-120 = 77. Then take the 77/100 = .77.

    The problem is it's not always the same number of decimal places, so I can't make the formula always multiply by 100, 1000, or whatever it is to make it a whole number, then convert it back to a decimal.

    How do I make the formula so it will do this calculation for me?

    Sorry, I'm not good with excel. Thank you in advance for your help.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Subtracting from a decimal number - strange question

    Start with:
    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    03-08-2004
    Posts
    50

    Re: Subtracting from a decimal number - strange question

    Thank you very much. I'm not sure what you did, but it worked perfectly. Thank you again!
    Last edited by AliGW; 10-17-2018 at 02:32 AM. Reason: Post reinstated.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Subtracting from a decimal number - strange question

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Registered User
    Join Date
    03-08-2004
    Posts
    50

    Re: Subtracting from a decimal number - strange question

    Sorry, I was mistaken.

    It worked when C22=1.92348, but it didn't calculate it correctly when the C22 had a bigger whole number, such as C22=1265.2165
    Last edited by luu980; 10-17-2018 at 02:11 AM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Subtracting from a decimal number - strange question

    Please do not post-edit posts that have had responses - it makes the thread hard to follow and breaks the sequence, making a nonsense of the thread. Instead, add a new post as you have now done. Your post-edited post has had its original text restored.

  7. #7
    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
    44,053

    Re: Subtracting from a decimal number - strange question

    Try this:

    =((C22*10^LEN(MID(C22,SEARCH(".",C22)+1,255)))-E19)/10^LEN(MID(C22,SEARCH(".",C22)+1,255))
    Attached Files Attached Files
    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

  8. #8
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,910

    Re: Subtracting from a decimal number - strange question

    Like this?

    =C22-(B18/B22)/10^(LEN(C22)-FIND(".",C22))

  9. #9
    Registered User
    Join Date
    03-08-2004
    Posts
    50

    Re: Subtracting from a decimal number - strange question

    AliGW: There was actually no one posted below my edited post except yours. It would have been a lot easier for you to delete your own post telling me to close the thread than to restore the original text of my edited post. You handled the situation incorrectly, but no matter.

    Glenn Kennedy & Phuocam: both of your formulas seem to be working well for me now. Thank you very very much for your help. I really really appreciate you guys!!!

  10. #10
    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
    44,053

    Re: Subtracting from a decimal number - strange question

    Y5ou're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Subtracting from a decimal number - strange question

    You handled the situation incorrectly, but no matter.
    You are entitled to your opinion, of course, however, you should not post-edit your posts in future, no matter how many posts are after them. Thank you for your co-operation.

  12. #12
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Subtracting from a decimal number - strange question

    .............

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Subtracting from a decimal number - strange question

    See the second paragraph of post #9.

  14. #14
    Registered User
    Join Date
    03-08-2004
    Posts
    50

    Re: Subtracting from a decimal number - strange question

    Quote Originally Posted by AliGW View Post
    You are entitled to your opinion, of course, however, you should not post-edit your posts in future, no matter how many posts are after them. Thank you for your co-operation.
    There is NO problem editing a post if there is no post after mine. Your request is completely illogical. You need to learn to moderate the forum better. Thank you for your cooperation.

    @glenn reputation thing added! Thanks for showing me that option. I didn't know it existed! Again thank you and phuo for your help!
    Last edited by luu980; 10-19-2018 at 12:59 AM.

+ 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] Strange Decimal Values? Rounding Error?
    By NicholasL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2013, 12:55 PM
  2. [SOLVED] copy number with 3 or more decimal places and paste the actual value as 2 decimal number
    By k1dr0ck in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-29-2013, 12:57 AM
  3. Strange behaviour decimal sign numeric keypad
    By bergjes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2013, 09:49 AM
  4. [SOLVED] Adding and subtracting time above 24h (ten days) and converting to decimal
    By nitwit in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-27-2012, 08:57 AM
  5. Subtracting time (in numbers) to decimal
    By Deyveed in forum Excel General
    Replies: 3
    Last Post: 10-22-2009, 11:19 AM
  6. [SOLVED] Decimal number to percentage formula (newbie question)
    By Ken Benson in forum Excel General
    Replies: 4
    Last Post: 07-11-2006, 01:35 PM
  7. [SOLVED] Excel strange (erroneous?) decimal behaviour
    By DoctorG in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-25-2005, 05:05 AM
  8. SUBTRACTING TIME VALUES INSTEAD OF DECIMAL!!
    By Lexicon in forum Excel General
    Replies: 8
    Last Post: 04-19-2005, 04:06 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