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:




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”






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




  • Click on New Rule




  • Select “Use a formula to determine which cells to format”




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




  • Click on Format > select the color of your choice




  • Click on ok




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




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




  • 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




  • Select Unique





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

Leave a Reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>