Match up emails with names

In column A are names and in column B I have emails. I then removed all of the emails that are present in my unsubscribe list. Now I have about 1K less emails. I want to now match the name with the final list of emails. Anyway to do that using an Excel formula or Macro?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think you are going to have to either supply an example (using bogus names and email addresses) or explain better.

Names in A and matching email addresses in B.
You delete the email addresses you don't want to keep.
Did you select the whole rows and use the "delete Row" option?
If so, the email addresses should still be adjacent to the matching names.
COwebmasterAuthor Commented:
Okay attached is a sample file. In column A are the individual names and in column B is their email. In column C I put in my list of emails of all my unsubscribes. Column D outputs my new list of emails. I need the names in column A associated with the emails in column D.

The macros you see in the file makes the emails in column B and in column C all lowercase which are the first steps I do. I then click on the other macro to output the new list. It would be nice that the same macro button would display the name alongside each email in column D perhaps in column E.

Thanks for your help with this.
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
I have tweaked the macro called GetEmailList so that when you click the button called "Create Email List", it will populate the column D with Emails and column E with their corresponding names.

Sub GetEmailList()
Dim lr As Long
Dim x, y
Dim dict1 As Object, dict2 As Object
lr = Cells(Rows.Count, 1).End(xlUp).Row
x = Range("A2:B" & lr).Value
lr = Cells(Rows.Count, 2).End(xlUp).Row
y = Range("C2:C" & lr).Value

Set dict1 = CreateObject("Scripting.Dictionary")
Set dict2 = CreateObject("Scripting.Dictionary")

lr = Cells(Rows.Count, 3).End(xlUp).Row
If lr > 1 Then Range("D2:E" & lr).Clear
With dict1
   For i = 1 To UBound(y, 1)
      .Item(y(i, 1)) = ""
   Next i
End With

With dict1
   For i = 1 To UBound(x, 1)
      If Not .exists(x(i, 2)) Then
         dict2.Item(x(i, 2)) = x(i, 1)
      End If
   Next i
End With
Range("D2").Resize(dict2.Count).Value = Application.Transpose(dict2.keys)
Range("E2").Resize(dict2.Count).Value = Application.Transpose(dict2.items)
Range("E1").Value = "Name"
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
COwebmasterAuthor Commented:
Thanks Subodh, it worked great!
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome! Glad it worked as desired.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.