How to color code cells in Excel

You can watch a video tutorial here.

Excel has several options for formatting cells and one such option is Conditional formatting. Conditional Formatting allows you to define the format of a cell based on its value. Applying conditional formatting to cells is a great way to enhance a table of data by providing visual clues. You can specify a rule that can be applied to a single cell or a range of cells. The rules function based on the value in the cells and any of the following formatting can be done:

  1. Highlight the cells or change the color of cells that meet a condition
  2. Apply a color scale to all cells in a range i.e. a color gradient will be applied and the color of the cell will depend on where its value falls in relation to the other cells
  3. Create data bars in the cells
  4. Add icons to the cells

In this example, we will look at the first two options that let you color-code the cells based on their value.

Option 1 – Highlight cells

Step 1 – Select the cells

  • Select the cells to be formatted

Step 2 – Choose a preset option

  • Go to Home > Styles > Conditional Formatting
  • Click on Highlight Cells Rules
  • Choose Text that Contains

Step 3 – Enter the value 

  • Enter the values:
  • Format cells that contain the text: YES 
  • With: Green Fill with Dark Green Text
  • Click OK

Step 4 – Check the result

  • All cells in the column with the value “YES” are colored green

Option 2– Apply a color scale

Step 1 – Select the cells

  • Select the cells to be formatted

Step 2 – Choose a preset option

  • Go to Home > Styles > Conditional Formatting
  • Click on Color Scales
  • Choose Green – Yellow – Red Color Scale

Step 3 – Check the result

  • The color gradient is applied to all the cells
  • Higher values are green and lower values are red with the rest of the numbers on the color gradient in between