Conditional formatting rows or cells if two columns equal in Excel
In this article, I introduce the method on conditional formatting rows or cells if two columns equal in Excel.
|Method A Conditional formatting rows or cells if two columns equal||Method B Highlight and select cells if two columns equal|
|Compare Tow Ranges of Cells|
|The Compare Cells function of Kutools for Excel is used to compare two same size of ranges for identifying whether each cell of rangs has the same or different values. Click for 30-day free trial.|
In Excel, you can use the Conditional Formatting function to automatically shade the rows or cells if two columns equal.
1. Select the first list of data you want to compare to the second one, for instance, A2:A7, then click Home > Conditional Formatting > New Rule.
2. In the New Formatting Rule dialog, select Use a formula to determine which cells to format from Select a Rule Type section, then type =$A2=$B2 into the text box under Format values where this formula is true.
Tip: A2 is the first cell in the first list, and B2 is the first cell in the second list you want to compare to.
3. Click Format in the New Formatting Rule dialog, then select a background color under Fill tab in the popping Format Cells dialog.
4. Click OK > OK to close the dialogs. Now the cells have been shaded if two columns equal.
Note: if you want to fill rows when two columns equal, select two lists as range, and then apply the New Formatting Rule dialog.
If you want to highlight the cells if two columns equal, and at the same time, to select the cells, you can use the Compare Cells feature of Kutools for Excel.
|Kutools for Excel, with more than 300 handy functions, makes your jobs more easier.|
After free installing Kutools for Excel, please do as below:
1. Select the first list, then select the second list with holding Ctrl key, then click Kutools > Compare Cells to enable the Compare Cells dialog.
2. In the Compare Cells dialog, check Same cells option, check Fill backcolor or Fill font color check boxes, and select a color as you need.
3. Click Ok, now the cells have been selected and highlighted as well if two columns equal.
Click to download sample file