SAP Knowledge Base Article - Public

1538990 - How to change the color of negative values in Crystal Reports?

Symptom

  • How to change the color of a number when it is negative?
  • How to set the color of a numeric value to red when the value is below zero?
  • In Crystal Reports, how to write a formula for a numeric field which has both negative and positive values, so the negative values will display in red font while the positive values in black?

Environment

  • SAP Crystal Reports 2008
  • SAP Crystal Reports 2011
  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016

Resolution

  • To conditionally format the color of numeric field to display it in red when it is a negative value: 
      
    1. In Crystal Reports, open the report on which you want to conditionally format the numeric field.
        
    2. Right click on the field, and select "Format Field..."
        
    3. In the Format Editor window, select the tab "Font"
        
    4. For the option "Color", click on the "X-2" button, which is located on the right side of the option.
        
    5. In the formula editor window, create a conditional formula like:
         
           If currentFieldValue < 0 Then crred Else crblack
           
    6. Save and Close the formula editor.
        
    7. Back to the Format Editor window, click "OK" to accept the change.
          
      Note:
      If you want to format multiple fields the same way at the same time, select all the fields to format, then perform the same steps as above.
      To select multiple fields at once, you can hold the "CTRL" key on the keyboard, and click on each field to format.

Keywords

CR , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports 2011 ; SAP Crystal Reports 2013 ; SAP Crystal Reports 2016