Move large amount of data

RichAK

New Member
Joined
Mar 15, 2013
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hi

My data (gage ID’s in this case) are in columns, with three rows in between each one.

There are 16,320 gage ID’s. I need to break them down into groups of 11 and move them to the right of each successive group of 11 ID’s with one column in between each.

If my calculations are correct, I would have to repeat the process over 1400 times to move all the data!

How can this be done quicker?
 

Attachments

  • Excel help 2021-06-10_13-03-04.jpg
    Excel help 2021-06-10_13-03-04.jpg
    103.1 KB · Views: 4

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
It would help greatly if you would change your profile to indicate what version of Excel you are running and
use XL2BB to show a few examples of your data (not an image) and the expected results.
 
Upvote 0
Excel for Office 365 -

From:

Book2
AB
1idCount
2GP .0040Z-111
3
4
5
6GP .0040Z-122
7
8
9
10GP .0040Z-183
11
12
13
14GP .0040Z-214
15
16
17
18GP .0040Z-225
19
20
21GP .0040Z-96
22
23
24
25GP .0042A7
26
27
28
29GP .0042B8
30
31
32
33GP .0042C9
34
35
36
37GP .0043A10
38
39
40
41GP .0043B11
42
43
44
45GP .0044A12
46
47
48
49GP .0044B13
50
51
52
53GP .0044C14
54
55
56
57GP .0045C15
58
59
60
61GP .0045I16
62
63
64
65GP .0045J17
66
67
68
69GP .0045L18
70
71
72
73GP .0045M19
74
75
76
77GP .0045N20
78
79
80
81GP .0048A21
82
83
84
85GP .0049A22
86
Sheet1


To:

Book2
ABCD
1idCount
2GP .0040Z-111GP .0044A12
3
4
5
6GP .0040Z-122GP .0044B13
7
8
9
10GP .0040Z-183GP .0044C14
11
12
13
14GP .0040Z-214GP .0045C15
15
16
17
18GP .0040Z-225GP .0045I16
19
20
21
22GP .0040Z-96GP .0045J17
23
24
25
26GP .0042A7GP .0045L18
27
28
29
30GP .0042B8GP .0045M19
31
32
33
34GP .0042C9GP .0045N20
35
36
37
38GP .0043A10GP .0048A21
39
40
41
42GP .0043B11GP .0049A22
Sheet1
 
Upvote 0
I think I understand what you are trying to do, try this code. I have assumed all the data is on the active sheet. just for test I have selected "sheet2" to output the results, so be aware that this will overwrite sheet2, change this as necessary when it works correctly :
VBA Code:
Sub test()
Dim outarr As Variant

lastrow = Cells(Rows.Count, "A").End(xlUp).Row
lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
inarr = Range(Cells(1, 1), Cells(lastrow, lastcol))
'Range(Cells(1, 1), Cells(lastrow, lastcol)) ' change this line from a comment when you want to write back to the active sheet ( this clears it!!)
' define output array we need 2 columns for each 44 rows and we need 2 columns for each output
orow44 = Round((1 + lastrow / 44), 0)
ocol = lastcol * orow44
ReDim outarr(1 To 44, 1 To ocol)
rowno = 2
colno = 1
For j = 1 To lastcol Step 2
 For i = 2 To lastrow Step 4
  outarr(rowno, colno) = inarr(i, j)
  rowno = rowno + 4
  If rowno > 44 Then
   rowno = 2
   colno = colno + 2
  End If
 Next i
 rowno = 2
 colno = colno + 2
Next j
Worksheets("sheet2").Select
Range(Cells(1, 1), Cells(44, ocol)) = outarr

End Sub
Note it will be fast because it uses variant arrays and only accesses the worksheet twice
 
Last edited:
Upvote 0
Excel for Office 365 -
Please add that to your Account details (click your user name at the top right of the forum) so helpers always know. (Don’t forget to scroll down & ‘Save’). Then it will show up on every post like this

1623415026130.png
 
Upvote 0

Forum statistics

Threads
1,214,634
Messages
6,120,659
Members
448,975
Latest member
sweeberry

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