VBScript/ASP always round up

Posted on 2004-09-13
Last Modified: 2012-08-13
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.
Question by:LTY83
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
  • Learn & ask questions
  • 4
LVL 46

Expert Comment

ID: 12044924
You bet:

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

LVL 46

Accepted Solution

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

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


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.

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

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

Expert Comment

ID: 12044958
dim fNumber

fNumber = 1.1

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

LVL 46

Expert Comment

ID: 12044959
Glad to have helped,


Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adjust an existing ASP Query 45 28
MS SQL and column defined as time 7 35
Sending ASP to server side 8 42
SQL Query Returns Records in SSMS but not Classic ASP 5 41
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question