Computing.Net > Forums > Office Software > Excel - Compare columns for differe

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Excel - Compare columns for differe

Reply to Message Icon

Name: BMAC
Date: November 29, 2008 at 10:52:34 Pacific
OS: Windows XP SP2
CPU/Ram: Intel Core 2 1.8 GHz/4 GB
Product: Dell OptiPlex
Comment:

Hello,
Hopefully this is an easy one for someone. I have two columns of alphanumeric data that I want to compare. The data in each column is a list of computer names. I want to know what computers names in column A are NOT in colmun B. The output can be either in column C or in a seperate worksheet. Thanks in advance for any help you can give!

Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: December 1, 2008 at 05:51:32 Pacific
Reply:

Here are a couple of options. The VBA code will place the missing computer names in C1, C2, etc.

The formula will put the missing names in column C, but in the same row as the existing entry in column A.

Obviously you'll need to change the ranges to fit your sheets.


Sub CompareCols()
For Each cpu In Range("A1:A7")
With Range("B1:B7")
Set c = .Find(cpu, LookIn:=xlValues, LookAt:=xlWhole)
If c Is Nothing Then
myRow = myRow + 1
Range("C" & myRow) = cpu
End If
End With
Next
End Sub

This is an array formula, which must be entered using Ctrl-Shift-Enter - do not type the brackets. Enter the formula in C1, hit Ctrl-Shift-Enter and drag down to bottom of the data in column A.

{=IF(AND(A1<>$B$1:$B$7),A1,"")}

After the values are in column C, you could do an Edit/Paste Special-Values, then sort.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Excel - Compare columns for differe

Highlight Excel Cell by Selecting Different C www.computing.net/answers/office/highlight-excel-cell-by-selecting-different-c/8613.html

Excel Formula Help for Bill Trackin www.computing.net/answers/office/excel-formula-help-for-bill-trackin/4665.html

sorting merged cells www.computing.net/answers/office/sorting-merged-cells/9651.html