Compiling Data For Mail Merge

Dratchsky

New Member
Joined
Apr 24, 2021
Messages
11
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Web
Good Morning,

I am looking for a solution to quickly help fill rows based on their shared Value in Column C

I have several group id (Column C) that I need to have go from this
1619358937640.png

To This
1619359014025.png

Please let me know if you need more information
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Perhaps:

*Note GroupID looks like column B, I have made the below for Column C.

VBA Code:
Sub makeso()

Dim mycol As Long
Dim currow As Long
Dim searchrow As Long
Dim GroupID As String
Dim IDNumber As String
Dim Counter As Long

currow = 10

Do Until Cells(currow, 3) = ""
    GroupID = Cells(currow, 3)
    IDNumber = Cells(currow, 4)
    searchrow = 10
    mycol = 8
        Do Until Cells(searchrow, 3) = ""
            If Cells(searchrow, 3) = GroupID Then
                If Cells(searchrow, 4) <> IDNumber Then
                    Cells(currow, mycol) = Cells(searchrow, 4)
                    Cells(currow, mycol + 1) = Cells(searchrow, 5)
                    Cells(currow, mycol + 2) = Cells(searchrow, 6)
                    Cells(currow, mycol + 3) = Cells(searchrow, 7)
                    mycol = mycol + 4
                End If
            End If
        searchrow = searchrow + 1
        Loop
currow = currow + 1
Loop

Counter = 1
colnum = 8
Do Until Cells(10, colnum) = ""
    Cells(9, colnum) = "Room " & Counter & " ID"
    Cells(9, colnum + 1) = "Room " & Counter & " F"
    Cells(9, colnum + 2) = "Room " & Counter & " L"
    Cells(9, colnum + 3) = "Room " & Counter & " Email"
    colnum = colnum + 4
    Counter = Counter + 1
Loop
    
End Sub
 
Last edited:
Upvote 0
Perhaps:

*Note GroupID looks like column B, I have made the below for Column C.

VBA Code:
Sub makeso()

Dim mycol As Long
Dim currow As Long
Dim searchrow As Long
Dim GroupID As String
Dim IDNumber As String
Dim Counter As Long

currow = 10

Do Until Cells(currow, 3) = ""
    GroupID = Cells(currow, 3)
    IDNumber = Cells(currow, 4)
    searchrow = 10
    mycol = 8
        Do Until Cells(searchrow, 3) = ""
            If Cells(searchrow, 3) = GroupID Then
                If Cells(searchrow, 4) <> IDNumber Then
                    Cells(currow, mycol) = Cells(searchrow, 4)
                    Cells(currow, mycol + 1) = Cells(searchrow, 5)
                    Cells(currow, mycol + 2) = Cells(searchrow, 6)
                    Cells(currow, mycol + 3) = Cells(searchrow, 7)
                    mycol = mycol + 4
                End If
            End If
        searchrow = searchrow + 1
        Loop
currow = currow + 1
Loop

Counter = 1
colnum = 8
Do Until Cells(10, colnum) = ""
    Cells(9, colnum) = "Room " & Counter & " ID"
    Cells(9, colnum + 1) = "Room " & Counter & " F"
    Cells(9, colnum + 2) = "Room " & Counter & " L"
    Cells(9, colnum + 3) = "Room " & Counter & " Email"
    colnum = colnum + 4
    Counter = Counter + 1
Loop
   
End Sub
 
Upvote 0
Perhaps:

*Note GroupID looks like column B, I have made the below for Column C.

VBA Code:
Sub makeso()

Dim mycol As Long
Dim currow As Long
Dim searchrow As Long
Dim GroupID As String
Dim IDNumber As String
Dim Counter As Long

currow = 10

Do Until Cells(currow, 3) = ""
    GroupID = Cells(currow, 3)
    IDNumber = Cells(currow, 4)
    searchrow = 10
    mycol = 8
        Do Until Cells(searchrow, 3) = ""
            If Cells(searchrow, 3) = GroupID Then
                If Cells(searchrow, 4) <> IDNumber Then
                    Cells(currow, mycol) = Cells(searchrow, 4)
                    Cells(currow, mycol + 1) = Cells(searchrow, 5)
                    Cells(currow, mycol + 2) = Cells(searchrow, 6)
                    Cells(currow, mycol + 3) = Cells(searchrow, 7)
                    mycol = mycol + 4
                End If
            End If
        searchrow = searchrow + 1
        Loop
currow = currow + 1
Loop

Counter = 1
colnum = 8
Do Until Cells(10, colnum) = ""
    Cells(9, colnum) = "Room " & Counter & " ID"
    Cells(9, colnum + 1) = "Room " & Counter & " F"
    Cells(9, colnum + 2) = "Room " & Counter & " L"
    Cells(9, colnum + 3) = "Room " & Counter & " Email"
    colnum = colnum + 4
    Counter = Counter + 1
Loop
   
End Sub
I wrote the wrong column. Is there any way to write it for column B
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,177
Members
452,615
Latest member
bogeys2birdies

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