title: How can I fill with colour particular cells in Excel?
body: <p>I have this code and it works fine. But the problem is that I have to make a lot of if-elif things. I need to make it in a more elegance way.   </p>
  
  <pre><code>wb = openpyxl.load_workbook('/New.xlsx')
  ws = wb.active
  ws = wb.get_sheet_by_name(u'И')
  
  redFill = PatternFill(start_color='FFFF00',end_color='FFFF00',fill_type='solid')#желтый
  redFill2 = PatternFill(start_color='FF4500',end_color='FF4500',fill_type='solid')#красный
  redFill3 = PatternFill(start_color='FFA500',end_color='FFA500',fill_type='solid')#оранжевый
  redFill4 = PatternFill(start_color='228B22',end_color='228B22',fill_type='solid')#зеленый
  
  if ws.cell(row=2, column=4).value=='50,00%':
      ws['E2'].fill = redFill2
  elif ws.cell(row=2, column=4).value=='75,00%':
      ws['E2'].fill = redFill3
  elif ws.cell(row=2, column=4).value=='100,00%':
      ws['E2'].fill = redFill4
  
  wb.save('/New.xlsx')
  </code></pre>
  
  <p>I want to create something like this :</p>
  
  <pre><code>def ws_f(row,column):
      if ws.cell(row=row, column=column).value=='50,0%':
          return ws.cell.fill = redFill2
      elif ws.cell(row=row, column=column).value=='75,0%':
          return ws.cell.fill=redFill3
      elif ws.cell(row=row, column=column).value=='100,0%':
          return ws.cell.fill=redFill4
  
  ws_f(3,5)
  </code></pre>
  
  <p>But it does not work with the <code>def ws_f</code> way. Any suggestions?</p>