Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    WoG
    WoG is offline
    New to the CF scene
    Join Date
    May 2004
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Converting to percentage

    I want to make a calculation on two numbers, (divide one into another) and display the result with the following format:
    ##.##%

    Here is what I have for the calculation:
    LAS_diff_perc = CInt(LAS_diff)/CInt(LASprev)
    Response.Write (LAS_diff_perc)

    Obviously, I get something like this:
    0.612903225806452

    How do I get the result with only 2 decimals past the decimal point?

    Thanks!

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    try this:
    Code:
    LAS_diff_perc = CInt(LAS_diff)/CInt(LASprev) * 100
    Response.Write (round(LAS_diff_perc,2))


  •  

    Posting Permissions

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