[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7225
  • Last Modified:

VBScript/ASP always round up

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
LTY83
Asked:
LTY83
  • 4
1 Solution
 
fritz_the_blankCommented:
You bet:

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

FtB
0
 
fritz_the_blankCommented:
Oops, that's not right. That should be:

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

FtB

0
 
fritz_the_blankCommented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
LTY83Author Commented:
wow, quick, easy, man why didn't i think of that, thanks again! :)
0
 
ClifCommented:
dim fNumber

fNumber = 1.1

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

response.write(fNewNumber)
0
 
fritz_the_blankCommented:
Glad to have helped,

FtB
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now