Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Comparing Workbooks.

Comparing Workbooks

by Allen Wyatt
(last updated July 7, 2015)

5

Krishna asked if there was a way to compare the contents of two Excel workbooks. Unfortunately, there is no built-in comparison feature, as there is in Word to compare two documents. There are third-party programs available that can help you out, and a quick search of the Web can help to locate such programs.

Depending on your needs, there can be an easier way. If the worksheets in each workbook are laid out the same, and you just want to find differences between values in the cells of each worksheet, then you can use formulas to compare worksheets. Try the following steps:

  1. Create a new workbook called Compare.xls.
  2. In cell A1 of the first worksheet in Compare.xls, enter the following formula:
    =IF([WB1.xls]Sheet1!A1<>[WB2.xls]Sheet1!A1,"Different","")
  • Copy the formula from A1 into all the other cells that represent the range you want to compare. For instance, if you want to compare A1:G12 in both worksheets, then you would copy the formula from A1 into the full range of A1:G12.
  • These steps assume that the worksheets you want to compare are both named Sheet1, and they are in WB1.xls and WB2.xls, respectively. If you have other sheets in WB1.xls and WB2.xls to compare, you can use similar formulas in other sheets of Compare.xls.

    When done, any cell that has the word "Different" in it represents a cell that is different in the ranges being compared. Thus, if C7 had "Different" in it, then there is a difference between the cell C7 of Sheet1 in WB1.xls and cell C7 of Sheet1 in WB2.xls.

    If you are comparing only numeric values between the two worksheets, you could use a different formula in step 2, above:

    =[WB1.xls]Sheet1!A1-[WB2.xls]Sheet1!A1
    

    The result is a worksheet that subtracts the values in one workbook from the other, which results in the numeric differences.

    ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2006) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Comparing Workbooks.

    Author Bio

    Allen Wyatt

    With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

    MORE FROM ALLEN

    Changing a Toolbar Button Image

    Excel allows you to modify virtually all aspects of its user interface. One of the things you can change is the images used ...

    Discover More

    Problems Saving as PDF

    When sharing documents with others, it's hard to beat the versatility and consistency of a PDF file. Word 2010 allows you to ...

    Discover More

    Referencing a Worksheet Name

    Excel provides ways to reference the column or row number of a cell, but it doesn't provide a built-in way to reference a ...

    Discover More

    Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

    MORE EXCELTIPS (MENU)

    Calculating Only the Active Workbook

    When you enter information into a workbook, Excel automatically recalculates every worksheet in every open workbook on your ...

    Discover More

    Tying Workbooks Together

    If you work with multiple workbooks at the same time, you might wonder how to tie them together so they open and close and ...

    Discover More

    Working With Multiple Workbooks

    Need to do work in more than one workbook at a time? For many, this ability is a necessity. Excel allows you to easily work ...

    Discover More
    Subscribe

    FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

    View most recent newsletter.

    Comments for this tip:

    If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

    What is 9 - 7?

    2016-11-11 02:45:00

    vivek

    this page was very helpful..thanq..


    2016-06-23 14:56:44

    Jay Grace

    This isn't working for me. Probably because there are spaces in the filename.


    2015-08-07 04:20:24

    Kumarapush

    Extending the above code which compares the values from 2 cells, the code in the below article compares all the data between 2 Excel Files and presents the results with a summary + Highlighted mismatched cells.

    officetricks. com /how-to-compare-two-excel-files/

    Hope this helps.


    2013-02-28 22:32:46

    sim

    You could use the excel function EXACT which compares values and strings.
    And there is something called Spreadsheet Compare in Microsoft Office Professional Plus 2013


    2012-11-29 09:40:22

    Joakim

    Hi!
    Thanks for the tip! Halfway with my sheet now! Only thing I would need is that instead of writing "Different" I would like to have the actual value. Now I have to go back and check both sheets to see what was different

    **J


    This Site

    Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

    Newest Tips
    Subscribe

    FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

    (Your e-mail address is not shared with anyone, ever.)

    View the most recent newsletter.

    Links and Sharing