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

Comparing Workbooks

Written by Allen Wyatt (last updated August 10, 2023)
This tip applies to Excel 2007 and 2010


21

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.xlsx.
  2. In cell A1 of the first worksheet in Compare.xlsx, enter the following formula:
    =IF([WB1.xlsx]Sheet1!A1<>[WB2.xlsx]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.xlsx and WB2.xlsx, respectively. If you have other sheets in WB1.xlsx and WB2.xlsx to compare, you can use similar formulas in other sheets of Compare.xlsx.

    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.xlsx and cell C7 of Sheet1 in WB2.xlsx.

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

    =[WB1.xlsx]Sheet1!A1-[WB2.xlsx]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 (11211) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel 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

    Where Do You Want Your Endnotes?

    Endnotes can be placed in a couple of different places in your document, not just at the very end. Here's how you can ...

    Discover More

    Accurately Setting Tabs Using the Ruler

    If you try to set tabs by clicking on the Ruler, you may not be able to set them exactly where you want. This is normally ...

    Discover More

    Automatically Moving from Cell to Cell when Entering Data

    As you enter data in a worksheet, you may want to have Excel automatically move from cell to cell based on the length of ...

    Discover More

    Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

    More ExcelTips (ribbon)

    Remembering Workbook Settings from Session to Session

    You can spend a lot of time getting your workbook to look "just right." Wouldn't it be great if Excel was able to ...

    Discover More

    Noting the Workbook Creation Date

    You may want to add, to your worksheet, the date on which a particular workbook was created. Excel doesn't provide a way ...

    Discover More

    Accessing a Problem Shared Workbook

    What are you to do is you share a workbook with others, and then suddenly the workbook won't open properly? Dealing with ...

    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

    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}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. 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 two more than 7?

    2023-01-14 19:38:50

    C. A. M.

    This tip works! Tips from other sources did not until I amended those tips using what you shred in this post. Specifically, I wanted to see the difference in cell contents actually displayed. E.g. if for instance cell A1 in WB1 contains the word "dog" and cell A1 in WB2 contains the word "cat", I wanted to get a result that specifically stated that [WB1]Sheet1!A1 contains "dog" and [WB2]Sheet1!A1 contains "cat". Other sources suggested using "vs" but their formulae did not work. I amended one formula and followed your instructions above (amended formula used: =IF([WB1]Sheet1!A1 <> [WB2]Sheet1!A1, "[WB1]Sheet1:"&[WB1]Sheet1!A1&" vs [WB2]Sheet1:"&[WB2]Sheet1!A1, "") and saw success. Your very specific instructions in this article (including the need to use a new workbook) produced the result that I desired (result obtained: [WB1.xlsx]Sheet1:dog vs [WB2.xlsx]Sheet2:cat). Thank you! Keep up the excellent work. Best Regards C. A. M. (Jamaica)


    2022-11-04 08:50:25

    Kiwerry

    @ J. Woolley: Thank you for the links; I found the first one later yesterday and will try them.


    2022-11-03 15:47:25

    J. Woolley

    @Kiwerry
    Also, see https://sourceforge.net/projects/spreadshcompare/


    2022-11-03 15:38:35

    J. Woolley

    @Kiwerry
    See https://www.ablebits.com/office-addins-blog/compare-two-excel-files-sheets/


    2022-11-02 15:04:26

    Kiwerry

    My attempt to activate the inquire com addin mentioned by Michael Hodgkinson failed because I don't have s high enough version of Excel - I have Office 365 family at 99€/year. My search brought up the following information: "This is only available in the Professional Plus editions (Office 2013/2016/2019/2021) and Office 365 Enterprise." Yay.

    Any hints on sourcing an affordable version which has this addin would be gratefully received - or is there a site where on can purchase the addin?


    2019-07-17 06:27:02

    Mike H

    Hi Jake. True - apologies hadn't spotted for 2007 and 2010 only. I am on 2013 / 2016.

    Just to mention October next year 2020 Office 2010 will not longer be supported so maybe time to go O365 / 2016.

    Best Regards

    Mike H


    2019-07-09 15:24:13

    Jake

    Mike Hodkinson, what version of excel are you using. This tip is for 2007 and 2010. I think you are in a newer version. Excel is changing rapidly with the advancements from version to version. With that being said thank you for sharing when I get to the newer version I will be all over that.


    2019-07-05 06:04:17

    Michael Hodkinson

    All

    A fairly recent new addition to Excel has been the not too well publicised "Inquire" COM Add-In and one of it's key features is "Compare Files".

    Quote: "The Compare Files command lets you see the differences, cell by cell, between two workbooks. You need to have two workbooks open in Excel to run this command.

    Results are color coded by the kind of content, such as entered values, formulas, named ranges, and formats. There's even a window that can show VBA code changes line by line. Differences between cells are shown in an easy to read grid layout."

    How about using this as it provides a far more in depth and accurate report on the exact differences even in VBA code.

    To activate go to your Developer Tab and click on COM Add-Ins icon and Inquire should be listed here tick this and a new menu option will appear. If not you will have to go to Add-Ins within File -Options and add it firstly there.

    Hope you find this of interest and assistance.

    Mike H


    2018-07-11 08:44:08

    Nancy

    Good Morning,

    This Tip came just on the right day! I just today had to compare two workbooks and it worked perfectly.

    Thanks for the Tip.


    2016-06-25 11:01:18

    marta

    I am having a hard time make this formula work - I am trying to compare text, not just numeric values.
    I have tried to re-write the formula using the appropriate workbook, and worksheet names, and also trying to copy the formula into relative cells, but it doesn't seem to be working...any hints?


    2015-09-24 10:10:30

    Kossem

    Hello.
    To Michael, I would slightly reformulate it as:

    = IF( '[WB1.xlsx]Sheet1'!A1 = '[WB2.xlsx]Sheet1'!A1,
    "", "R" & ROW() & " C" & COLUMN() &
    "S1= " & [WB1.xlsx]Sheet1!A1 &
    "S2= " & [WB2.xlsx]Sheet1!A1 &
    IF( AND( ISNUMBER([WB1.xlsx]Sheet1!A1), ISNUMBER([WB2.xlsx]Sheet1!A1) ),
    " (∆= " & [WB1.xlsx]Sheet1!A1 - [WB2.xlsx]Sheet1!A1 & ")", "" ) )

    To Thiago:
    For example, on cell A1 of your worksheet, go to Conditional Formatting > New rule > Use a formula (...), type in:
    = NOT( A1 = '[WB2.xslx]Sheet1'!A1 )
    and choose a format.
    Then extend this conditional format to all cells of interest via Conditional Formatting > Manage rules.


    2015-09-04 00:03:37

    Thiago

    It's amazing the help you all provided.

    Would that be possible to have a formula where doing the comparison instead of showing True or Different etc it would show what has been changed?

    Let's say Cell A3 was Bathroom and someone changed to Bedroom

    Would be possible to have a formula showing what has been changed and what for?

    How about a hidden formula on the original document that could be sent to the client and if he/she makes any changes it would simply create a copy of the actual spreadsheet as Sheet 2 for example with the changes in RED?

    Would you believe it would be possible?

    Thank you so much


    2015-01-08 13:06:28

    Peter

    Thank you Michael and Glenn! I've never used the symbols in formulas, but it certainly adds flair to the result.


    2015-01-08 08:38:33

    Glenn Case

    Peter:

    To insert symbols such as ∆, go to the Insert Tab and select Symbol from the Symbols tab. The available symbols will change depending on which font set you have selected.


    2015-01-07 05:37:40

    Michael

    Peter, just copy it to the clipboard from the character map application


    2015-01-06 16:09:12

    Barry

    ... or, to meet Michael's goals below with a simplified formula, just replace "Different" in Allen's formula with:

    [WB1.xlsx]Sheet1!A1&"<>"&[WB2.xlsx]Sheet1!A1

    to get a non-cluttered worksheet with only the pertinent information. You can use FIND to find the <> if you have a large spreadsheet.


    2015-01-06 12:18:45

    Peter

    Michael,
    How do you get the Delta symbol into your formula?


    2015-01-06 10:54:19

    Michael

    If comparing two spreadsheets, knowing the difference would only be the 1st step. Then you would probably need to know the values in both.

    To prevent having to toggle back and forth between the two sheets, we could modify the formula to something like (with embedded carriage returns, word-wrap turned on, and row height set to 45 to accommodate 3 rows per cell):

    =IF([WB1.xlsx]Sheet1!A1=[WB2.xlsx]Sheet1!A1,
    "",
    IF(AND(ISNUMBER([WB1.xlsx]Sheet1!A1),ISNUMBER([WB2.xlsx]Sheet1!A1)),
    "R "&ROW()&" C "&COLUMN()&"
    1= "&[WB1.xlsx]Sheet1!A1&"
    2= "&[WB2.xlsx]Sheet1!A1&" (∆= "&[WB1.xlsx]Sheet1!A1-[WB2.xlsx]Sheet1!A1&")",
    "R "&ROW()&" C "&COLUMN()&"
    1= "&[WB1.xlsx]Sheet1!A1&"
    2= "&[WB2.xlsx]Sheet1!A1))

    For non-numeric fields, it would yield a result of:

    R 3 C 1
    1= A22334
    2= B22334

    For numeric fields, it would yield a result of:

    R 4 C 3
    1= 3.1
    2= 3.3 (∆= -0.2)


    2015-01-06 07:45:53

    Norm

    @Gary, sorry I should have finished reading your email, I do see that you added another step to hi-light the False results, still an added step however.


    2015-01-06 07:43:38

    Norm

    @Gary, your formula certainly would work too, but wouldn't you end up having to sort thru a sheet full of True & False, rather than just seeing the word different here and there?


    2012-02-11 09:37:23

    Gary Schirmer

    An easier formula would be:
    =[WB1.xlsx]Sheet1!A1=[WB2.xlsx]Sheet1!A1

    This results in TRUE or FALSE based on values being equal or not. Then use conditional formatting to highlight the FALSE results... Also easily created using point and click, you just have to change the Absolute to Relative before copying cells in the COMPARE workbook...


    This Site

    Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.