rounding off in query

P

patrick

I WANT TO CALCULATE THE NET AFTER DEDUCTING TAX AT 2% AND
DEDUCTING FROM GROSS.EXAMPLE [NET]=[GROSS]-ROUND([GROSS]
*0.02,0)IF I TAKE GROSS AS 525,575,625,675,725, ETC I GET
WRONG RESULTS FOR NET.
MS ACCESS ROUNDS 14.5 TO 14 AND 15.5 TO 16. WHY THIS
ANOMALY. PLEASE HELP ME.
 
J

Jeff Boyce

Patrick

Please turn off your CAPS LOCK - posting in all caps makes it difficult to
read and is considered "shouting".

Re-check the underlying field definitions -- it sounds like the "number"
could be defined as an integer. If so, integers have no decimal places. If
not defined as an integer (but a "currency", "single" or "double"), how many
decimal places are set in the Format property?
 
V

Van T. Dinh

Access uses a version of rounding called "Banker's Rounding" which rounds to
the *nearest even* number for the exact 0.5 if zero decimal digit is
specified (similarly for other decimal digit selections). Thus, 14.5 is
rounded down to 14 and 15.5 is rounded up to 16, i.e nearest even in each
case.

However, I wonder ehy you want to round the Tax component ... One thing foe
sure, the Tax Department / Internal Revenue won't be too happy with the
algo... if you use this to calculate the payable tax.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top