4 Replies Latest reply on Oct 6, 2007 12:38 PM by BKBK

# Formating to Percent

I have a variable that is a long 0.1243453235 and I want to render it to a
percent. What function do I need to use?

And the darnest things is that I know this and cannot remember. :-)

--
Wally Kolcz
MyNextPet.org
Founder / Developer
586.871.4126

• ###### 1. Re: Formating to Percent
I use this:

then output

#numberformat(teampercent,"999.99")# %

But this is of course contingent upon what you are basing your percentage on
• ###### 2. Re: Formating to Percent
That's close, but not exactly. I am getting:

Single Women 0.26%

How can I get it down to just 26%

The original number is: 0.26125513326308364

• ###### 3. Formating to Percent
multiple results by 100 in a cfset statement

<cfset singlewomen=yourvar*100>

<cfoutput>#numberformat(singlewomen,"999")# %<cfoutput>

• ###### 4. Re: Formating to Percent
<p>
<cfset x=0.26125513326308364>
<cfset xAsPercent = 100 * x>
x = <cfoutput>#x#</cfoutput><br>
x as percent = <cfoutput>#round(xAsPercent)#%</cfoutput><br>
</p>

<p>
<cfset y=0.26525513326308364>
<cfset yAsPercent = 100 * y>
y = <cfoutput>#y#</cfoutput><br>
y as percent = <cfoutput>#round(yAsPercent)#%</cfoutput>
</p>