?
Solved

Compare 2 Excel-sheets

Posted on 2013-06-14
8
Medium Priority
?
233 Views
Last Modified: 2013-06-20
Hi,

I'd need to compare the content of 2 Excels.
Both of them contain a list of servers.

Excel1: the servername column is "hostname" (no filter needed there).
Excel2: I filtered out Linux-servers (which I don't need) in Excel1, the column of servers there is named "Name"

How can I compare both sheets and have an overview of which servers are in sheet 1 but not in sheet 2?

In other words, f.e. is server1 in excel1 also there in excel2, is server22 in excel1 also there in excel2 etc.

J.
0
Comment
Question by:janhoedt
8 Comments
 
LVL 31

Expert Comment

by:gowflow
ID: 39248231
several questions

1) 2 Excel means 2 workbook ? or 2 sheets in 1 workbook ?
2) The best thing we can do is use colors we can agree say Yellow in Sheet1 for any item would mean this items does not exist in sheet2 and Green in Sheet2 on any item would mean the item does not exist in sheet1 or anything else you may think that would help your search and basis this we can then develop the vba

The best would be for you to just attach and sample workbook
gowflow
0
 
LVL 5

Expert Comment

by:DOSLover
ID: 39248277
A simple VLOOKUP function can help in this situation. Assuming Sheet1 has 'hostname's in 'A' column, and Sheet2 has 'Names' in column A, we can use the following function in Cell B2. Then formula can be copied all remaining cells of Sheet1 Column B. It searches Sheet2 for value contained in A2, and returns a value of 'TRUE' or 'FALSE'.  
=VLOOKUP(A2,Sheet2!A:A,1)=A2

Open in new window

0
 

Author Comment

by:janhoedt
ID: 39248621
Thanks, I m not in the office now. Will check Monday and update this entry!
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:janhoedt
ID: 39252400
In att. the file, please advise.
Note: values in sheet 2 might also not exist in sheet 1 and should be visible in the comparsion.

Note: cannot make vlookup work ....
Comparison.xlsx
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 39257555
>How can I compare both sheets and have an overview of which servers are in sheet 1 but not in sheet 2?

One way I know to locate something in a list is to add an adjacent column and use a MATCH.

Assuming that column B of sheet "Sharepoint" has the server "Hostname"s to match in "New-Program-Export"'s column A (Name) then you'll need a column in each to compare against the other.

On the first sheet, put  something like this:
=MATCH(B2,'New-Program-Export'!A:A,0)

Open in new window

On the second sheet, put something like this:
=MATCH(A2,Sharepoint!B:B,0)

Open in new window

Anything that shows #N/A does not have a matching item.
Anything with a number is the row (when using the specified formula) where a match was found.
0
 
LVL 5

Accepted Solution

by:
DOSLover earned 2000 total points
ID: 39258256
I am re-attaching the spreadsheet after putting in the formulas in 'Comparison' sheet. I am comparing 'Hosts' column of SharePoint sheet to values of 'Name' column of 'New-Program-Export'. Also please note that I also added a new row for 'PHIWIN044' in 'New-Program-Export' so that at least one value matches in your sample sheet.
The formula uses 'VLOOKUP', IF and ISNA functions.
EE-Comparison.xlsx
0
 

Author Comment

by:janhoedt
ID: 39258675
Thanks! Works great! Can you explain me the forumla step by step?
I understand the VLOOKUP, then the range  A:A but then 1 and false? And what about ISNA, where does it stand for?
0
 
LVL 5

Expert Comment

by:DOSLover
ID: 39259887
I am glad it works for you.
You have the VLOOKUP part right - it checks a value of Cell A2 of SharePoint to see if it exists in cell-range A:A of New-Program-Export sheet. Option '1' tells to get value from the 1st column if a match is found. Since we are using only one column range (A:A), it picks up from the same column. Option 'FALSE' tells it NOT to use an approximate match - that is it should find an exact match.
Next, say, if match is not found, VLOOKUP returns a value of #N/A. The 'ISNA' function checks if VLOOKUP is returning '#N/A'. I am using a IF condition to see if ISNA is true, then 'NOTFound', else a value was 'Found'.
I hope that helps.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question