Percent output format

All,

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

Thanks
UpperdeckerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Big MontyWeb Ninja at largeCommented:
Try:

Num = FormatNumber( "97.123456", 2)
0
UpperdeckerAuthor Commented:
No joy, I need it to carry out two places to the right of the decimal if less that 100%
0
Big MontyWeb 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
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Big MontyWeb Ninja at largeCommented:
you may also want to consider the Round() function:

http://www.w3schools.com/vbscript/func_round.asp
0
UpperdeckerAuthor 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
Big MontyWeb 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
Big MontyWeb 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

Your issues matter to us.

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

Start your 7-day free trial
UpperdeckerAuthor 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.