Forum Discussion

Raeneuf's avatar
Raeneuf
Copper Contributor
Jan 09, 2023

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...
  • JoeUser2004's avatar
    Jan 09, 2023

    Raeneuf 

     

    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.

     

Share

Resources