bottom
Great ExcelTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > ExcelTips Home > Tools > Comparing Workbooks

Comparing Workbooks

Summary: Do you need to compare two workbooks to each other? While you can use specialized third-party software to do the comparisons, a simple formula or two might be all that you really need. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)

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.

    Tip #2006 applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007


    Got the Time? Understanding the ins and outs of working with times and dates can be confusing. Remove the confusion--ExcelTips: Times and Dates is an invaluable resource for learning how best to work with times and dates.
     
    Check out ExcelTips: Times and Dates today!

    Helpful Links

    Ask an Excel Question
    Make a Comment

    Tips.Net Home

    ExcelTips FAQ
    ExcelTips Premium

    Learn Access Now

    Bugs and Pests Tips
    ExcelTips
    Family Tips
    Health Tips
    Home Tips
    Organizing Tips
    WordTips

    Advertise on the
    ExcelTips Site

     

    Great Info!

    Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
         
    (Your e-mail address will never be shared with anyone, ever.)