Power bi conditional formatting compare two columns


When comparing and matching data in Microsoft Excel, you may do so in a variety of ways; however, the vast majority of these approaches focus on searching within a single column. When you compare and match data in Microsoft Excel, you can do so in a variety of ways. Instead of receiving the result in a separate column, which is something you may do if you want to highlight certain rows, conditional formatting enables you to highlight the rows that contain matching data. This can be done in place of getting the result in a separate column.

In this tutorial, you are going to learn how to use conditional formatting when two columns are equal.

Highlight Columns using Conditional Formatting

Using the conditional formatting feature of Excel, it is possible to compare two columns and highlight the Unique and Duplicate cells between them.

Let’s understand how it works, through an example.

Step 1

In our example, we have Employee names assigned for Project1 and Project2. There are some employees who are assigned for both the projects. We are going to compare both the columns and highlight those employee names who are assigned for both the projects.

See the following Excel sheet which contains the employee names for both the projects.

Power bi conditional formatting compare two columns

Step 2

Select the data in the columns to whom you want to compare. In our case, we are selecting the data from cell A2 to B10.

Power bi conditional formatting compare two columns

Step 3

Now from the Ribbon, Go to Home Tab, then from the Styles group, select Conditional Formatting option. Then from the dropdown list, put cursor on Highlight Cell Rules, then go to Duplicate Values. (Home > Conditional Formatting > Highlight Cell Rules > Duplicate Values).

Power bi conditional formatting compare two columns

Step 4

Now a popup window will appear. From the popup window, select Duplicate if you want to Highlight the duplicate data, otherwise select "Unique". In the place of "values with", select a color combination from the dropdown list appears as per your choice.

In our case, we are selecting Duplicate to highlight the duplicate data and values with as Light Red Fill with Dark Red Text. Then click OK.

Power bi conditional formatting compare two columns

Step 5

After clicking OK, we can see that the duplicate values have been highlighted with light red and dark red text.

Power bi conditional formatting compare two columns

Using Formula to format cells

You can use formula to highlight the duplicate data comparing both the columns. See the below given steps to use conditional formatting to the cell.

Step 1

We have the names of employees who are working on Project1 and Project2, listed here in our Excel sheet. Some of the employees are tasked with contributing to both of the projects.

Power bi conditional formatting compare two columns

Step 2

Select the data from the column you want to highlight.

Now from the Ribbon, Go to Home tab, then from the Styles group, select Conditional Formatting option. Then from the dropdown list select New Rules option. See the below given image.

Power bi conditional formatting compare two columns

Step 3

In the New Formatting Rule dialogue, choose Use a formula to determine which cells to format from Select a Rule Type Section. Then, in the text box under Format values where this formula is true, type =A2=B2. We typed "=A2=B2" here because A2 is the first cell in the first list and B2 is the first cell in the second list we want to compare to.

Power bi conditional formatting compare two columns

Step 4

Click the Format button in the New Formatting Rule dialogue, then choose a background color in the Format Cells dialog's Fill tab. In our example, we have selected Yellow as background color with text color black. Then click OK.

Power bi conditional formatting compare two columns

Power bi conditional formatting compare two columns

Power bi conditional formatting compare two columns

Step 5

Now we can see that the duplicate data have been highlighted. See the image given below.

Power bi conditional formatting compare two columns

Conclusion

In this tutorial, you learnt how to use conditional formatting if two columns are equal. You can use any method as per your choice.

Power bi conditional formatting compare two columns

Updated on 11-Aug-2022 14:25:04

  • Related Questions & Answers
  • Check if two strings are equal or not in Arduino
  • How to layout table cells, rows, and columns with JavaScript?
  • MySQL query to delete a row if two columns are equal
  • Check if two StringDictionary objects are equal or not in C#
  • Select all duplicate MySQL rows based on one or two columns?
  • Flip Columns For Maximum Number of Equal Rows in Python
  • C program to compare if the two matrices are equal or not
  • How to remove duplicate rows in an R data frame if exists in two columns?
  • Python Pandas - Determine if two Index objects with opposite orders are equal or not
  • Check if two SortedSet objects are equal in C#
  • Check if two BitArray objects are equal in C#
  • Check if two ArrayList objects are equal in C#
  • Check if two HashSet objects are equal in C#
  • Check if two HybridDictionary objects are equal in C#
  • Check if two LinkedList objects are equal in C#
  • Check if two StringBuilder objects are Equal in C#

How do you compare two columns in conditional formatting?

Conditional Formatting Navigate to the "Home" option and select duplicate values in the toolbar. Next, navigate to Conditional Formatting in Excel Option. A new window will appear on the screen with options to select "Duplicate" and "Unique" values. You can compare the two columns with matching values or unique values.

How do I compare two columns in Power BI?

Create relationship between two tables based on index column, click Manage Relationships->New->Select index column in table1->Select index column in table2->One to One and Both direction->Make this relationship Active->Apply security filter in both directions.

How do you compare two columns and highlight matches?

Compare Two Columns and Highlight Matches.
Select the entire data set..
Click the Home tab..
In the Styles group, click on the 'Conditional Formatting' option..
Hover the cursor on the Highlight Cell Rules option..
Click on Duplicate Values..
In the Duplicate Values dialog box, make sure 'Duplicate' is selected..