# How to compare two Excel sheets and combine unique data?

May 2015

Comparing two Excel sheets and combining the unique data can be done with the help of macros. There are several macros available for free that can be downloaded from the internet and tweaked according to the requirements. Although the macros are not required to be written from scratch, some knowledge of programming concepts such as if -else- loops and nested loops can prove useful when writing macros for Excel office software. Redundant data can be removed from the Excel worksheets by using macros that can compare and combine unique data in Excel sheets.

# How to compare two Excel sheet and combine unique data?

## Issue

I have two Excel sheets, A and B. There is redundant data in both sheets as well as unique data.
All I want is to combine both with no redundant records. (A+B-Redundant= Uniq complete data).
I can't copy and paste and then filter 'uniq' because the total data is more than 68000, which is more than 65K rows per sheet.
I need help for using the IF(...) command...can you help?

## Solution

Without going into a lot of details, there are several ways to combine specific data from numerous sources of RAW DATA. The easiest way (once you understand how) would be to use Microsoft Access. Here you will need to use the 'help options' for the specific process; but what you will be doing is "mapping" two or more documents together which share 1 category of redundant information (i.e. NAME, PART NUMBER, etc.).

For example, if each the worksheet has a person's NAME, along with another column or information. you would map the NAME in each worksheet, then select the additional fields you want captured in your output. Besides the Access Help engine, you can repost your help request here under 'mapping & Linking).

If you want to stay in Excel, try using an Index Match statement.

=INDEX(SheetA!C:C,(MATCH(\$A2,SheetA!A:A,0)))

Type this formula in a blank cell within the row/entry you are comparing. This formula will look in SheetA through all data within column A. If data is matched to the identifier (\$A2), it will then copy the data entered in column C (number or text). #N/A is reported if no match is found.

SheetA

Part1 \$2 A xxx
Part2 \$3 B yyy
Part2 \$4 V zzz

Sheet B

Part1 50 MN type your formula
Part2 60 WI type your formula
Part2 70 MO type your formula

The cell with the formula will collect "A","B" and ,'V" from the first sheet.
Copy and change the formula to collect data from the columns you want (skip the redundant/superfluous ones).

For best results, lock in your 'identifier' cell (in this case \$A2)

To use a formula solution, data within sheets needs to be organized the same way because you are defining which 'columns' to match and pull information from.

## Note

Thanks to MCAL for this tip on the forum.