Which formula is correct for calculating times?

D

djm

I built a spreadsheet to calculate hours worked; I did it over a couple
of weeks, reading and learning as I went. During the time I was doing
this, somehow I ended up with 2 different formula for calculating hours
worked...these are:

=IF(N31>O31,MIN(("24:00"-N31+O31)*24,7.25),MIN((O31-N31)*24,7.25))

and

=IF(N32>O32,CEILING(("24:00"-N32+O32),7.25),MIN((O32-N32)*24,7.25))

where N and O are the start & finsh times respectively.

Both seem to calculate properly, but does anyone know which is the
better formula to use...of does it matter ? Thanks.
 
B

Biff

Hi!

They both seem to work (not exhaustively tested) but give this a try:

=MIN((O31-N31+(O31<N31))*24,7.25)

Biff
 
D

djm

....can you tell me the difference b/w the 2 formulas that I have in m
spreadsheet..in terms of the way that they work...and how do the
compare to yours ?.....or are all 3 different, but equally valid way
of doing the same thing
 
D

daddylonglegs

djm said:
I built a spreadsheet to calculate hours worked; I did it over a coupl
of weeks, reading and learning as I went. During the time I was doin
this, somehow I ended up with 2 different formula for calculating hour
worked...these are:

=IF(N31>O31,MIN(("24:00"-N31+O31)*24,7.25),MIN((O31-N31)*24,7.25))

and

=IF(N32>O32,CEILING(("24:00"-N32+O32),7.25),MIN((O32-N32)*24,7.25))

where N and O are the start & finsh times respectively.

Both seem to calculate properly, but does anyone know which is th
better formula to use...of does it matter ? Thanks.

CEILING won't do the same as MIN so they won't always give the sam
result. try start time 22:00 and end time 05:00.....

What's the intent? If you want the differnece between the two times bu
not to exceed 7.25 hours then use Biff's suggestion or this which doe
the same

=MIN(MOD(O31-N31,1)*24,7.25
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top