Moving values forward and wrapping in a table

Buzzcut

New Member
Joined
Dec 16, 2014
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hi Team,
I've exhausted both my Excel knowledge, tinkering skills and Google.
I have a list of 400 students I need to schedule for exams at 5 different stations. I need to take the first row of 5 and move them forward one place in row 2, #5 wrapping round to #1 in row 2.
In row 3 I need to take 6-10 and do the same, so row 4 contains those names moved on one place with the wrap.
I can list the students with an index so I need something like this for the lookup, I can't seem to get my brain around the OFFSET/ROW formula:

12345
51234
678910
106789
1112131415
1511121314

Any help would be amazing!
Cheers...Buzz
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

If you have 365 how about
Fluff.xlsm
ABCDEFG
1
2RossendaleRossendaleBradfordSheffieldKirkleesCalderdale
3BradfordCalderdaleRossendaleBradfordSheffieldKirklees
4SheffieldEdenBarnsleyCornwallBurnleyBolton
5KirkleesBoltonEdenBarnsleyCornwallBurnley
6CalderdaleDudleyWycombeHigh PeakWealdenDacorum
7EdenDacorumDudleyWycombeHigh PeakWealden
8BarnsleyLeedsHarrogateBirminghamTandridgeCraven
9CornwallCravenLeedsHarrogateBirminghamTandridge
10Burnley
11Bolton
12Dudley
13Wycombe
14High Peak
15Wealden
16Dacorum
17Leeds
18Harrogate
19Birmingham
20Tandridge
21Craven
Main
Cell Formulas
RangeFormula
C2:G9C2=INDEX(A2:A21,SORTBY(VSTACK(SEQUENCE(4,5),SORTBY(SEQUENCE(4,5),{2,3,4,5,1})),VSTACK(SEQUENCE(4,,,2),SEQUENCE(4,,2,2))))
Dynamic array formulas.
 
Upvote 0
Solution
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

If you have 365 how about
Fluff.xlsm
ABCDEFG
1
2RossendaleRossendaleBradfordSheffieldKirkleesCalderdale
3BradfordCalderdaleRossendaleBradfordSheffieldKirklees
4SheffieldEdenBarnsleyCornwallBurnleyBolton
5KirkleesBoltonEdenBarnsleyCornwallBurnley
6CalderdaleDudleyWycombeHigh PeakWealdenDacorum
7EdenDacorumDudleyWycombeHigh PeakWealden
8BarnsleyLeedsHarrogateBirminghamTandridgeCraven
9CornwallCravenLeedsHarrogateBirminghamTandridge
10Burnley
11Bolton
12Dudley
13Wycombe
14High Peak
15Wealden
16Dacorum
17Leeds
18Harrogate
19Birmingham
20Tandridge
21Craven
Main
Cell Formulas
RangeFormula
C2:G9C2=INDEX(A2:A21,SORTBY(VSTACK(SEQUENCE(4,5),SORTBY(SEQUENCE(4,5),{2,3,4,5,1})),VSTACK(SEQUENCE(4,,,2),SEQUENCE(4,,2,2))))
Dynamic array formulas.
Wow, it's times like this I realise my Excel knowledge is low-level.
I'm using 365 so this is absolutely perfect.
Thankyou so much for the reply, this has helped me out no end.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
You're welcome & thanks for the feedback.
Apologies, if you get a second could you explain exactly what's going on with the final 2 VSTACK SortBy?
I've disected as much as I can, and with F9 I can work through it but I get to this and I'm stumped by how ths gives the correct final array.

SORTBY(
{1,2,3,4,5;6,7,8,9,10;11,12,13,14,15;16,17,18,19,20;5,1,2,3,4;10,6,7,8,9;15,11,12,13,14;20,16,17,18,19},
{1;3;5;7;2;4;6;8}
)

Strangely enough it also works with SEQUENCE(4,,,,2) at the end instead of SEQUENCE(4,,2,2) - so {1;3;5;7;1;3;5;7}
In my mind the rows should be sorted {1;5;2;6;3;7;4;8}?
 
Upvote 0
The 1st VSTACK returns the data in cols C:G & the 2nd returns the values in col I
Fluff.xlsm
CDEFGHI
1
2123451
3512343
46789105
51067897
611121314152
715111213144
816171819206
920161718198
Main
Cell Formulas
RangeFormula
C2:G9C2=SORTBY(VSTACK(SEQUENCE(4,5),SORTBY(SEQUENCE(4,5),{2,3,4,5,1})),VSTACK(SEQUENCE(4,,,2),SEQUENCE(4,,2,2)))
I2:I9I2=VSTACK(SEQUENCE(4,,,2),SEQUENCE(4,,2,2))
Dynamic array formulas.


The SORTBY then sorts the data so that row 6 moves up to become the 2nd row in the array, & row 7 becomes the 4th row in the array etc.
 
Upvote 1

Forum statistics

Threads
1,216,046
Messages
6,128,489
Members
449,455
Latest member
jesski

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