Crystal Reports – How to apply conditional formatting to fields

The steps below detail how to use Crystal Reports to make fields apply formatting on a condition.

For example, if the amount is $0.00 – red, if more than $1,000 – green otherwise use default font colour.

  1.  Right-click on the field and select ‘Format Field’
  2. CrystalReports-ConditionalFormatting1
  3. Open the ‘Font’ tab
  4. You’ll notice against each option there’s a formula button – you can use these to apply formulas that override the default formatting
  5. CrystalReports-ConditionalFormatting2
  6. In this example we’ll be setting colours, so click on the formula button for the colour option
  7. The formula editor will open. You’ll notice that there are instructions added to the formula which detail all the colour options.
  8. To set the colour red when the field is $0.00 or green when more than $1,000 use the following formula
  9. if {fieldname} = 0 then crRed else if {fieldname} > 1000 then crGreen
  10. You’ll now find the field changes colour according to your formula.
  11. CrystalReports-ConditionalFormatting3