Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ali ali is offline
external usenet poster
 
Posts: 1
Default 2 lists of values - identify differences?

Hey everyone,

I've developed a delightful little macro but have just one littl
problem with it.

The output is a checklist which contains to lists of values in column
and B respectively. The two lists should contain the same value
however small differences can sometimes exist. I would like a macro t
recognise where these differences occur - is this possible.

An example of what imean -

List A List B
(Col A) (Col B)

1 1
2 2
3 4
4 5
6 6

Can i get a macro to report that value 5 is missing from list A but i
list B, and that value 3 is missing from list B but in list A?

Can the result be reported in column D?

Many many thanks for any help :-

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 2 lists of values - identify differences?

Sub CompColumns()
Dim rngA As Range, RngB As Range, Cell As Range
Dim rw As Long
Set rngA = Range(Cells(1, 1), Cells(1, 1).End(xlDown))
Set RngB = Range(Cells(1, 2), Cells(1, 2).End(xlDown))
Cells(1, 4).Value = "In A, not B"
rw = 2
For Each Cell In rngA
If Application.CountIf(RngB, Cell.Value) = 0 Then
Cells(rw, 4).Value = Cell.Value
rw = rw + 1
End If
Next
Cells(rw, 4).Value = "In B, not A"
rw = rw + 1
For Each Cell In RngB
If Application.CountIf(rngA, Cell.Value) = 0 Then
Cells(rw, 4).Value = Cell.Value
rw = rw + 1
End If
Next
End Sub



--
Regards,
Tom Ogilvy



ali wrote in message
...
Hey everyone,

I've developed a delightful little macro but have just one little
problem with it.

The output is a checklist which contains to lists of values in column A
and B respectively. The two lists should contain the same values
however small differences can sometimes exist. I would like a macro to
recognise where these differences occur - is this possible.

An example of what imean -

List A List B
(Col A) (Col B)

1 1
2 2
3 4
4 5
6 6

Can i get a macro to report that value 5 is missing from list A but in
list B, and that value 3 is missing from list B but in list A?

Can the result be reported in column D?

Many many thanks for any help :-)


---
Message posted from http://www.ExcelForum.com/



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
Identify Differences Between four columns of data Tickfarmer Excel Discussion (Misc queries) 1 April 22nd 10 03:02 PM
Highlighting the differences between lists 2 corbett Excel Discussion (Misc queries) 3 May 5th 09 04:32 PM
Highlighting the differences between lists. corbett Excel Discussion (Misc queries) 4 May 2nd 09 01:26 PM
Conditional Formating CF (to identify case/strikethro differences) Ron@Buy Excel Worksheet Functions 3 October 26th 07 06:11 PM
How can I differences in two Excel Workbook lists automaticall DeeKayT Excel Discussion (Misc queries) 7 November 6th 06 09:53 PM


All times are GMT +1. The time now is 06:38 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"