How to Compare Text in Microsoft Excel

In this article, we will focus on how to compare strings of two cells in excel to find out the unique entries out of both the columns. There are many times we are working with thousand rows of data in excel & found ourselves stuck when we try to manually compare two lists of data. We will use Conditional formatting with COUNTIF formula as well as simple tricks to rescue us.

 

Question: I would like to compare two columns of data & highlight unique values from each column.

This example describes how to compare two lists using conditional formatting. For example, you can have top six lists of IPL teams.

Following is the snapshot of sample data:

 

img1

 

To compare the list of two columns, we will follow the below steps:

  • Firstly, select the range A1:A6 and name it as “FirstList”, select the range B1:B6 and name it as “SecondList”

 

img2

 

img3

 

  • Next, select the range A1:A6 i.e. “FirstList”
  • Press “Alt + O + D” shortcut keys
  • Alternatively, on the Home tab, click Conditional Formatting

 

img4

 

  • Click on New Rule

 

img5

 

  • Select "Use a formula to determine which cells to format"

 

img6

 

  • Enter the formula =COUNTIF(SecondList,A1)=0

 

img7

 

  • Click on Format > select the color of your choice

 

img8

 

  • Click on ok

 

img9

 

  • Click on “Stop If True” checkbox & then click on ok button
  • Following will be the result

 

img10

 

Hence, Delhi Daredevils and Royal Challengers Bangalore are not in the second list.

  • To highlight the teams in the SecondList that are not in the FirstList, we will use the formula
  • =COUNTIF(FirstList,B1)=0

 

img11

 

  • Here, COUNTIF formula “=COUNTIF(SecondList,A1” counts the number of teams in the secondlist that are equal to team in cell A1
  • If COUNTIF(SecondList,A1) = 0 then team in cell A1 is not listed in the second list
  • In the end, conditional formatting highlights the unique team name which is not present in the second list

 

Second Way to compare lists

 

  • Let us make a copy of Sheet1 & clear all the conditional formatting rules
  • From Home tab, select Conditional Formatting & click on Duplicate Values

 

img12

 

  • Select Unique

 

img13

 

 

Conclusion: We can compare different sets of data on a daily basis using conditional formatting in excel.

 

For more example refer below link:

How to compare two columns through Conditional Formatting

 

image 29

If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook.
We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at info@exceltip.com

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.