Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Round Up 2

Status
Not open for further replies.

DPACAccessWiz

Technical User
Mar 30, 2002
15
0
0
US
I need to round tax up to the nearest penny. Round() works in both directions like it should, but I need to RoundUp() like you can in Exel, but I can't seem to make it Work In Access2000

Thanks.
 
Try this:

Code:
Int(([fieldname] + 0.005) * 100) / 100

This should round up the hundreds digit of any value.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Int(([fieldname] + 0.005) * 100) / 100
For me, this is a normal math round.
For a RoundUP, I'd try this:
Int(([fieldname] + 0.99999999) * 100) / 100

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV: Interesting. I guess you may be right. Does he want any fractional amount of the penny to be rounded up to the next penny? .001 rounds to .01? If so, then you are right with the modification provided.

We shall see!!

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
It's the behaviour of the Excel.WorksheetFunction.RoundUp mentioned by the OP.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
More clarification: I need to round up to the nearest penny allways when the number has more the 2 places to the right of the decimal(any fractional amount of the penny to be rounded up to the next penny).

I tried this in Exel

INT((5.454545455+.005)*100)/100 = 5.45

INT((5.454545455+.99999999)*100)/100 = 6.45

RoundUp(4.454545455) =5.46

I need the answer to be 5.46
 
How about a slight modification to my original posting:

Code:
Int(CLng((Me.[Text0] + 0.005) * 100)) / 100

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Let's update that also:

Code:
Int(CLng(([[i][red]fieldname[/red][/i]] + 0.004999999999999) * 100)) / 100

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Mybad, I'm french and I don't knew that a penny what a fractional part.
Try this:
Int(([fieldname] + 0.[highlight]00[/highlight]99999999) * 100) / 100

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top