Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 133
Default Comparing two columns of data

I am trying to compare two colomuns of data and produce a report showing the
differences. So far non of the formulas will work for what I need and I am
attempting to do some VBA coding to make looping test that can preform this.
Does any one have any suggestions as to how best accomplish my task.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,389
Default Comparing two columns of data

Try this (assuming your columns are A and B):
=countif(a:a,b1)

If there are no duplicates, the result will be zero. You can filter on the
non-zeros to show only the duplicates.

Regards,
Fred

"Wayne" wrote in message
...
I am trying to compare two colomuns of data and produce a report showing
the
differences. So far non of the formulas will work for what I need and I
am
attempting to do some VBA coding to make looping test that can preform
this.
Does any one have any suggestions as to how best accomplish my task.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Comparing two columns of data

Say we have data in A1 thru B20:

73 15
92 29
72 39
75 37
61 32
6 84
63 54
47 80
1 67
90 21
49 93
44 61
21 18
18 94
43 56
67 76
76 19
97 45
87 51
71 33

The following macro loops thru both columns looking for non-matches:

Sub ListMisMatches()
Set ra = Range("A1:A20")
Set rb = Range("B1:B20")
k = 1
For i = 1 To 20
v = Cells(i, 1).Value
If Application.WorksheetFunction.CountIf(rb, v) = 0 Then
Cells(k, "C").Value = "cell A" & i & " contains " & v & " not in
column B"
k = k + 1
End If
Next

For i = 1 To 20
v = Cells(i, 2).Value
If Application.WorksheetFunction.CountIf(ra, v) = 0 Then
Cells(k, "C").Value = "cell B" & i & " contains " & v & " not in
column A"
k = k + 1
End If
Next

End Sub

and the result in column C:

cell A1 contains 73 not in column B
cell A2 contains 92 not in column B
cell A3 contains 72 not in column B
cell A4 contains 75 not in column B
cell A6 contains 6 not in column B
cell A7 contains 63 not in column B
cell A8 contains 47 not in column B
cell A9 contains 1 not in column B
cell A10 contains 90 not in column B
cell A11 contains 49 not in column B
cell A12 contains 44 not in column B
cell A15 contains 43 not in column B
cell A18 contains 97 not in column B
cell A19 contains 87 not in column B
cell A20 contains 71 not in column B
cell B1 contains 15 not in column A
cell B2 contains 29 not in column A
cell B3 contains 39 not in column A
cell B4 contains 37 not in column A
cell B5 contains 32 not in column A
cell B6 contains 84 not in column A
cell B7 contains 54 not in column A
cell B8 contains 80 not in column A
cell B11 contains 93 not in column A
cell B14 contains 94 not in column A
cell B15 contains 56 not in column A
cell B17 contains 19 not in column A
cell B18 contains 45 not in column A
cell B19 contains 51 not in column A
cell B20 contains 33 not in column A

--
Gary''s Student - gsnu200825


"Wayne" wrote:

I am trying to compare two colomuns of data and produce a report showing the
differences. So far non of the formulas will work for what I need and I am
attempting to do some VBA coding to make looping test that can preform this.
Does any one have any suggestions as to how best accomplish my task.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing data in two columns Norm Excel Worksheet Functions 1 June 10th 08 03:10 PM
Comparing data in columns Nick Excel Discussion (Misc queries) 6 August 30th 07 06:37 PM
Comparing 2 columns of data adrianh33 New Users to Excel 1 April 5th 06 06:19 PM
Comparing Data in 2 columns suzb Excel Worksheet Functions 2 January 6th 05 02:39 AM
Comparing Data in two columns Marianne Excel Worksheet Functions 3 November 5th 04 10:26 PM


All times are GMT +1. The time now is 10:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"