Number Sequence

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
20,596
Office Version
  1. 365
Platform
  1. Windows
I know I could write a VBA macro for this, but I'm wondering if there was an easy way with formulas so I don't have to get my coworkers to enable macros.

So, I want to be able to enter a number in A1, and then have it generate the sequence as below. There will always be 4 columns of results. The number of rows will be the number in A1/4. The pattern starts at 1 in the 2nd column, goes up in the 3rd column, back down the 4th column, and then up the first column.

I gave a couple of samples to show how this goes.



16​
16​
1​
8​
9​
15​
2​
7​
10​
14​
3​
6​
11​
13​
4​
5​
12​
20​
20​
1​
10​
11​
19​
2​
9​
12​
18​
3​
8​
13​
17​
4​
7​
14​
16​
5​
6​
15​
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try:

Book1
ABCDEF
1Number
2202011011
3192912
4183813
5174714
6165615
Sheet5
Cell Formulas
RangeFormula
C2:F6C2=LET(r,A2/4,CHOOSE({1,2,3,4},SEQUENCE(r,,A2,-1),SEQUENCE(r),SEQUENCE(r,,A2/2,-1),SEQUENCE(r,,A2/2+1)))
Dynamic array formulas.
 
Upvote 2
Solution
Bit late but another option
Excel Formula:
=LET(a,A1/4,CHOOSECOLS(TRANSPOSE(SEQUENCE(4,a)+ISEVEN(SEQUENCE(4))*SEQUENCE(,a,a-1,-2)),4,1,2,3))
 
Upvote 1
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,129
Members
452,381
Latest member
Nova88

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