why not rounding

dmyoungsal

Registered User.
Local time
Today, 14:23
Joined
May 1, 2016
Messages
112
I have a formula that is not rounding correctly.

Can someone figure out what I am missing?

=IIf([FullCk]="-1",IIf([chkSDel]<>"-1",(Round(([TrkRate]+[TrkMU]+Nz([Rush$])+Nz([TotSurcharge])),4)),(Round(([trkRate]+Nz([Rush$])+Nz([TotSurcharge])),4))))

I have another textbox that is giving me a result of 220.01

but this textbox is used if the "FullCk" (checkbox) is checked and I am getting 220.80

If I do not use rounding in either text box, I get the same amount in both boxes.
 
I guess the least you have to do is give the users some inputnumbers you are working with, not only the outcome
 
If you're testing a checkbox, the test should be for -1, without the quotes.
 
or use

=IIf([FullCk]=true,IIf....

or just

=IIf([FullCk],IIf....
 
I am asking about the rounding portion of the formula, not the "iif" statements. Those work fine.

I am asking why the rounding does not work. It does not matter if i use 2,3,4 or 5 for the precision part, the result is the same
 
how about providing some actual values plus the formula in the 'other textbox' plus the actual value when round is not used so we have some reference to make.

so far as I can see

=IIf([FullCk]="-1" has a THEN IIf([chkSDel]<>"-1"...., but there is no ELSE part
 
I don't see rounding changing the value by .79 like you've described. Make sure the values are numeric rather than text, and disambiguate your Nz() functions:

Nz(FieldName, 0)

Also, why the extra parentheses inside the Round() functions? Makes sense when mixing operators, but not when adding.
 
Again, the iif portions of this work exactly like i want them. I am asking for help on the Rounding and why it is not working.
 
You've been asked for values a couple of times, and been given suggestions. A sample db may also help.
 
Nevermind. Giving variables is really difficult because they are calced elsewhere. They match if i round precision as 2, but stay same if i change precision to something else.

I was thinking someone would look at the round statements and say i had a paren in the wrong place.
 
If you had parentheses in the wrong place, I doubt the syntax would have given you anything because the code wouldn't compile correctly.

If you were worried about too many parentheses, then (for test purposes) separate the steps into two results and see what you got back from the parts.

You are fixated on having someone count parentheses for you (or syntax checking). Give us some numbers or we won't be able to test this for ourselves and trace it down.
 

Users who are viewing this thread

Back
Top Bottom