# Thread: Formula for expression builder (2000)

1. ## Formula for expression builder (2000)

I like to have a calculated field in a report. Right now it is a sum field but I like to subtract from it without it going into negatives or limit it to zero and show only positive values.
The expression looks like this =Sum([HoursWorked]) and should compute the overtime. I tried =Sum([HoursWorked])-38.75>0 but it doesn't give the right results in case that someone worked more than 38.75 it comes to -1.
PS. Please keep possible response simple because I'm new in this.
Thanks

2. ## Re: Formula for expression builder (2000)

Try :
=IIf(Sum([HoursWorked])>38.75,Sum([HoursWorked])-38.75,Sum([HoursWorked]))

3. ## Re: Formula for expression builder (2000)

Hello pgangl,

Welcome to Woody's Lounge! Try this expression:<pre>=IIf(Sum([HoursWorked])>38.75,Sum([HoursWorked])-38.75,0)</pre>

With the IIf (Immediate If) function, you can perform a test, and depending on the outcome, return one of two values: the first if the test results in True, the second if the test results in False.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•