Create new Excel Worksheet from the common values of one Column.

I would like to take two worksheets (tabs) and create a new third tab.
The code would create the 3rd tab by matching on the common values in the column named "PrimarySmtpAddress".

I have attached a sample file. I saved it as an .xlsx but it can be renamed as a .csv obviously.
Note: the SamAccountName is typically a number at this company but it can also be alphanumeric.

The sample is only 20 rows of data however both tabs will actually have just under 400,000 rows of data when I use the code against it.

I have attached several screenshots and a sample file.

Thank you for your time in advance!


Tab named "wSamAccountName"Tab named "wLastLogonTime"Example of desired results.EE-Sample-Combine-2Tabs-by-Common-Column
K BAsked:
Who is Participating?
Rob HensonFinance AnalystCommented:
You can pull the required data from each tab using a VLOOKUP formula. On the required tab, copy and paste the list of email addresses and then use the following formula, assuming data starts in row 2 on new sheet and screen shots are Sheet1 (email and SamAccount) and Sheet2 (email, login and full name):

Login Time =VLOOKUP($A2,Sheet2!$A:$C,2,False)
User Name  =VLOOKUP($A2,Sheet2!$A:$C,3,False)
SamAccount  =VLOOKUP($A2,Sheet1!$A:$B,2,False)

Copy down the extent of data in column A, or select all 3 and then double click the bottom right corner of highlighted area to fill down.

Rob H
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.