Interlace data.

serge

Well-known Member
Joined
Oct 8, 2008
Messages
1,444
Office Version
  1. 2007
Platform
  1. Windows
Hi,
It's for a game that have 2 draws per day and I need to reorganize them into columns : Date, Price, Draw numbers, what formula should be use to interlace those 5 columns into 3 ?
Thank you.

12345.png
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
How about in H3 copied down
Excel Formula:
=INDEX($A$3:$A$40,CEILING(ROWS(H$3:H3)/2,1))
and in I3 copied down & across
Excel Formula:
=INDEX((B$3:B$40,E$3:E$40),CEILING(ROWS(I$3:I3)/2,1),1,MOD(ROWS(I$3:I3)-1,2)+1)
 
Upvote 0
In H3 copied down.
Excel Formula:
=INDEX($A$3:$A$17,1+INT((ROWS($H$3:$H3)-1)/2))
In I3 copied down to columns I and J
Excel Formula:
=INDEX($B$3:$F$17,MATCH($H3,$A$3:$A$17,0),COLUMNS($I3:I3)+IF(MOD(ROWS($I$3:$I3)-1,2)=0,0,3))
 
Upvote 0
VBA approach:
VBA Code:
Sub InterlaceData()
    Application.ScreenUpdating = False
    Dim v As Variant, arr() As Variant, i As Long, x As Long
    v = Range("A3", Range("A" & Rows.Count).End(xlUp)).Resize(, 6).Value
    ReDim Preserve arr(1 To UBound(v) * 2, 1 To 3)
    For i = LBound(v) To UBound(v)
        If x = 0 Then x = x + 1 Else x = x + 2
        arr(x, 1) = v(i, 1)
        arr(x, 2) = v(i, 2)
        arr(x, 3) = v(i, 3)
        arr(x + 1, 1) = v(i, 1)
        arr(x + 1, 2) = v(i, 5)
        arr(x + 1, 3) = v(i, 6)
    Next i
    Range("H3").Resize(UBound(v) * 2, 3).Value = arr
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Wow, Thank you to all of you those formulas work Great, I really appreciate all of your help.
Thank you all.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,934
Messages
6,175,486
Members
452,647
Latest member
MatthewBiersay

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