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

    Relative References within Named Ranges

    Excel is usually more flexible in what you can reference in formulas than is immediately apparent. This tip examines some ...

    Discover More

    Requiring Input

    If you distribute a workbook that is used by others for data entry, you may want a way to make sure they fill in certain ...

    Discover More

    Can't Access the Registry

    Many Windows applications rely on information stored in the Registry. If that information cannot be accessed, the application ...

    Discover More

    Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

    More ExcelTips (ribbon)

    Noting When a Workbook was Changed

    Do you need to know when a workbook was last changed? There are a couple of ways you can go about keeping track of the change ...

    Discover More

    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 remember ...

    Discover More

    Creating Individual Workbooks

    Workbooks can contain many worksheets. If you want to pull a workbook apart and create a whole series of workbooks based on ...

    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 8Mpixels. 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 three more than 5?

    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.