Roundig of integers up or down

# Thread: Roundig of integers up or down

1. Junior Member
Join Date
Dec 1969
Posts
16

## Roundig of integers up or down

I have a variable that i need to round to the next highest number.<BR><BR>e.g<BR><BR>14.001 will become 15 <BR>13.999 will become 14<BR>any ideas

2. oli
Senior Member
Join Date
Dec 1969
Posts
3,961

## Round(Number) <eop>

.

3. Junior Member
Join Date
Dec 1969
Posts
16

## RE: Round(Number) <eop>

That works fine for rounding the number if it is say <BR>13.4 = 13 and 13.6 = 14 <BR>but i need it to round 13.x to be 14 so anything other than the number itself gos upto the next number.

4. sb
Senior Member
Join Date
Dec 1969
Posts
238

## RE: Round(Number) <eop>

try:<BR>cint(number)

5. sb
Senior Member
Join Date
Dec 1969
Posts
238

## sorry....

even this will act like the round function

6. Eddie Campbell Guest

## RE: Round(Number) <eop>

You will need a function to do that for you. Something like this:<BR><BR>&#060;%<BR> Dim MyNum<BR> MyNum = 13.9<BR> MyNum=MyRounder(MyNum)<BR> response.write MyNum<BR>%&#062;<BR>&#060;script language = "vbscript" runat="server"&#062;<BR> function MyRounder(MyNum)<BR> If InStr(MyNum,".") &#062; 0 then<BR> MyNum = int(MyNum) + 1<BR> end If<BR> MyRounder=MyNum<BR> End Function<BR>&#060;/script&#062;<BR>

7. Junior Member
Join Date
Dec 1969
Posts
16

## RE: sorry....

Thanks for your help. I have the variable setup with round(varname) etc. Basically this is the result i am looking for<BR><BR>If i round(14.01) it will give me 14 because that is what it would normally get rounded to. I need to get the answer to be 15, so i dont know if the round function will do what i want or if i need to do something else.

8. Junior Member
Join Date
Dec 1969
Posts
16

## Exactly what i am after

Thanks

#### Posting Permissions

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