LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Compare List A to List B, Return List B Items Not in List A

I've searched on the forum and found ways to list duplicate items and
unique items, but this is for a combination of two lists, not
"bumping" one list against another. In this case, I need to compare
List A to List B and return those items in List B that are not in List
A. I scavenged and tweaked some code, but it is trying to do a cell-to-
cell comparison - this won't work as items can be in different
locations within the lists. Thoughts?

Sub ListDuplicateVal()

Dim Rng1 As Range
Dim Rng2 As Range
Dim Rng3 As Range
Dim Cell As Range

Set Rng1 = Range("A1:A13") 'long list
Set Rng2 = Range("B1:B13") 'short list
Set Rng3 = Range("D1") 'output
On Error Resume Next

For Each Cell In Rng2

If Rng2.Cell.Value < Rng1.Cell.Value Then
Rng3.Value = Cell.Value
Set Rng3 = Rng3.Offset(1, 0)
End If

Next Cell
End Sub
 
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
Data validation list - list doesn't show items from top Pwinkle Excel Discussion (Misc queries) 0 June 23rd 09 07:56 PM
List and subtotal selected items, then print separate item list TitanG Excel Worksheet Functions 0 September 8th 08 09:07 PM
Matching items in 2 list to consolidate to one list hot dogs Excel Discussion (Misc queries) 2 April 25th 07 04:01 PM
How to count and group items in a list depending on size of list? Simon Lloyd[_859_] Excel Programming 3 August 13th 06 12:18 AM
How to count items in a list and group depending on size of list? Simon Lloyd[_712_] Excel Programming 5 April 28th 06 12:14 AM


All times are GMT +1. The time now is 02:02 PM.

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"