ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Work hours calculation (https://www.excelbanter.com/excel-discussion-misc-queries/132259-work-hours-calculation.html)

albertmb

Work hours calculation
 
Hi everyone,
I have a problem with calculating work hours. I use the normal simple
formula Ex:
=(B1-A1)*24 Assuming that 'A1' is the in time and 'B1' is the out time.
This works OK, but if the in time is before midnight and the out time is
after midnight it does not work. I managed to get the answer right by adding
24 to the formula but then it will not work properly for time before midnight.
I appreciate your help and thank you.

Albert - Malta

Toppers

Work hours calculation
 
Assuming A1,B1 are in hh:mm format:

=MOD(B1-A1,1)

"albertmb" wrote:

Hi everyone,
I have a problem with calculating work hours. I use the normal simple
formula Ex:
=(B1-A1)*24 Assuming that 'A1' is the in time and 'B1' is the out time.
This works OK, but if the in time is before midnight and the out time is
after midnight it does not work. I managed to get the answer right by adding
24 to the formula but then it will not work properly for time before midnight.
I appreciate your help and thank you.

Albert - Malta


daddylonglegs

Work hours calculation
 
Either use Toopers' suggestion and multiply by 24, i.e.

=MOD(B1-A1,1)*24

or

=(B1-A1+(A1B1))*24

"albertmb" wrote:

Hi everyone,
I have a problem with calculating work hours. I use the normal simple
formula Ex:
=(B1-A1)*24 Assuming that 'A1' is the in time and 'B1' is the out time.
This works OK, but if the in time is before midnight and the out time is
after midnight it does not work. I managed to get the answer right by adding
24 to the formula but then it will not work properly for time before midnight.
I appreciate your help and thank you.

Albert - Malta


albertmb

Work hours calculation
 
Thank you Toppers and Daddylonglegs, formula worked perfectly.

All the Best
Albert

"Toppers" wrote:

Assuming A1,B1 are in hh:mm format:

=MOD(B1-A1,1)

"albertmb" wrote:

Hi everyone,
I have a problem with calculating work hours. I use the normal simple
formula Ex:
=(B1-A1)*24 Assuming that 'A1' is the in time and 'B1' is the out time.
This works OK, but if the in time is before midnight and the out time is
after midnight it does not work. I managed to get the answer right by adding
24 to the formula but then it will not work properly for time before midnight.
I appreciate your help and thank you.

Albert - Malta



All times are GMT +1. The time now is 05:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com