IF function problem

D

dvonj

This is a rather complex issue so I will understand if I need to have a
programmer take this on.
Here goes, I need to keep track of driver total hours. Drivers cannot work
over a certain number of hours in a week. There are two shifts an AM sign on
and sign off time plus a PM sign on and sign off time. To complicate this
each driver is guaranteed a minimum of 2.25 hours for both AM and PM shifts.
I am using an IF function to validate the value of a cell based on the amount
of time for each shift. I use a formula to calculate the difference between
the sign off and sign on times and put that value in a cell then check to see
if the value meets certain conditions.

If the value returned is grater than 2.25 I place the grater value in
another cell. If the value is less than 2.25 I place 2.25 in the cell. I then
total the AM and PM times and get the number of hours the driver worked that
day. The IF function looks like this…=IF(E11>=F5,E11,"2.25"). F5 contains the
value 2.25, the check value. My problem is that the value 2.25 is returned on
non data or an empty cell. The IF function evaluates non data or an empty
cell to be les than 2.25 thus returning 2.25 giving hours where there should
not be any for that time period.
Is there a way to create a validation that will ignore an empty cell until
data is supplied?
I apologize for this being so long winded.
 
B

Bob Phillips

=IF(E11="","",IF(E11>=F5,E11,F5))

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
D

Dave Ramage

Try this:

=IF(ISNUMBER(E11),IF(E11>$E$5,E11,$E$11),"")

If the value in E11 is non-numeric then an empty string is
returned. You could also use this to return zero instead:

=IF(ISNUMBER(E11),IF(E11>$E$5,E11,$E$11),0)

Cheers,
Dave
-----Original Message-----
This is a rather complex issue so I will understand if I need to have a
programmer take this on.
Here goes, I need to keep track of driver total hours. Drivers cannot work
over a certain number of hours in a week. There are two shifts an AM sign on
and sign off time plus a PM sign on and sign off time. To complicate this
each driver is guaranteed a minimum of 2.25 hours for both AM and PM shifts.
I am using an IF function to validate the value of a cell based on the amount
of time for each shift. I use a formula to calculate the difference between
the sign off and sign on times and put that value in a cell then check to see
if the value meets certain conditions.

If the value returned is grater than 2.25 I place the grater value in
another cell. If the value is less than 2.25 I place 2.25 in the cell. I then
total the AM and PM times and get the number of hours the driver worked that
day. The IF function looks like thisâ?¦=IF
(E11>=F5,E11,"2.25"). F5 contains the
 
R

RagDyeR

Try this:

=MAX(E11,F5)*(E11>0)
--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


This is a rather complex issue so I will understand if I need to have a
programmer take this on.
Here goes, I need to keep track of driver total hours. Drivers cannot work
over a certain number of hours in a week. There are two shifts an AM sign on
and sign off time plus a PM sign on and sign off time. To complicate this
each driver is guaranteed a minimum of 2.25 hours for both AM and PM shifts.
I am using an IF function to validate the value of a cell based on the
amount
of time for each shift. I use a formula to calculate the difference between
the sign off and sign on times and put that value in a cell then check to
see
if the value meets certain conditions.

If the value returned is grater than 2.25 I place the grater value in
another cell. If the value is less than 2.25 I place 2.25 in the cell. I
then
total the AM and PM times and get the number of hours the driver worked that
day. The IF function looks like this.=IF(E11>=F5,E11,"2.25"). F5 contains
the
value 2.25, the check value. My problem is that the value 2.25 is returned
on
non data or an empty cell. The IF function evaluates non data or an empty
cell to be les than 2.25 thus returning 2.25 giving hours where there should
not be any for that time period.
Is there a way to create a validation that will ignore an empty cell until
data is supplied?
I apologize for this being so long winded.
 
D

dvonj

Thanks Bob but that still returns 2.25 however I was wrong about there being
non data or empty cell. The cell has 0.00 in it because there is no sign on
or sign off times yet. Cell E11 contains the formula =(D11-C11)*24 to
calculate the difference between sign off and sign on times and the value is
placed in cell E11. Sorry this wasn't clear in my first post.
 
D

dvonj

Dave your a genius, that worked fine. It returns whatever is in cell E11.

Thanks everyone for your assistance.
 
B

Bob Phillips

Try this then

=IF(E11=0,"",IF(E11>=F5,E11,F5))


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
D

dvonj

I tried both your example and Dave Ramage and after using some test data your
example worked both ways while Dave's only worked if the value in E11 is
greater than the check value. Dave on your example If the value returned was
less than the check value (2.25) the lessor value was returned and not
replaced with the check value which is what I need it to do. RagDyeR your
example works best. Thanks for the tip.

and thanks to everyone for helping this is an awsome forum.
I just hope my boss won't thing I am now useless because I created a
spreadsheet that automates what the office has been doing by hand:)
 
R

RagDyeR

An so ... Are you implying that it's my fault if you should happen to get
"Laid Off"?<bg>

Just keep coming back here to automate other tasks, and show him how
resourceful you will *continue* to be.
--

Regards,

RD
--------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit !
--------------------------------------------------------------------

I tried both your example and Dave Ramage and after using some test data
your
example worked both ways while Dave's only worked if the value in E11 is
greater than the check value. Dave on your example If the value returned was
less than the check value (2.25) the lessor value was returned and not
replaced with the check value which is what I need it to do. RagDyeR your
example works best. Thanks for the tip.

and thanks to everyone for helping this is an awsome forum.
I just hope my boss won't thing I am now useless because I created a
spreadsheet that automates what the office has been doing by hand:)
 
D

dvonj

No but I am saying that when he recognizes how valuable I am it will be
because of you and this awsome forum...but thats our secret right? smiles.
 
D

dvonj

Also can you recommend a good Excel book that takes in to consideration that
I am yet a novice but learns very quickly?
 
R

Ragdyer

I honestly suggest that you forget about books for the present time.

Just start out by first exploring the various web pages that a lot of the
regulars to these groups have painstakingly put together to unselfishly
inform and educate any who wish to further their knowledge of XL.

http://www.j-walk.com/ss/excel/tips/index.htm

http://www.cpearson.com/excel/topic.htm

http://www.mvps.org/dmcritchie/excel/excel.htm

http://www.contextures.com/tiptech.html

http://www.mcgimpsey.com/excel/index.html

http://www.xldynamic.com/source/xld.html

This information won't cost you a penny, but you will absolutely, vastly
increase your knowledge of XL by the time you finish with these.

Then you can start on the books.
 
D

dvonj

this is great information and well received advice. When I get my raise I'll
treat you to lunch. <smiles>
 

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