set a minimum value for a cell

N

Nevets

I have a sheet with two times, and a formula to figure out how much to
charge, depending on the difference between those two times. I would like to
set a minimum of 4 hours, such that no matter what two times are entered, if
they are less than four hours apart, the result will be 4 hours, but if they
are anything more than 4 hours apart, the result will be the actual
difference.
 
M

Mike H

a1= start time 08:00
b1 = end time 12:00
d1 = 4:00
all formatted as [hh]:mm

formula
=MAX(B1-A1,$D$1)

will return the maximum of the time difference and 4 hrs. Its best to keep
the 4hr constant in a cell in case you want to change it in which case you
only alter a single cell.

Mike
 
N

Nevets

Assuming C13 is the "on-site" time, and D13 is the "off-site" time, and
E13 is a cell whose formula is =D13-C13, and
F13 is a cell with prep/travel time I enter depending on the location of the
event.
My formula in the cell used to figure out how many hours to charge is:
=F13+(E13-INT(E13))*24
What I need is something that will put a minimum of 4 hrs in the E13 cell,
but it needs to be formatted in the same way as the other values in that cell
(i.e. 4 hrs actually will equal 0.16667, since that value x 24 hrs = 4 hrs)
 
T

T. Valko

Take your pick:

=IF(COUNT(C13:D13)=2,MAX(4/24,D13-C13),0)

=IF(COUNT(C13:D13)=2,MAX(TIME(4,,),D13-C13),0)
 

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