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

by Allen Wyatt
(last updated May 2, 2016)

12

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

    Changing the Footnote Separator

    When you print a document that uses footnotes, Word normally places a small line between the end of the document body text ...

    Discover More

    Don't Allow Empty Cells

    Data Validation is a great way to limit what a user can enter into a worksheet cell. It may not stop a cell from being left ...

    Discover More

    Counting Only Money Winners

    If a series of cells contain the amount of money won by individuals, you may want to count the number of individuals who ...

    Discover More

    Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

    More ExcelTips (ribbon)

    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

    Seeing All Open Workbook Names

    Ever want to see a list of all the workbooks that are open? If you open more than nine, Excel only displays the first nine ...

    Discover More

    Workbook not Saving

    Having trouble saving a workbook? It could have to do with the age, size, and complexity of that workbook. This tip offers ...

    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}] 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 4?

    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.