You are here:

Excel/Compare 2 spreadsheets and highlight differences


Hi Bob,

I have been to 2 of the conferences that you put on with Damon.  I have your This isn't Excel it's Magic book, and I have searched the net trying to find my perfect solution (outside of an add on application which isn't an option at my office).  

I have a report of employees for March and April, in alphabetical order.  I am needing to compare the 2 reports and have it highlight all differences, preferably in a different spreadsheet.  

I found something on conditional formatting that at least highlights the differences, but it doesn't appear to be giving me the correct results (I would expect that the items highlighted in March as not on April would also be highlighted on April, not found in March).  I then looked for some VBA code and I found something that started to work, but because I could potentially have a new hire inserted into a row, the VBA code was highlighting everything after the new hire because they were now, no longer on the same row for comparison sake.

So I looked in your book, not there - so looked you up directly.

Here are the particulars:
April file
Range April =$A$2:$O$974

March file
Range March = =$A$2:$O$985

Tried conditional formatting with formula
For April =COUNTIF(March,A2)=0
For March =COUNTIF(April,A2)=0

Issues noted above.

VBA Code I found:
Sub RunCompare()

Call compareSheets("April", "March")

End Sub

Sub compareSheets(shtApril As String, shtMarch As String)

Dim mycell As Range
Dim mydiffs As Integer

'For each cell in April that is not the same in March, color it yellow
For Each mycell In ActiveWorkbook.Worksheets(shtApril).UsedRange
   If Not mycell.Value = ActiveWorkbook.Worksheets(shtMarch).Cells(mycell.Row, mycell.Column).Value Then
       mycell.Interior.Color = vbYellow
       mydiffs = mydiffs + 1
   End If

'Display a message box to demonstrate the differences
MsgBox mydiffs & " differences found", vbInformation


Issue:  noted above

Basically I need to tell the reader of the report what employee had changes from one month to the next, and then what fields were changed. Again preferably on a separate report with just the changes.

Would you be able to help?  
Looking forward to a favorable response.

I can help (thanks for finding me!) but it'd help ME if I could see an actual workbook - please send a sample to me at, use subject of "AllExpersQ" and repeat what needs doing.
Also, note that there'll be another User conference Sept 25-27 in Las Vegas. If interested, let me know!
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Bob Umlas


I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at


Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Excellence, The Expert, Microsoft

BA in math, Hofstra University, 1965

Awards and Honors
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks

©2016 All rights reserved.