DEV Community

Cover image for In Excel, Re-arrange A Sequence N Times Randomly
Judith-Excel-Sharing
Judith-Excel-Sharing

Posted on

In Excel, Re-arrange A Sequence N Times Randomly

Problem description & analysis:

Column A is a random sequence. Cell B2 contains the parameter that represents the number of times of re-arranging members of the sequence.

original table

We need to rearrange column A N times.

result table

Solution:

Use SPL XLL to enter the formula below:

=spl("=?2.conj(?1.sort(rand()))",A2:A5,B2)
Enter fullscreen mode Exit fullscreen mode

As shown in the picture below:

result table with code entered
Explanation:

"integer.()" represents looping N times. conj() function concatenates multiple sequences. sort(rand())sorts a sequence randomly.

Top comments (1)

Collapse
 
judith677 profile image
Judith-Excel-Sharing

We now not only offer the FREE download of esProc Desktop but also provide many other useful information about SPL XLL!

Check them out:

SPL download address: scudata.com/download-Desktop

Plugin Installation Method: c.scudata.com/article/1652061135502

References to other rich Excel operation cases: c.raqsoft.com/article/1651916536524

SPL Programming (YouTube FREE courses): youtube.com/playlist?list=PLQeR-Ih...