I have this visualforce tag

<td align="center">{!IF(relatedTo.Total_Professional_Services_Before_Disc__c=0, "--", "$" + TEXT(ROUND(relatedTo.Total_Professional_Services_Before_Disc__c,0)))}</td> 

and the idea is that if it is 0, it will output '--' else the number in US currency format. It works fine but let's say the number is 9999, it will output


Is there a simple way to make it output


without creating a controller as this is just in a simple visualforce email template?

Edit: Thank you to those that answered. Final solution came out to be

<td align="center">
  <apex:outputText value="${0, number, ###,##0}" rendered="{!IF(relatedTo.Total_Professional_Services_Before_Disc__c=0, false, true)}">
    <apex:param value="{!relatedTo.Total_Professional_Services_Before_Disc__c}"/>
  <apex:outputText rendered="{!IF(relatedTo.Total_Professional_Services_Before_Disc__c=0, true, false)}">--</apex:outputText>

It isn't pretty and I can't say I'm excited to replace 28 tags in a table like this, but it works


2 Answers 2


You could use outputText to print a formatted number with rendered attribute to define whether to print the number or the double dash (--).

<apex:outputText value="{0, number, ###,##0}">
    <apex:param value="{!myNumber}"/>
  • Using this method, how would you add the '$'
    – adam
    Commented Mar 7, 2019 at 16:24
  • Just place value="${0, number, ###,##0}".
    – Dahn
    Commented Mar 14, 2019 at 9:14

with $ sign ...

<apex:outputText value="${0, number, ###,##0}">
    <apex:param value="{!myNumber}"/>

Not the answer you're looking for? Browse other questions tagged .