Merge Data on separate sheets

jsfmacleod

New Member
Joined
May 18, 2016
Messages
5
Hello,
So I have 2 sheets in my workbook.
Sheet 1 has Names, ID numbers, and Managers. (about 500 rows)
Sheet 2 has Names, ID numbers, Program, Program Numbers, Total Hours. (about 40,000 rows)

I need help using the unique ID numbers to merge the data into one sheet with
ID Number, Name, Program, Program Number and Total Hours worked.

I found a few ways to do this but problem I am running into is that there may be 5 of the same ID numbers in Sheet 2 because that person worked on 5 different projects.
I need to have that output into 5 different rows on the Final sheet.

If anyone has any ideas, that would be a great help.
Thanks!
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hello,
So I have 2 sheets in my workbook.
Sheet 1 has Names, ID numbers, and Managers. (about 500 rows)
Sheet 2 has Names, ID numbers, Program, Program Numbers, Total Hours. (about 40,000 rows)

I need help using the unique ID numbers to merge the data into one sheet with
ID Number, Name, Program, Program Number and Total Hours worked.

I found a few ways to do this but problem I am running into is that there may be 5 of the same ID numbers in Sheet 2 because that person worked on 5 different projects.
I need to have that output into 5 different rows on the Final sheet.

If anyone has any ideas, that would be a great help.
Thanks!

What do you want to merge ?, reading your message I understand you already have all data in Sheet 2, sheet 1 only contain manager name in addition but you don't want to have this in Merged sheet, so I have hard time to understand what do you want to put extra in merged sheet . Can you give an example so that it is clear
 
Upvote 0
What do you want to merge ?, reading your message I understand you already have all data in Sheet 2, sheet 1 only contain manager name in addition but you don't want to have this in Merged sheet, so I have hard time to understand what do you want to put extra in merged sheet . Can you give an example so that it is clear

Sorry I was not that clear, here is an example of what I would like to have happen.

Sheet1
Name ID # Badge # Grade Manager
John Doe 1 123456 98765 S3 EM 1
John Doe 2 246810 87654 S1 EM 2
John Doe 3 370164 76543 T5 EM 3
John Doe 4 493518 65432 T2 EM 4
John Doe 5 616872 54321 O5 EM 5
John Doe 6 740226 43210 T3 EM 6
John Doe 7 863580 32099 S1 EM 7
John Doe 8 986934 20988 T1 EM 8
John Doe 9 111028 98774 S4 EM 9
John Doe 10 123364 11234 T2 EM 10

Sheet2
Badge # Name CCC Project Total Hours
87654 John Doe 2 GHWJKD Project 1 40
87654 John Doe 2 GHWJKD Project 2 80
87654 John Doe 2 GHWJKD Project 3 40
98765 John Doe 1 QDSFGH Project 5 80
98765 John Doe 1 QDSFGH Project 6 80
76543 John Doe 3 HEGTBN Project 20 160
65432 John Doe 4 JSHTBA Project 1 120
65432 John Doe 4 JSHTBA Project 4 40
54321 John Doe 5 SJFHAF Project 2 160
11234 John Doe 10 OPITWL Project 1 160
98774 John Doe 9 EYFHKD Project 7 160
20988 John Doe 8 VMANS Project 4 40
20988 John Doe 8 VMANS Project 5 30
20988 John Doe 8 VMANS Project 20 20
20988 John Doe 8 VMANS Project 3 30
20988 John Doe 8 VMANS Project 6 40
32099 John Doe 7 ASKJNR Project 1 160
43210 John Doe 6 MDNFJ Project 2 60
43210 John Doe 6 MDNFJ Project 4 100

Created Final Sheet
Badge # Name ID # CCC Grade Manager Project Total Hours
98765 John Doe 1 123456 QDSFGH S3 EM 1 Project 5 80
98765 John Doe 1 123456 QDSFGH S3 EM 1 Project 6 80
87654 John Doe 2 246810 GHWJKD S1 EM 2 Project 1 40
87654 John Doe 2 246810 GHWJKD S1 EM 2 Project 2 80
87654 John Doe 2 246810 GHWJKD S1 EM 2 Project 3 40
76543 John Doe 3 370164 HEGTBN T5 EM 3 Project 20 160
65432 John Doe 4 493518 JSHTBA T2 EM 4 Project 1 120
65432 John Doe 4 493518 JSHTBA T2 EM 4 Project 4 40
54321 John Doe 5 616872 SJFHAF O5 EM 5 Project 2 160
43210 John Doe 6 740226 MDNFJ T3 EM 6 Project 2 60
43210 John Doe 6 740226 MDNFJ T3 EM 6 Project 4 100
32099 John Doe 7 863580 ASKJNR S1 EM 7 Project 1 160
20988 John Doe 8 986934 VMANS T1 EM 8 Project 4 40
20988 John Doe 8 986934 VMANS T1 EM 8 Project 5 30
20988 John Doe 8 986934 VMANS T1 EM 8 Project 20 20
20988 John Doe 8 986934 VMANS T1 EM 8 Project 3 30
20988 John Doe 8 986934 VMANS T1 EM 8 Project 6 40
98774 John Doe 9 111028 EYFHKD S4 EM 9 Project 7 160
11234 John Doe 10 123364 OPITWL T2 EM 10 Project 1 160

So far I have used
Code:
Sub TestGridUpdate()
    Dim ws1 As Worksheet
    Dim ws2 As Worksheet
    Dim ws3 As Worksheet
    Dim TestGridFound As Boolean
    Dim r As Range
    Set ws1 = ThisWorkbook.Worksheets("Sheet1")
    Set ws2 = ThisWorkbook.Worksheets("Sheet2")
    TestGridFound = False
    For Each ws In Worksheets
        If ws.Name = "TestGrid" Then TestGridFound = True
    Next
    If TestGridFound Then
        Set ws3 = ThisWorkbook.Worksheets("TestGrid")
        ws3.Cells.Clear
    Else
        Set ws3 = ThisWorkbook.Worksheets.Add(After:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count))
        ws3.Name = "TestGrid"
    End If
    ws3.Range(ws1.UsedRange.Address).Value = ws1.UsedRange.Value
    For Each r In ws3.UsedRange.Rows
        ID = r.Cells(, 1).Value
        iRow = Application.Match(ID, ws2.UsedRange.Columns(2), 0)
        If Not IsError(iRow) Then ws2.Range("A" & iRow & ":U" & iRow).Copy ws3.Range("G" & r.Row)
    Next
End Sub
Unfortunately it only returns the first project it finds though many people may have more than 1.
Please let me know if I need to clear anything up!
Thanks!
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,217
Members
452,619
Latest member
Shiv1198

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