1. Registered User
Join Date
May 2004
Posts
7

any idea why this equation doesnt work?

=nz([1stTotal],0)+nz([2ndTotal],0)+nz([3rdTotal],0)/100*nz([Discount],0)

cant figure it out !

thank you

2. Purveyor of Discontent
Join Date
Mar 2003
Location
The Bottom of The Barrel
Posts
6,102
What exactly do you mean by not working? Is it throwing an error message or are you not getting the result you were expecting? I'm guessing it's the latter, this would be caused by order of operations.

=nz(([1stTotal],0)+nz([2ndTotal],0)+nz([3rdTotal],0))/(100*nz([Discount],0))

Right now, Access will read the formula as:

=nz([1stTotal],0)+nz([2ndTotal],0)+(nz([3rdTotal],0/100))*nz([Discount],0)

3. Registered User
Join Date
May 2004
Posts
7
ah right well i wanted to add my totals 1,2,3, then divide that figure by 100 then times that by the amount shown in discount?

and by not working i mean the answer isnt correct

thank you

4. Purveyor of Discontent
Join Date
Mar 2003
Location
The Bottom of The Barrel
Posts
6,102
The first example I showed you should be effective.

It's a simple order of operations rule. Multiplication and division will always be executed before addition, therefore, the reason you are not getting the value you expect is because access is preforming all of the multiplication and division, THEN the addition. By adding the paranthesis, you are explicitly telling access that you would like to add the first three values, THEN do the division. Try it out.

5. Registered User
Join Date
Apr 2004
Location
Sydney Australia
Posts
369
ah right well i wanted to add my totals 1,2,3, then divide that figure by 100 then times that by the amount shown in discount?

(1+2+3)/100*Whatever

#### Posting Permissions

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