Convert 8 columns to two columns

jkmclean

Board Regular
Joined
Jan 3, 2019
Messages
65
Office Version
  1. 365
Platform
  1. Windows
How do you conver the following schedule


How do you convert the following 8 column schedule

Date Team ID

[TABLE="class: cms_table, width: 365"]
<tbody>[TR]
[TD="align: right"]September 5[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD="align: right"]September 12[/TD]
[TD]6[/TD]
[TD]8[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]2[/TD]
[TD]4[/TD]
[TD]1[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD="align: right"]September 19[/TD]
[TD]5[/TD]
[TD]4[/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]7[/TD]
[TD]3[/TD]
[TD]2[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD="align: right"]September 26[/TD]
[TD]3[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]8[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD="align: right"]October 3[/TD]
[TD]7[/TD]
[TD]1[/TD]
[TD]4[/TD]
[TD]6[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]5[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD="align: right"]October 10[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]5[/TD]
[TD]4[/TD]
[TD]1[/TD]
[TD]6[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD="align: right"]October 17[/TD]
[TD]4[/TD]
[TD]7[/TD]
[TD]6[/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD="align: right"]October 24[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD]8[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]1[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD="align: right"]October 31[/TD]
[TD]2[/TD]
[TD]4[/TD]
[TD]1[/TD]
[TD]3[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]6[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD="align: right"]November[/TD]
[TD]7[/TD]
[TD]3[/TD]
[TD]2[/TD]
[TD]6[/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]5[/TD]
[TD]4


To a two column schedule
[TABLE="width: 192"]
<colgroup><col width="64" style="width:48pt" span="3"> </colgroup><tbody>[TR]
[TD="width: 64, align: right"]Sep-05 [/TD]
[TD="width: 64"]1[/TD]
[TD="width: 64"]2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]3[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]5[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]7[/TD]
[TD]8

[/TD]
[/TR]
[TR]
[TD="align: right"]Sep-12 [/TD]
[TD]6[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]5[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]etc[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try this
Assuming that your data starts in A2, the result will be in columns K to M

Code:
Sub Convert_columns()
    Dim c As Range, j As Long
    For Each c In Range("A2", Range("A" & Rows.Count).End(xlUp))
        For j = 2 To 8 Step 2
            Range("K" & Rows.Count).End(xlUp)(2).Value = c.Value
            Range("L" & Rows.Count).End(xlUp)(2).Resize(1, 2).Value = c.Offset(0, j - 1).Resize(1, 2).Value
        Next
    Next
End Sub
 
Upvote 0
Assume your data "Date and team ID" put in A1:I11 with header

In K2, copied down :

=IF((ROW(A1)<=40)*(MOD(ROW(A1),4)=1),OFFSET($A$1,INT((ROW(A1)-1)/4)+1,0),"")

In L2, copied right to M2 and copied down :

=IF(ROW(A1)<=40,OFFSET($A$1,INT((ROW(A1)-1)/4)+1,MOD(ROW(A1)-1,4)*2+COLUMN(A1)),"")

Regards
Bosco
 
Upvote 0
Thank you.
I am not sure what this does but will try it.
pretty novice at this.
 
Upvote 0
Hey it works.
I also figured out how to use it for other schedules of up to 40 teams.
Now, How to I call the routine from the spreadsheet.
Talk to you soon,
 
Upvote 0
woops my mistake.
I tried a 16 team league and it only went through the first two weeks and stopped.
what values do I have to change to have it do say a 16 team league with 30 weeks, or say
a 10 team league with 30 weeks.
 
Upvote 0
What has to change in the sub to say convert a 12 or 16 or 10 column to two columns?
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

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