Forum Discussion
Raeneuf
Jan 09, 2023Copper Contributor
Excel returns incorrect answer
I am having an issue with excel returning the incorrect answer when formulating time worked into hrs. worked. An example of the formula used is =SUM(((D16-C16)*24)+((G16-F16)*24))&"hrs". In this inst...
- Jan 09, 2023
If you want to round to integer hours, enter:
=ROUND((D16-C16+G16-F16)*24, 0)&"hrs"
Note the many simplifications:
1. SUM is unnecessary in this context.
2. Multiply by 24 (convert to hours) only once, after all time arithmetic instead of piecewise.
3. Remove unnecessary parentheses to improve readability. No need for subexpressions in this context.
4. No need to round subexpressions to 15 decimal places. It is also wrong, in general -- although it makes no difference in this context.
Raeneuf
Jan 09, 2023Copper Contributor
No, none of this was TMI. I definitely helped me understand more. Thank you so much for your time, it is much appreciated.
JoeUser2004
Jan 09, 2023Bronze Contributor
Raeneuf wrote: ``none of this was TMI``
Oh, that was not the TMI explanation. (smile) But I'm glad it helped.