Forum Discussion

JuanAros's avatar
JuanAros
Copper Contributor
Oct 10, 2021
Solved

help

I want to know if it´s possible to calculate (to subtract, in fact) two different hours (Arrival and departure) in the same cell, and then sum up this with others cells from other days. I don´t know if you guys understand what I mean.

This is the example:

 

Monday             Tuesday                 Wednesday          total hours

13:00 - 18:30       11:00 - 20:30         15:00 - 0:00             ???

 

Thanks in advance!!!!

 

 

  • JuanAros 

    Let's say the times are in A2:C2.

    Enter the following formula in D2. If you are NOT using Excel in Microsoft 365 or Excel 2021, confirm the formula with Ctrl+Shift+Enter.

     

    =SUM(MOD(TIMEVALUE(RIGHT(A2:C2,5))-TIMEVALUE(LEFT(A2:C2,5)),1))

     

    Format D2 with the custom number format [h]:mm

    Fill down if required.

2 Replies

  • JuanAros 

    Let's say the times are in A2:C2.

    Enter the following formula in D2. If you are NOT using Excel in Microsoft 365 or Excel 2021, confirm the formula with Ctrl+Shift+Enter.

     

    =SUM(MOD(TIMEVALUE(RIGHT(A2:C2,5))-TIMEVALUE(LEFT(A2:C2,5)),1))

     

    Format D2 with the custom number format [h]:mm

    Fill down if required.

    • JuanAros's avatar
      JuanAros
      Copper Contributor
      It works perfectly, thanks a lot mate!

Resources