Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF and or Function

Status
Not open for further replies.

bpxmas

Programmer
Nov 12, 2008
29
US
I'm trying to write a function to do the following:

if total hours are >=40 then
only total = 40

but
if there are 38 then total = 38

=IF(SUM(J338:J365)>=40,40),(SUM(J338:J365))

Hours
10 10 10 10
Total 40

Hours
5 5 5 5
Total 20

I can get it to work for one or the other, not both.

Thanks.

Brenda
 
=IF(SUM(J338:J365)>=40,40,SUM(J338:J365))

[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
Ok, that works....Now another

I have to Hour Columns:

Reg Hours Overtime Hours

45 5

I only want the 40 hours to total in Reg Hous &
the 5 hours to go into the Overtime Hours

What do I need to do?

Thanks
 
I figured it out, let me know if this is correct?

=IF(SUM(J292:J319)>=40,SUM(J292:J319))-40


Thanks
 
In the reg hours cell:

=IF(SUM(J292:J319)>=40,40,SUM(J292:J319))

In the overtime cell:

=IF(SUM(J292:J319)>=40,SUM(J292:J319)-40,0)

[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
I more question?

There there are NO Overtime Hours then I want a zero in that column?

Thanks.

 
If I use your last function:

=IF(SUM(J292:J319)>=40,SUM(J292:J319)-40,0)

I get an error

Thanks.
 
Works for me, what kind of error are you getting?

[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
The formula I typed contains an error
 
The formula you typed contains an error.

Thanks.
 
It works now....I had an extra (.

Thanks so much for your help.
 
bpxmas,

Don't forget to thank Blue with a little purple star.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top