[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
Solved

# VBScript/ASP always round up

Posted on 2004-09-13
Medium Priority
6,625 Views
Hi, is there a way to make my numbers always round up, say i have 1.1, i want it to always round up to 2, anyone know of a way of doing this, as the Round() function seems to go up or down depending on the decimal.
0
Question by:LTY83
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 4

LVL 46

Expert Comment

ID: 12044924
You bet:

function roundUp(numToRound)
roundUp = Int(numToRound + .5)
end function

FtB
0

LVL 46

Accepted Solution

fritz_the_blank earned 2000 total points
ID: 12044936
Oops, that's not right. That should be:

function roundUp(numToRound)
roundUp = Round(numToRound + .5)
end function

FtB

0

LVL 46

Expert Comment

ID: 12044943
The idea is that anything above .5 will round up, anything below downwards. Adding .5 to the value will always force a round up.

FtB
0

LVL 4

Author Comment

ID: 12044951
wow, quick, easy, man why didn't i think of that, thanks again! :)
0

LVL 10

Expert Comment

ID: 12044958
dim fNumber

fNumber = 1.1

fNewNumber = int(fNumber) + abs((fNumber - int(fNumber)) <> 0)

response.write(fNewNumber)
0

LVL 46

Expert Comment

ID: 12044959

FtB
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was writtenâ€¦
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interactâ€¦
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastrâ€¦
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper cornâ€¦
###### Suggested Courses
Course of the Month12 days, 17 hours left to enroll