+ Reply to Thread
Results 1 to 6 of 6

Subtracting returns weird result?

  1. #1
    Registered User
    Join Date
    05-06-2021
    Location
    Belgium
    MS-Off Ver
    Office 365
    Posts
    3

    Question Subtracting returns weird result?

    Hello!

    First of all, thanks for making this kind of forum!

    I have made (or am trying to make) a worksheet which allows me to fill in what I have done today (via a dropdown), put in how long I did it and my weight and then it calculates how much calories I've burnt!

    That works perfectly fine :D I also have a few cells for adding what I ate and how much calories that were for each item.

    I'm then using a basic SUM function twice to add all calories from both sides (one for the calories I've burnt, referenced to as "kcal out", once for the calories I've eaten, referenced to as "kcal in") and tried adding a subtract to get the total amount of calories I can still eat (or how much I've already eaten too much)

    Now, as you can see in the screenshots, it looks like the formula (which seems correct?) is doing some weird things..

    Screenshots attached below.

    I can't seem to add the excel file as attachment so here is a onedrive link which you can use to view it (remove spaces from link)
    1drv .ms/x/s!AiAQ1qgvEV2Al-sbDKzIdd2Tgwx20Q?e=1zYVnv

    I've disabled editing permissions as I don't want anyone on the internet to edit the file, but feel free to take a copy and experiment with it.

    Thanks in advance for taking time out of your day to assist me.
    Attached Images Attached Images

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Subtracting returns weird result?

    Hi & welcome to MrExcel.
    Try changing the cell format of N6 to General.

  3. #3
    Registered User
    Join Date
    05-06-2021
    Location
    Belgium
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Subtracting returns weird result?

    Hi! Thanks for prompt reply! I tried it, but then it changes the value to "2,193940972" which is not what I want haha.

    I've already been debugging a little before posting the thread and found it that it "all goes wrong" at the moment where I subtract the times to get the duration ("duur") between the start and end time.

    I made a custom format [m] there so I could get the time in minutes and calculate the kcal with it. Then I take the sum of all kcal fields. I tried changing the kcal format to "general" as well (E11) but instead of 510 it then gives me 0,39046875?

    Weird.. What's the relation between these weird numbers and the actual numbers I need? For example if it was the "right" number divided by 10, I could just muliply by 10 again to fix my issue.

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Subtracting returns weird result?

    Try using this formula for col F
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-06-2021
    Location
    Belgium
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Subtracting returns weird result?

    That works, thanks! :D What does *1440 do? (Well, I know it multiplies haha, but I mean, why?)

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Subtracting returns weird result?

    You're working in minutes & xl stores time as a fraction of one day so 1 min is actually 0.000694444444444444 the 1440 is 60*24 ie 60 mins in an hour & 24 hours in a day.
    So it's converting the time in minutes into a "real" number.

+ 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. Weird MROUND result?
    By nlexcel in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-03-2017, 06:26 AM
  2. [SOLVED] Weird VLOOKUP Result
    By DesktopT in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 10-30-2014, 07:51 PM
  3. [SOLVED] weird countif result
    By Evolta in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-06-2013, 07:20 AM
  4. [SOLVED] Excel 2007 : Weird result from concatenation
    By magnanr in forum Excel General
    Replies: 5
    Last Post: 07-18-2012, 12:14 PM
  5. Replies: 2
    Last Post: 10-20-2011, 05:41 AM
  6. [SOLVED] vlookup based on random result returns incorrect result
    By rickat in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-05-2005, 09:20 AM
  7. Weird result
    By Roger B. in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-09-2005, 12:05 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