Cant get this IF statment to work

dawson321

Registered User.
Local time
Today, 05:55
Joined
Jun 6, 2010
Messages
29
hi,

I cant get this if statment to work and i am nt sure what i am doing wrong.

can someone help?

=IF([Material Charges]>0=[Total Labour Charge], IF [Material Charges]<0 [Material Charges] + [Total labour charge]
 
If I'm getting what you're looking for it would be this:
Code:
=[COLOR="Red"]I[/COLOR]IF([Material Charges]>0, [Total Labour Charge], [Material Charges] + [Total labour charge])
 
For one thing, it's IIf(), not If() (You'd use If in VBA code). It looks like you are also missing some commas and parentheses. Start with a simple IIf(), and build on it once you have it working.
 
This is what i have in at the momment but its still not working

=IIf([charges]>0,[Total labour charge],[charges]+[Total labour charge])
 
Maybe the fields called labor not labour?
Is charges a number or currency field? I think you would have problems if its a text.
 
Or if any of the fields are null it could be a problem - So a change to:
Code:
=IIf(Nz([charges],0)>0,Nz([Total labour charge],0),Nz([charges],0)+Nz([Total labour charge],0))
 
This can be further simplified to

=Nz([charges],0)+Nz([Total labour charge],0)

Why
nothing plus something = something

something plus something = something

As long as you know you are going to have atleast 0 for the charges then 0 +1 = 1, likewize 1+1 = 2
 

Users who are viewing this thread

Back
Top Bottom