Creating number tables skipping rows

mackensteff

Board Regular
Joined
Feb 9, 2010
Messages
74
Office Version
  1. 365
Platform
  1. MacOS
It is possible to make a table like the following using a formula that I drag across and down:

1708122599331.png


The goal is to count sequentially across a row, then move to the next row return a zero, and the same with the third, and then pick up counting where it left off in the fourth row and so forth as the example table shows. I have tried MOD and INT functions but I can't seem to get it to work.

Thanks!
 

Attachments

  • 1708122516238.png
    1708122516238.png
    7.4 KB · Views: 5

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Assuming your data starts in row A1 and you are only going across 10 columns, here is a single formula:
Cell Formulas
RangeFormula
A1:J22A1=IF(MOD(ROW(),3)=1,COLUMNS($A:A)+FLOOR.MATH(INT(ROWS($1:1)*3.33),10),0)


If you need something more dynamic than a consistent 10 column range, then perhaps Jen's is the way to go or mine will have to be adjusted.
 
Upvote 0
You can use mine for different column counts with the same row layout by changing the following:

=IF(MOD(ROW(),3)=1,COLUMNS($A:A)+FLOOR.MATH(INT(ROWS($1:1)*1.66),5),0)

Change the red number to your total columns divided by 3. Change the blue number to your total columns. Or you can put those calculations in cells and reference them so you don't have to keep changing the formula.

IE: 11 columns:
Cell Formulas
RangeFormula
L1:V22L1=IF(MOD(ROW(),3)=1,COLUMNS($A:A)+FLOOR.MATH(INT(ROWS($1:1)*3.66),11),0)


IE: 5 columns:
Cell Formulas
RangeFormula
A25:E43A25=IF(MOD(ROW(),3)=1,COLUMNS($A:A)+FLOOR.MATH(INT(ROWS($1:1)*1.66),5),0)
 
Upvote 0
Solution
You can do it with a single SPILL formula, so you don't need to drag anything:

Book1
ABCDEFGHIJ
178910111213141516
20000000000
30000000000
417181920212223242526
50000000000
60000000000
727282930313233343536
80000000000
90000000000
Sheet3
Cell Formulas
RangeFormula
A1:J9A1=LET(start,7,numrows,3,numcols,10,zerorows,2,zr,zerorows+1,s,SEQUENCE(numrows,numcols,start),allrows,numrows*zr,t,SEQUENCE(allrows,numcols,0),IF(MOD(t,zr*numcols)<numcols,INDEX(s,INT(t/zr/numcols)+1,SEQUENCE(,numcols)),0))
Dynamic array formulas.


If you look at the first 4 variables in the formula (start, numrows, numcols, zerorows), you can change those to whatever you want, or even set them to cells on the workbook if you need to change them dynamically.
 
Upvote 0
Another single spill formula that you could test.
Starting number (strt), number of non-zero rows (non0rws), number of columns (cols) and number of zero rows between each "number" row (z0rws) can all be varied in the first part of the formula. I have provided two examples below.

24 02 17.xlsm
ABCDEFGHIJKLMNOP
1789101112131415161234
200000000000000
300000000000000
4171819202122232425260000
500000000005678
600000000000000
7272829303132333435360000
80000
99101112
100000
110000
120000
1313141516
140000
150000
160000
1717181920
18
Makearray
Cell Formulas
RangeFormula
A1:J7A1=LET(strt,7,non0rws,3,cols,10,z0rws,2,MAKEARRAY((z0rws+1)*(non0rws-1)+1,cols,LAMBDA(r,c,(cols*(r-1)/(z0rws+1)+strt+c-1)*(MOD(r,z0rws+1)=1))))
M1:P17M1=LET(strt,1,non0rws,5,cols,4,z0rws,3,MAKEARRAY((z0rws+1)*(non0rws-1)+1,cols,LAMBDA(r,c,(cols*(r-1)/(z0rws+1)+strt+c-1)*(MOD(r,z0rws+1)=1))))
Dynamic array formulas.
 
Last edited:
Upvote 0
Another two option (using the same variables as Peter) one with the zero rows at the bottom & one without.
Fluff.xlsm
ABCDEFGHIJ
178910111213141516
20000000000
30000000000
417181920212223242526
50000000000
60000000000
727282930313233343536
80000000000
90000000000
10
1178910111213141516
120000000000
130000000000
1417181920212223242526
150000000000
160000000000
1727282930313233343536
18
Data
Cell Formulas
RangeFormula
A1:J9A1=LET(strt,7,non0rws,3,cols,10,z0rws,2,WRAPROWS(TOCOL(EXPAND(SEQUENCE(non0rws,cols,strt),,(z0rws+1)*cols,0)),cols))
A11:J17A11=LET(strt,7,non0rws,3,cols,10,z0rws,2,DROP(WRAPROWS(TOCOL(EXPAND(SEQUENCE(non0rws,cols,strt),,(z0rws+1)*cols,0)),cols),-z0rws))
Dynamic array formulas.
 
Upvote 0
These are all amazing and I can see benefits of each. However, Eric W, Peter_SSs, and Fluffs seem to invoke wizardy that I won't even pretend to understand.

Thanks everyone!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,086
Messages
6,123,033
Members
449,092
Latest member
ikke

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