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

September 512345678
September 1268572413
September 1954187326
September 2636721584
October 371463852
October 1023854167
October 1747618235
October 2456783412
October 3124135768
November73261854


To a two column schedule
Sep-05 12
34
56
78

Sep-12 68
57
24
13
etc

<colgroup><col width="64" style="width:48pt" span="3"> </colgroup><tbody>
</tbody>
<strike></strike>

<tbody>
</tbody>
<strike></strike>
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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
You're welcome, let me know if you have any doubt
 
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,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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