How to Apply Conditional Formatting with INDEX-MATCH in Excel

Get FREE Advanced Excel Exercises with Solutions!

In this article, I’ll show you how you can apply Conditional Formatting over a data set with the INDEX-MATCH functions in Excel. You’ll learn to use Conditional Formatting with INDEX-MATCH with both a fixed lookup value and a variable lookup value, on a single column and on multiple columns.

overview of index match conditional formatting

Download Practice Workbook

you can download the practice workbook from here.


4 Easy Ways to Use Conditional Formatting with INDEX-MATCH in Excel

Here we’ve got a data set with the total sales of some products of 10 days of a company called Jupyter Group.

dataset for demostration

Today our objective is to apply Conditional Formatting on this data set with the INDEX-MATCH functions of Excel.


1. Using Conditional Formatting with INDEX-MATCH with a Fixed Lookup Value in Excel (Over a Single Column)

First of all, let’s try to apply Conditional Formatting with INDEX-MATCH with a fixed lookup value, over a single column in Excel.
Let’s try to highlight the names of the products that had the total sales more than the sales of Jersey.
I am showing you the step-by-step procedure to accomplish this.

Steps:

  • Firstly, select the column on which you want to apply Conditional Formatting.
  • Here, I’ve selected the column Product Name (C5:C14).
  • Then, go to the Home > Conditional Formatting>New Rule tool in the Excel Toolbar.

selecting conditional formatting option

  • Afterward, you will see a dialogue box called New Formatting Rule appeared.
  • Further, select use a formula to determine which cells to format.
  • Then, insert any of the following formulas in the formula box:
=D5>INDEX($B$5:$D$14,MATCH("Jersey",$C$5:$C$14,0),3)

Or

=$D5>INDEX($B$5:$D$14,MATCH("Jersey",$C$5:$C$14,0),3)

setting new formatting rule box

  • Moreover, click on Format. A dialogue box called Format Cells will appear.
  • There, choose any format that you want to apply to the cells that fulfill the criteria. I chose the light brown color from the Fill tab.

Choosing Format to Use Conditional Formatting with INDEX-MATCH in Excel

  • Then, click on OK. You’ll be directed back to the New Formatting Rule box.
  • After that, you will see a preview in the New Formatting Rule dialog box. just click OK to close the box.

preview in new formatting rule box

  • Finally, You will find the names of the products that had sales greater than the sales of Jersey highlighted in light brown.

Output to Use Conditional Formatting with INDEX-MATCH in Excel

Formula Breakdown:

  • MATCH(“Jersey”,$C$4:$C$13,0) searches each row of the column C5:C14, and returns the number of the row if it finds “Jersey”. See the MATCH function for details. Here it finds “Jersey” in the 3rd row. So it returns 3.
  • INDEX($B$5:$D$14,MATCH(“Jersey”,$C$5:$C$14,0),3) now becomes INDEX($B$5:$D$14,3,3). It returns the value from the 3rd row and 3rd column of table B5:D14. See the INDEX function for details. This is the total sales of Jersey, $830,000.00.
  • $D5>INDEX($B$5:$D$14,MATCH(“Jersey”,$C$5:$C$14,0),3) now becomes $D5>830000. It returns TRUE if the value in cell D5 is greater than 830000, otherwise, it returns FALSE.
  • Now, the formula will move to the next cell of the selected column, to cell C6. It will return TRUE if the value in column D6 is greater than 830000, otherwise, it will return FALSE.
  • Similarly, it will move to all the cells from C5:C14 and return TRUE if the value in the respective cell in D5:D14 is greater than 830000, otherwise, it will return FALSE.
  • Now, the cells that got TRUE will be highlighted in your desired format, thus the products that had sales greater than the sales of Jersey will be highlighted.

Things to Remember:

  • Here we’ve applied the formula on a single column, that’s why we had to use either the Relative Cell Reference or the Mixed Cell Reference of the cell D5 (D5 or $D5).
  • When the formula moves down to cell D6, the cell reference in the formula automatically becomes D6 if you use D5 or $D5. But it would have remained D5 if you had used $D$5 or D$5. (Similar to dragging the Fill Handle with a formula).
  • Therefore, while applying Conditional Formatting on a single column, you must use either the Relative Cell Reference or the Mixed Cell Reference of the cells of that column.

2. Applying Conditional Formatting with INDEX-MATCH with a Fixed Lookup Value in Excel (Over Multiple Columns)

You can also use Conditional Formatting with INDEX-MATCH with a fixed lookup value over multiple columns of a data set.

Let’s try to highlight the whole rows (Date, Product Name, Total Sales) of the products that had sales greater than the sales of Jersey.

Steps:

  • The steps are the same as initial steps of Method 1. Just select the whole data set in lieu of a single column.

selecting conditional formatting for multiple columns

  • Afterward, insert the formula with the Mixed Cell Reference.
=$D5>INDEX($B$5:$D$14,MATCH("Jersey",$C$5:$C$14,0),3)

setting new formatting rule box

  • Then, choose your desired format from the Format Cells dialogue box.
  • Afterward, click OK twice. You’ll find the whole rows of the products that had sales greater than the sales of Jersey marked in your desired format.

Output to Use Conditional Formatting with INDEX-MATCH in Excel

Formula Breakdown:

The explanation of the formula is the same as the earlier method. See it for details.

Things to Remember:

  • Here we’ve applied Conditional Formatting on multiple columns. That’s why we used the Mixed Cell Reference of cell D5 ($D5) in the formula.
  • When the formula moves to cell B6 from B5, the cell reference becomes D6 from D5, but when the formula moves to C5 from B5, the cell reference remains constant at D5 (Like dragging the Fill Handle).
  • Therefore, while applying Conditional Formatting on multiple columns, you must use the Mixed Cell References of the cells.

Similar Readings


3. Assigning Conditional Formatting with INDEX-MATCH with a Variable Lookup Value in Excel (Over a Single Column)

This time we will apply Conditional Formatting with INDEX-MATCH over a single column, but with a variable lookup value.

Look at this new worksheet. We have the sales record of some products in a data set, along with the target sales of the products in another data set.

modified dataset with criteria columns

Now, we’ll highlight the names of the products in the original data set that had sales greater than the respective target sales.

Steps:

The steps are the same as the previous methods. Just select the column Product Name and select New Rule from Conditional Formatting.

selecting conditional formatting new rule

  • Then, use one of the two formulas:
=D5>INDEX($F$5:$G$14,MATCH(C5,$F$5:$F$14,0),2)

Or

=$D5>INDEX($F$5:$G$14,MATCH($C5,$F$5:$F$14,0),2)

setting new formatting rule box

  • Afterward, choose your desired format from the Format Cells dialogue box.
  • Then, click OK twice. You’ll find the names of the products that had sales greater than the target sales marked in your desired format.

output of index match conditional formatting

Formula Breakdown:

  • MATCH($C5,$F$5:$F$14,0),2) searches each row of the column F5:F14, and returns the number of the row if it finds the value in cell C5 there (Full Sleeves). See the MATCH function for details. Here, it finds “Full Sleeves” in the 1st row. So it returns 1.
  • INDEX($F$5:$G$14,MATCH($C5,$F$5:$F$14,0),2) now becomes INDEX($F$5:$G$14,1,2). It returns the value from the 1st row and 2nd column of table F5:G14. See the INDEX function for details. This is the target sales of Full Sleeves, $540,000.00.
  • $D5>INDEX($F$5:$G$14,MATCH($C5,$F$5:$F$14,0),2) now becomes $D5>540000. It returns TRUE if the value in cell D5 is greater than 540000, otherwise, it returns FALSE.
  • Now, the formula will move to the next cell of the selected column, to cell C6. It will return TRUE if the value in column D6 is greater than 900000 (Target Sales of Half Sleeves), otherwise, it will return FALSE.
  • Similarly, it will move to all the cells from C5:C14 and return TRUE if the respective value in D5:D14 is greater than the target sales, otherwise, it will return FALSE.
  • Now, the cells that got TRUE will be highlighted in your desired format, thus the products that had sales greater than the target sales will be highlighted.

Things to Remember:

  • Here we’ve applied the formula on a single column, that’s why we had to use either the Relative Cell References or the Mixed Cell References of the cells C5 and D5. (C5 or $C5 and D5 or $D5).
  • When we apply Conditional Formatting in a single column, we can use either the Relative Cell Reference or the Mixed Cell Reference in the cells.

4. Using Conditional Formatting with INDEX-MATCH with a Variable Lookup Value in Excel (Over Multiple Columns)

Finally, let’s try to highlight the whole rows of products that could fulfill their target sales.

Steps:

  • The steps are the same as Method 1. Just select the whole data set.

selecting conditional formatting new rule

=$D5>INDEX($F$5:$G$14,MATCH($C5,$F$5:$F$14,0),2)

setting new formatting rule box

  • Then, select your desired format and click OK twice.
  • Finally, you’ll find the rows of the products that fulfilled the target sales highlighted in your desired format.

output of index match conditional formatting

Formula Breakdown:

The explanation of the formula is the same as Method 3. See it for details.

Things to Remember:

While applying Conditional Formatting on multiple columns, you must use the Mixed Cell Reference of the cells.


Conclusion

Using these methods, you can apply Conditional Formatting with INDEX-MATCH with both fixed lookup value and variable lookup value in Excel. Do you have any questions? Feel free to ask us in the comment section. Also, follow our website, ExcelDemy, a one-stop Excel solution provider to explore more.


Related Readings

Rifat Hassan
Rifat Hassan

Hello! Welcome to my profile. Here I will be posting articles related to Microsoft Excel. I am a passionate Electrical Engineer holding a Bachelor’s degree in Electrical and Electronic Engineering from the Bangladesh University of Engineering and Technology. Besides academic studies, I always love to keep pace with the revolution in technology that the world is rushing towards day by day. I am diligent, career-oriented, and ready to cherish knowledge throughout my life.

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo