Why is -7+7 not 0?

Want2BExcel

Board Regular
Joined
Nov 24, 2021
Messages
112
Office Version
  1. 2016
Platform
  1. Windows
Help me understand this.
The set-up is as follows.
A1 (weekday)
B1 (date)
D1 (time,start1)
E1 (time,end1)
F1 (time, catagory1)
G1 (time,start2)
H1 (time,end2)
I1 (time, catagory2)
L1 (hours1 total in decimal (E1-D1)*24)
M1 (hours1 total in decimal (H1-G1)*24)
N1 (hours total total in decimal (L1+M1)
Q1 (value of a day-off in decimal hours) -7,4
R1 (used saved overtime hours)

And here is my formula
=IF(ISBLANK(D1);0;IF(A1="Thursday";MIN(-7+L1+M1+R1+Q1);0))
When I have set time it works fine, but for days where time is still not filled in, the result should be 0 (because of the ISBLANK) and it is working for all other days than Thursday. This day gives result -8,88178E-16 and I don't understand. I mean -7+7 should be 0, but it don't. I think the problem lies in the MIN(-7+
Why? Because Thursday is the only weekday where it is -7
All other days the formula has either -8, -7,4 or -6 (it is to subtract expected hours on a given weekday and result in over- or under time)

Hope this makes sense to somebody! Please ask if you need more info to solve this
Regards
Kenneth
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
20211128_211105.jpg
 
Upvote 0
It is because you are calculating a value in L1 for example which done by subtracting one time from another then multiplying it by 24 and then subtracting exactly 7. This done with floating point arithmetic so it will happen , you need to read this article which explains it all :
 
Upvote 0
Solution
It is because you are calculating a value in L1 for example which done by subtracting one time from another then multiplying it by 24 and then subtracting exactly 7. This done with floating point arithmetic so it will happen , you need to read this article which explains it all :
I didn't know this...and not sure I quite understand it all, but nevertheless when I used the RUND function as suggested, it worked! Outstanding! Thank you offthelip ????
 
Upvote 0

Forum statistics

Threads
1,215,065
Messages
6,122,945
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top