VYPER

=VYPER(Vector)

Vector
Required. Has to be a 1D-vector. A single cel is allowed, in case of which: Output=Input.

Extrudes a given Vector by means of all cyclic permutations (the cyclic sequence is invariant).

GeertD

Board Regular
Joined
Dec 22, 2020
Messages
60
Office Version
  1. 365
Platform
  1. Windows
VYPER – vector extrusion through cyclic permutations. Extrudes a given Vector by means of all cyclic permutations (the cyclic sequence is invariant).
Excel Formula:
=LAMBDA(InputVector,LET(
riv,ROWS(InputVector),civ,COLUMNS(InputVector),
IF((riv>1)*(civ>1),"The input needs to be a 1D-vector.",LET(
RowVector,IF(riv=1,InputVector,TRANSPOSE(InputVector)), Cols,COLUMNS(RowVector),
DColdex,MOD(SEQUENCE(,2*Cols,0),Cols)+1,
Rowdex0,SEQUENCE(Cols,,0),
CyclicColdex,INDEX(DColdex,,SEQUENCE(,Cols)+Cols-Rowdex0),
Result,INDEX(RowVector,,CyclicColdex),
IF(riv=1,Result,TRANSPOSE(Result))
))))
VYPER_VectorExtrusionThroughCyclicPermutions.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAG
1Input:Output:Manual Control:
2634281015796342810157963428101579
39634281015796342810157
47963428101579634281015
55796342810157963428101
61579634281015796342810
71015796342810157963428
88101579634281015796342
92810157963428101579634
104281015796342810157963
113428101579634281015796
12
13Input:Output:
14556319872410
151010563198724
16441056319872
17224105631987
18772410563198
19887241056319
20998724105631
21119872410563
22331987241056
23663198724105
24
25Input:Output:
26313The input needs to be a 1D-vector.
27515
28111
29616
30717
31919
32212
33414
34818
351020
36
VYPER
Cell Formulas
RangeFormula
A2:J2A2=SORTBY(SEQUENCE(,10),RANDARRAY(,10,1,10,TRUE))
L2:U11,L26,L14:U23L2=LAMBDA(InputVector,LET( riv,ROWS(InputVector),civ,COLUMNS(InputVector), IF((riv>1)*(civ>1),"The input needs to be a 1D-vector.",LET( RowVector,IF(riv=1,InputVector,TRANSPOSE(InputVector)), Cols,COLUMNS(RowVector), DColdex,MOD(SEQUENCE(,2*Cols,0),Cols)+1, Rowdex0,SEQUENCE(Cols,,0), CyclicColdex,INDEX(DColdex,,SEQUENCE(,Cols)+Cols-Rowdex0), Result,INDEX(RowVector,,CyclicColdex), IF(riv=1,Result,TRANSPOSE(Result)) ))))(A2#)
W2:AF2W2=A2:J2
W3W3=AF2
X3:AF11X3=W2
W4W4=AE2
W5W5=AD2
W6W6=AC2
W7W7=AB2
W8W8=AA2
W9W9=Z2
W10W10=Y2
W11W11=X2
A14:A23A14=TRANSPOSE(SORTBY(SEQUENCE(,10),RANDARRAY(,10,1,10,TRUE)))
A26:B35A26=TRANSPOSE(SORTBY(SEQUENCE(2,10),RANDARRAY(,10,1,10,TRUE)))
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
L27:U35Other TypeColor scaleNO
A26:J35Other TypeColor scaleNO
L15:U23,M14:U14Other TypeColor scaleNO
A14:J23Other TypeColor scaleNO
L2:U11,L14Other TypeColor scaleNO
W2:AF11Other TypeColor scaleNO
A2:J11Other TypeColor scaleNO
 
Upvote 0
Hi, ✌️ , for fun ? :
Excel Formula:
=LAMBDA(a,LET(r,ROWS(a),c,COLUMNS(a),IF(AND(r>1,c>1),"no 1D",
      LET(x,IF(r=1,c,r),y,MOD(SEQUENCE(x,,x,-1)+SEQUENCE(,x)-1,x)+1,z,INDEX(a,y),
        IF(r=1,z,TRANSPOSE(z))))
        )
)
Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1aConceptfor 1st example x=clm(a)=10
263428101579
3step1 seq(x,,x,-1)+seq(,x)
4=VYPER(C2:L2)=SEQUENCE(10,,10,-1)+SEQUENCE(,10)
56342810157911121314151617181920
69634281015710111213141516171819
7796342810159101112131415161718
857963428101891011121314151617
91579634281078910111213141516
10101579634286789101112131415
1181015796342567891011121314
122810157963445678910111213
13428101579633456789101112
1434281015796234567891011
15
16step2 mod(step1-1,x)+1
17a=VYPER(A18:A27)=MOD(P5#-1,10)+1
1855631987241012345678910
19101056319872410123456789
2044105631987291012345678
2122410563198789101234567
2277241056319878910123456
2388724105631967891012345
2499872410563156789101234
2511987241056345678910123
2633198724105634567891012
2766319872410523456789101
28
29astep3 index(a,step2)
3058=VYPER(A30:B31)=INDEX(C2:L2,P18#)
3134no 1D63428101579
3296342810157
3379634281015
3457963428101
3515796342810
3610157963428
3781015796342
3828101579634
3942810157963
4034281015796
41
42
Sheet1
Cell Formulas
RangeFormula
C4,P30,D30,P17,C17,P4C4=FORMULATEXT(C5)
C5:L14C5=VYPER(C2:L2)
P5:Y14P5=SEQUENCE(10,,10,-1)+SEQUENCE(,10)
C18:L27C18=VYPER(A18:A27)
P18:Y27P18=MOD(P5#-1,10)+1
D31D31=VYPER(A30:B31)
P31:Y40P31=INDEX(C2:L2,P18#)
Dynamic array formulas.
 
That's a one step Cyclic Index. Well done!
Your solution is minimum effort and therefore the best.
Thanks for sharing. :)
 
Thanks C. Have to admit: I was a little rusty. I had to look up again how to make a post on the Message Board.?
Well, I thought I'd compensate with a bunch of nice colors ('t is the season) and a cool name for the function. ;)
 

Forum statistics

Threads
1,223,526
Messages
6,172,834
Members
452,483
Latest member
Johnstone

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