Rounding Numbers Up

1. Member
Join Date
Dec 1969
Posts
34

## Rounding Numbers Up

Hello ALL<BR><BR>How do I round a number up to the next decimal place<BR><BR>Example <BR>3.33 = 4<BR>3.78 = 4<BR>.33 = 1<BR>1.47 = 2<BR><BR>Thanks <BR>Stuart <BR><BR> <BR><BR><BR><BR><BR><BR><BR><BR>

2. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## Hmmm

i think this is in the FAQs <BR><BR><BR>but JIC<BR><BR>if Number &#060;&#062; clng(Number) Number = clng(Number) + 1<BR><BR>

3. Senior Member
Join Date
Dec 1969
Posts
10,852

## RE: Rounding Numbers Up

YourNum = 3.12415<BR><BR>If YourNum &#060;&#062; Int(YourNum) Then<BR>YourNum = Int(YourNum) + 1<BR>End If<BR><BR>That was off the top of my head...But it should work.

4. Senior Member
Join Date
Dec 1969
Posts
10,852

## One freakin' second.

What the heck are you doing in here at this time of night anyway?

5. Member
Join Date
Dec 1969
Posts
34

## RE: Rounding Numbers Up

Xanderno:<BR><BR>Thanks for the quick response appears to work for what I need.<BR><BR>Thanks <BR>Stuart

6. Senior Member
Join Date
Dec 1969
Posts
134

## RE: Rounding Numbers Up

Great suggestions one and all but wouldn&#039;t it be simpler to skip the IF statement and just use:<BR><BR>MyNum = Int(MyNum) + 1<BR><BR>Not that I want to create fast, easily maintainable code or anything ;-)

7. Senior Member
Join Date
Dec 1969
Posts
134

## RE: Rounding Numbers Up

Great suggestions one and all but wouldn&#039;t it be simpler to skip the IF statement and just use:<BR><BR>MyNum = Int(MyNum) + 1<BR><BR>Not that I want to create fast, easily maintainable code or anything ;-)

8. Senior Member
Join Date
Dec 1969
Posts
10,852

## No...Because....

If you&#039;ve already *got* an integer, you don&#039;t want to add to it.<BR><BR>if you just did <BR><BR>MyNum = Int(MyNum) + 1<BR><BR>on a value of 4.000, it would be "rounded" up to 5. So, you really *do* need the If condition.

9. Senior Member
Join Date
Dec 1969
Posts
10,852