Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - Compare column A in 2 worksheets and copy unmatched row to new sheet

Status
Not open for further replies.

Eprice

Technical User
May 6, 2003
209
US
Hello,
I am using Excel 2010. I have a workbook with two worksheets (AIS-BGI and NIPR-BGI). I need to compare the licence number in column A on both sheets. There is also data in other columns on both sheets that do not match but I want to compare column A. Any entire row from NIPR-BGI that does not have the same license number in AIS-BGI, I want to copy that entire row to another worksheet Unmatched-BGI. I can find code to copy only the value in column A but I need the whole row. Can anyone help with this? In orther words, if NIRP-LA does not have the same license number in AIS-BGI, both column A, then copy the entire row from NIPR-LA to Unmatched-BGI.
Thanks, Lisa
 
Hi,

I'd use MS Query, via Data > Get External Data > From Other Sources > From Microsoft Query...and drill down to your workbook, using the data on your two sheets as tables, do an outer join on the [licence number] to find the missing in one or the other. The resultset will be returned to a new sheet.

ALL tables must have a heading row in row 1 of unique values.
 
I wanted a vba function to do this as I have several states to do. If there is not one, I will just import the spreadsheets into Access and use a query to find unmatched license numbers. Thanks anyway tho.
 
That's like saying, "I'd like to use a knife to drive my screws." The knife might do the job but it's not the best choice.

The query can be done fairly quickly. Not so VBA.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top