Solved

Compare 2 Excel-sheets

Posted on 2013-06-14
8
195 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 29

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 500 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

730 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