Forum Discussion

Neda1978's avatar
Neda1978
Copper Contributor
Sep 29, 2022

Excel formula

Hi,

A question for calculation hours not coming in decimal, for example start hours 21:00 - 06:00 my calculation will come to 09:00 I need to have just 9 not decimal as it affects on all of my formula in total calculation.   

5 Replies

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    Neda1978 Not sure how you arrive at 9 hours by deducting 6:00 from 21:00, but never mind. A time (or duration) of 9:00 is stored in Excel as the number 0.375, being 9 / 24. So, if you want to display 9:00 as 9 you need to multiply it by 24.

     

    • Neda1978's avatar
      Neda1978
      Copper Contributor

      Riny_van_Eekelen Thanks for your reply. I used this formula, =IF(AFD96>AFE96,AFE96+1,AFE96)-AFD96 how I can multiply it by 24? Sorry I am very bad in formula. 

      • JMB17's avatar
        JMB17
        Bronze Contributor

        Neda1978 

         

        Your formula would be:

        =24 * (IF(AFD96>AFE96,AFE96+1,AFE96)-AFD96)

         

        But, you could also use:

        =24 * MOD(B2-A2, 1)

         

         

Resources