title: Conditional Formatting with openpyxl based on text
body: <p>I have a  spreadsheet that I am generating with openpyxl that contains a number of system checks. Based on the rules; the words Pass, Fail or Informational are inserted into Column E in my spreadsheet. I would like to use Openpyxl to conditionally format the fill of the spreadsheet based on the value of Pass or Fail. Something like Green for Pass and Red for Fail.</p>
  
  <p>My current code for openpyxl is:</p>
  
  <pre><code>wb = Workbook()
  ws = wb.active
  ws.freeze_panes = ws.cell('A3') 
  ws.title = 'Best Practice Report for XXX'
  ws['A1'] = 'Best Practice Report for XXX %s' % curdate
  ws['A2'] = 'IP Address/FQDN'
  ws['B2'] = 'BP Number'
  ws['C2'] = 'Title'
  ws['D2'] = 'Priority'
  ws['E2'] = 'Status'
  ws['F2'] = 'Description'
  a1 = ws['A1']
  a1.font = Font(size=20)
  redFill = PatternFill(start_color='FFEE1111', end_color='FFEE1111', fill_type='solid')
  
  ws.conditional_formatting.add('E4:E1000', FormatRule(text=['Fail'], stopIfTrue=True, fill=redFill))     
  wb.save('bp--TESTresults.xlsx') 
  </code></pre>
  
  <p>My issue is with the conditional formatting rule, I cannot find any good examples for conditional formatting based on the text in a cell.</p>
  
  <p><strong><em>Update</em></strong><br>
  Thanks to Charlie Clarks response I got this working. Created two rules as follows.</p>
  
  <pre><code>ws.conditional_formatting.add('E4:E1000', FormulaRule(formula=['NOT(ISERROR(SEARCH("Pass",E4)))'], stopIfTrue=True, fill=greenFill))    
  ws.conditional_formatting.add('E4:E1000', FormulaRule(formula=['NOT(ISERROR(SEARCH("Fail",E4)))'], stopIfTrue=True, fill=redFill))
  </code></pre>