Percent output format

All,

How can I format a 97.35786984 percent to 97.35  in asp .

Thanks
Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Web Ninja at largeCommented:
Try:

Num = FormatNumber( "97.123456", 2)
0
Author Commented:
No joy, I need it to carry out two places to the right of the decimal if less that 100%
0
Web Ninja at largeCommented:
works for me, if you don't want 100% to be formatted, then add a simple if statement:

num = 97.123456

if CDbl( num ) < 100 then
num = FornatNumber( num, 2 )
end if

Response.Write num
0
Web Ninja at largeCommented:
you may also want to consider the Round() function:

http://www.w3schools.com/vbscript/func_round.asp
0
Author Commented:
I cannot round up . There is a way to split at the . read the array to charters to the right  but I cannot remember the code.
0
Web Ninja at largeCommented:
What is the FormatNumber function giving you for a result? That should give you the formatted number to two places to the right of the decimal
0
Web Ninja at largeCommented:
you can also manually parse the number:

num = "97.727456"
num = Left( num, Instr( num , ".") + 2 )
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Perfect! Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.