How to Fill Color in Cell Using Formula in Excel (5 Easy Ways)

Here’s an overview of the formulas we used to fill in cells with colors.

Filling Color in Cell Using Formula in Excel


We’re using a sample Pay Sheet of several employees. There are 4 columns that represent the weekly, monthly, and yearly pay of an employee.

Dataset to Fill Color in Cell Using Formula


Method 1 – Using the AVERAGE Function with Conditional Formatting to Fill Cell Color

  • Select the cell or the cell range where you want to apply this function to fill the color.
  • Open the Home tab.
  • Go to Conditional Formatting.
  • Select New Rule.

Choosing New Rule from Conditional Formatting to Use AVERAGE Function

  • A dialog box will pop up.
  • Select Use a formula to determine which cells to format from Select a Rule Type.
  • In Edit the Rule Description, insert the following formula.
=$C5:$C15<=AVERAGE($C$5:$C$15)
  • Click on Format.

Using AVERAGE Function to Fill Cell Color in Excel

  • From the Fill section, select the color of your choice to use in a cell.
  • Click OK.

Formatting Fill Color Using AVERAGE Function in Excel

The AVERAGE function will calculate the average of the selected cell range C5:C15 and then will compare the average value with values of cell range C5:C15. Conditional Formatting will fill color where the cell value is less than average.

  • Click OK.

How to Fill Color in Excel Cell Using Formula

Read More: Excel Formula Based on Cell Color


Method 2 – Applying the ISFORMULA Function with Conditional Formatting to Fill Cell Color

  • Select the cell range where you want to fill the color using the formula.
  • Open the Home tab.
  • Go to Conditional Formatting and select New Rule.

Choosing New Rule from Conditional Formatting to Use ISFORMULA Function

  • A dialog box will pop up.
  • Choose Use a formula to determine which cells to format as Select a Rule Type.
  • In the Edit the Rule Description, use the following formula.
=ISFORMULA($D$5:$E$15)
  • Go to Format and choose the color of your choice to fill color in a cell.

Applying ISFORMULA Function Using Formula in Cell to Fill Color in Excel

We selected the cell range D5:E15 as the reference of the ISFORMULA function to fill color.
  • Click OK.

Result of Applying ISFORMULA Function

Note: This method will not work on those cells where a formula is not applied.

Method 3 – Fill Cell Color in Excel Using the OR Function with Conditional Formatting

  • Select the cell range where you want to apply this function to fill the color.
  • Open the Home tab, go to Conditional Formatting, and select New Rule.

Choosing New Rule from Conditional Formatting to Use OR Function

  • A dialog box will pop up.
  • From Select a Rule Type: select Use a formula to determine which cells to format.
  • In Edit the Rule Description, use the following formula.
=OR($C5<30, $D5=180)
  • Select the Format of your choice to fill the color in a cell.

Fill Color Using Formula in Excel Cell with OR Function

To use the OR function, we used two conditions: $C5<30 and $D5=180. In the selected cell range, B5:E15, if any of the conditions are fulfilled in any cell, Excel will fill the color of that cell.
  • Click OK.

Output of Using OR Function

Read More: How to Fill Cell with Color Based on Percentage in Excel


Method 4 – Using the AND Function with Conditional Formatting to Fill Cell Color in Excel

  • Select the cell range to apply the AND function to fill the color.
  • Open the Home tab, go to Conditional Formatting, and select New Rule.

Choosing New Rule from Conditional Formatting to Use AND Function in Excel

  • A dialog box will pop up.
  • From Select a Rule Type window, select Use a formula to determine which cells to format.
  • In Edit the Rule Description, insert the following formula.
=AND($C5<50, $D5=180)
  • You can select the Format of your choice to fill color in a cell.

Inserting AND Function to Fill Cell Color in Excel

In the selected cell range, B5:E15, if both of the conditions are fulfilled for any cell, that cell will be filled with color.
  • Click OK.

Final Output of Inserting AND Function

Related Content: How to Change Cell Color Based on a Value in Excel


Method 5 – Highlighting Cells Based on Conditions (Greater than, Less Than, Equal to or Not Equal to)

Case 5.1 – Greater Than (>)

  • Select the cell or cell range to apply the formula.
  • Ppen the Home tab, go to Conditional Formatting, and select New Rule.

Choosing New Rule from Conditional Formatting to Use Greater Than Operator

  • Adialog box will pop up. From Select a Rule Type, select Use a formula to determine which cells to format.
  • In Edit the Rule Description, use the following formula.
=D5 *12 > 1800
  • Select the Format of your choice to fill the color in a cell.

Formula with Greater Than Operator in New Formatting Rule Window

  • Click OK.
  • This will show the cells filled with the selected format where D5*12 is greater than 1,800.

Final Result of Greater Than Operator


Case 5.2 – Not Equal (<>)

  • Select the cell or cell range to apply the formula.
  • Go to Conditional Formatting and select New Rule.

Choosing New Rule from Conditional Formatting to Use Greater Than Operator

  • From Select a Rule Type, select Use a formula to determine which cells to format.
  • Use the following formula.
=C5*4 <> 180
  • From the Format option, you can select the format of your choice to fill color in a cell.

Formula with Not Equal Operator in New Formatting Rule Window

The operator will check where C5*4 is not equal to 180 in the selected cell range B5:B15. Excel will fill the rows where the condition is fulfilled.
  • Click OK.

Final Result of Not Equal Operator


Case 5.3 – Equal to (=)

  • Select the cell or cell range to apply the formula.
  • Go to Conditional Formatting and select New Rule.

Choosing New Rule from Conditional Formatting to Use Equal Operator

  • A dialog box will pop up.
  • Select the Use a formula to determine which cells to format rule.
  • In Edit the Rule Description, use the following formula.
=C5*4 = 180
  • From the Format options, select the format of your choice to fill color in a cell.

Formula with Equal Operator in New Formatting Rule Window

We used the (=) Equal operator to check where C5*4=180.

  • Click OK.

Final Result of Equal Operator


Case 5.4 – Less Than (<)

  • Select the cell or cell range to apply the Less than operator.
  • Go to Conditional Formatting and select New Rule.

Choosing New Rule from Conditional Formatting to Use Less Than Operator

  • A dialog box will pop up.
  • Select the Use a formula to determine which cells to format rule.
  • Use the following formula.
=$D5:$D15<180
  • Select the fill color of your choice from the Format options.

Formula with Less Than Operator in New Formatting Rule Window

  • Click OK.

Final Result of Less Than Operator


Download the Practice Workbook


Related Articles

Get FREE Advanced Excel Exercises with Solutions!
Shamima Sultana
Shamima Sultana

Shamima Sultana, BSc, Computer Science and Engineering, East West University, Bangladesh, has been working with the ExcelDemy project for 2 years. She has written over 75+ articles and reviewed 1000+ articles for ExcelDemy. She has also led several teams with Excel VBA and Content Development works. Currently, she is working as the Project Manager and oversees the day-to-day work, leads the services team, allocates resources to the right area, etc. Her work and learning interests vary from Microsoft... Read Full Bio

2 Comments
  1. I have Purchased spread sheet templates and cant find where or if they have been downloaded to access

    Best wishes,

    Barry

    • Hello, Barry! You can check your default path folder for browser downloads. And if you need any assistance with the Excel problems you can mail us!

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo