Forum Discussion
Excel returns incorrect answer
- 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.
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.