Iif statement on Time Card

C

Carina

I've created an Overtime Card.
There are 4 possible reasons for OT, one being "Call-Out".
There are minimum hours for each OT reason. For Call-Out,
less that 1.5 hrs work results in minimum 3 hrs pay.
Staff are requested to enter ACTUAL hours worked, and a
separate box calculates totaltime
I want to calculate the following:

Iif ([Reason] = "Call-Out" and [TotalTime]< "1:30","3",Iif
([Reason] = "Call-Out" and [TotalTime]>="1:30",
[TotalTime]))

I'm obviously doing something wrong because this isn't
working. I've formatted all of the boxes to Short Time,
and tried with single quotes instead of double quotes to
no avail. I'm stumped.

Any all help appreciated!
Carina
 
M

Marshall Barton

Carina said:
I've created an Overtime Card.
There are 4 possible reasons for OT, one being "Call-Out".
There are minimum hours for each OT reason. For Call-Out,
less that 1.5 hrs work results in minimum 3 hrs pay.
Staff are requested to enter ACTUAL hours worked, and a
separate box calculates totaltime
I want to calculate the following:

Iif ([Reason] = "Call-Out" and [TotalTime]< "1:30","3",Iif
([Reason] = "Call-Out" and [TotalTime]>="1:30",
[TotalTime]))

I'm obviously doing something wrong because this isn't
working. I've formatted all of the boxes to Short Time,
and tried with single quotes instead of double quotes to
no avail.

Date/Time values must be enclosed in # signs, not quotes.
But that doesn't matter here, you are not using a time
value, you're using a number of hours, which is no different
than the number of apples you ate last week. ;-)

Try this expression:

=IIf(Reason="Call-Out" And TotalTime< 1.5, 3, TotalTime)
 
G

Guest

Thanks, Marshall,

Because I have the Total Time box set to display hh:mm, I
had to use the # signs afterall. Thanks for including
that little tid-bit!

Pricless :)

C/
-----Original Message-----
Carina said:
I've created an Overtime Card.
There are 4 possible reasons for OT, one being "Call- Out".
There are minimum hours for each OT reason. For Call- Out,
less that 1.5 hrs work results in minimum 3 hrs pay.
Staff are requested to enter ACTUAL hours worked, and a
separate box calculates totaltime
I want to calculate the following:

Iif ([Reason] = "Call-Out" and [TotalTime] < "1:30","3",Iif
([Reason] = "Call-Out" and [TotalTime]>="1:30",
[TotalTime]))

I'm obviously doing something wrong because this isn't
working. I've formatted all of the boxes to Short Time,
and tried with single quotes instead of double quotes to
no avail.

Date/Time values must be enclosed in # signs, not quotes.
But that doesn't matter here, you are not using a time
value, you're using a number of hours, which is no different
than the number of apples you ate last week. ;-)

Try this expression:

=IIf(Reason="Call-Out" And TotalTime< 1.5, 3, TotalTime)
 

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