How to Compare two list and add missing information from List A to List B

Status
Not open for further replies.

jirpel

New Member
Joined
Jan 28, 2019
Messages
9
Looking for a little help. I need a way to compare a list on one sheet (A), Column A; with a list of values on another sheet (COMPARE), Column A.

If the value is missing from the list on Sheet (COMPARE), it copies the value to the bottom of the list on Sheet (A) along with the values of the two adjacent columns on Sheet (COMPARE).

I have found a VBA that will do the comparison and add the missing value to the end of the list but I do not know how to copy the adjacent column data over. I am by far not a VBA expert. My VBA code is below. Thanks in advance.

Sub x()


Dim r1 As Excel.Range
Dim r2 As Excel.Range
Dim r3 As Excel.Range
Dim c As Excel.Range

Dim x As Date

Set r1 = Range("A1").Resize(Range("A" & Rows.Count).End(xlUp).Row)
Set r2 = Worksheets("Compare").Range("A2").Resize(Worksheets("Compare").Range("A" & Rows.Count).End(xlUp).Row)

x = Now

For Each c In r2

Set r3 = r1.Find(What:=c.Value, MatchCase:=False, Lookat:=xlWhole)

If r3 Is Nothing Then

Range("A" & Rows.Count).End(xlUp).Offset(1).Value = c.Value

End If
Next

Debug.Print DateDiff("s", x, Now)

End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Duplicate https://www.mrexcel.com/forum/excel...list-add-missing-information-list-list-b.html

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).

Note that sometimes posts from new users require Moderator approval before you can see them on the public forums. When this happens, you should see a message to that effect when you try to post it.
Please be patient and do not attempt to post the question again.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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