D dawson321 Registered User. Local time Today, 10:45 Joined Jun 6, 2010 Messages 29 Jul 6, 2010 #1 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]
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]
boblarson Smeghead Local time Today, 02:45 Joined Jan 12, 2001 Messages 32,059 Jul 6, 2010 #2 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])
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])
pbaldy Wino Moderator Staff member Local time Today, 02:45 Joined Aug 30, 2003 Messages 36,272 Jul 6, 2010 #3 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.
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.
D dawson321 Registered User. Local time Today, 10:45 Joined Jun 6, 2010 Messages 29 Jul 6, 2010 #4 This is what i have in at the momment but its still not working =IIf([charges]>0,[Total labour charge],[charges]+[Total labour charge])
This is what i have in at the momment but its still not working =IIf([charges]>0,[Total labour charge],[charges]+[Total labour charge])
motleyjew Registered User. Local time Today, 05:45 Joined Jan 11, 2007 Messages 109 Jul 6, 2010 #5 Maybe the fields called labor not labour? Is charges a number or currency field? I think you would have problems if its a text.
Maybe the fields called labor not labour? Is charges a number or currency field? I think you would have problems if its a text.
boblarson Smeghead Local time Today, 02:45 Joined Jan 12, 2001 Messages 32,059 Jul 6, 2010 #6 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))
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))
D dawson321 Registered User. Local time Today, 10:45 Joined Jun 6, 2010 Messages 29 Jul 7, 2010 #7 Thanks bob its workin now
DCrake Remembered Local time Today, 10:45 Joined Jun 8, 2005 Messages 8,626 Jul 7, 2010 #8 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
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