Compare Lists and Add Missing Items

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
Hi,

Is there a way I can compare the items in Column B to those in Column A. Then any item in Column A that's not in Column B would be added to the next available row in Column B.

Thanks!
 
Perfect, THANK YOU!!!

I changed this part of the code to .Item(Cl.Value).Clear because i have items under the list which would get messed up with the moving the deleted rows up.
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Glad to help & thanks for the feedback
 
Upvote 0
Can i bother you one last time to help with code that would not only clear the cell in column A, but also those through Column D. So that if A5 is cleared, B5:D5 are also cleared.
I don't know if there is a way to copy and past items to move up so there are no blank spaces. My range for the list would be A5:D30.
 
Upvote 0
This will clear A:D
Code:
.Item(cl.Value).Resize(, 4).Clear
 
Upvote 0
I tried tried to get creative with this by changing it to .Item(C1.Value).Selection.SpecialCells(xlCellTypeConstants, 4).ClearContents because I have formula in one of the columns. Didn't work.
 
Upvote 0
I finally figure out that out. But i'm struggling with trying to copy the duplicates to sheet 3. I tried the code below but that didn't work. I would be running this code mutliple times so if i could get it to copy to next available row would be great. Playing with a bunch of different codes, at some point this stuff will make sense to me.

.Item(C1.Value).Resize(, 4).Copy
worksheets("sheet3").Range("A5").paste
 
Upvote 0
As this is a completely different question, you'll need to start a new thread.
 
Upvote 0
@Fluff How do I lookup an item on 2 lists with out the ws3 overriding the ws2 inputs? basically changing it so that if it cant find the item from ws1 in ws2, then look in ws3.
Code:
With CreateObject("scripting.dictionary")      
.CompareMode = 1
        For Each Cl In ws2.Range("E45", ws2.Range("E" & Rows.Count).End(xlUp))
         .Item(Cl.Value) = Cl.Offset(, 2).Value
        Next Cl
        For Each Cl In ws1.Range("A11", ws1.Range("A" & Rows.Count).End(xlUp))
         Cl.Offset(, 1).Value = .Item(Cl.Value)
         Next Cl
        For Each Cl In ws3.Range("E45", ws3.Range("E" & Rows.Count).End(xlUp))
         .Item(Cl.Value) = Cl.Offset(, 2).Value
        Next Cl
        For Each Cl In ws1.Range("A11", ws1.Range("A" & Rows.Count).End(xlUp))
         Cl.Offset(, 1).Value = .Item(Cl.Value)
        Next Cl
End With
 
Last edited:
Upvote 0
As I said before, this is a totally different question, so you will need to start a new thread.
 
Upvote 0
@Fluff I use this code a lot, it's so handy. I have noticed that it won't recognize that values are the same if one is all caps. So it sees "Apple" and "APPLE" as different. Is there a way to "fix" this?
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top