staggering rows

merlin777

Well-known Member
Joined
Aug 29, 2009
Messages
1,397
Office Version
  1. 2007
How can i stagger the contents of the following row using a formula? I want to stagger by different numbers of columns so row 2 might be identical data to row 1 but shifted right by a number of columns.

so for instance, if i stagger by 1 (always to the right) the first row will have 0 1 2 3 4 5 6 7 8 9, the next row will have 1 2 3 4 5 6 7 8 9 0, the third row will be 2 3 4 5 6 7 8 9 0 1 and so on
If I stagger by 2 it'll be 0123456789, 2345678901, 4567890123 and so on.

On a small scale I can do it by hand but this will be 365 columns and 10 rows and i want to try staggering by 0 to a max of 67 columns so id like a formula i can drag and fill!

Row 1 will always have the original data set.

I know there are functions which work with cell reference but i cant remember what they are called so its tricky to google them.

Thanks in advance!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
How about:

Cell Formulas
RangeFormula
A2:J15A2=INDEX($A$1:$J$1,MOD(ROWS($A$1:$A1)+COLUMNS($A1:A1)-1,COLUMNS($A$1:$J$1))+1)
Thanks for that - almost.
I need them to stagger to the right not left. If it helps i can limit the rows to 10 and we can start the data in column K to give some room to the left.
Also, my data will be alpha numeric, probably just letters. I apologise that my example implied just number 0 to 9.
And the number of columns staggered needs to be optional so i'll put the number of columns to stagger in a cell and change it as required.
Essentially, apart from the top data row, I need a cell to show the contents of the cell in the row above and N to the left, where N is the number of rows to stagger, if that makes sense?
 
Upvote 0
There was nothing in my original formula that required the values to be numbers. And I believe my example gave the same results as you mentioned in your post. Nevertheless, try this version:

Book1
IJKLMNOPQRST
1Offsetabcdefghij
22cdefghijab
3efghijabcd
4ghijabcdef
5ijabcdefgh
6abcdefghij
7cdefghijab
8efghijabcd
Sheet5
Cell Formulas
RangeFormula
K2:T8K2=INDEX($K$1:$T$1,MOD(ROWS($K$1:$K1)*$I$2+COLUMNS($K1:K1)-1,COLUMNS($K$1:$T$1))+1)


Note that you can use positive and negative numbers in the Offset value to make the offsets go in different directions.
 
Upvote 0
There was nothing in my original formula that required the values to be numbers. And I believe my example gave the same results as you mentioned in your post. Nevertheless, try this version:

Book1
IJKLMNOPQRST
1Offsetabcdefghij
22cdefghijab
3efghijabcd
4ghijabcdef
5ijabcdefgh
6abcdefghij
7cdefghijab
8efghijabcd
Sheet5
Cell Formulas
RangeFormula
K2:T8K2=INDEX($K$1:$T$1,MOD(ROWS($K$1:$K1)*$I$2+COLUMNS($K1:K1)-1,COLUMNS($K$1:$T$1))+1)


Note that you can use positive and negative numbers in the Offset value to make the offsets go in different directions.
Thanks, Eric I'll give that a try. I mistakenly assumed it was numeric because when i tried it, after 9 it returned 0, 1, 2 etc instead of 10, 11, 12.
Each subsequent row needs to stagger to the right so the +/- is great.
 
Upvote 0
I'm using the letter A to P to test and its more or less working except that it only goes up to J then starts again at A

e.g. (with an offset of +1)

ABCDEFGHIJKLMNOP
BCDEFGHIJABCDEFG
 
Upvote 0
@merlin777
What version of Excel are you using?
Please update your account profile to show this, as it affects which functions you can use.
 
Upvote 0
It works fine with a range that goes up to P, you just have to adjust the ranges in the formula to match your top row. I can come up with a version that looks for the last value in row 1 if you want, so you don't have to remember to change it. Or if you have Excel 365, Fluff can probably come up with a Spill version of the formula.

Book1
IJKLMNOPQRSTUVWXYZ
1Offsetabcdefghijklmnop
2-3nopabcdefghijklm
3klmnopabcdefghij
4hijklmnopabcdefg
Sheet5
Cell Formulas
RangeFormula
K2:Z4K2=INDEX($K$1:$Z$1,MOD(ROWS($K$1:$K1)*$I$2+COLUMNS($K1:K1)-1,COLUMNS($K$1:$Z$1))+1)
 
Upvote 0
Solution
Thanks, Eric. I'll fiddle with it - i want to understand how it works, anyway. I'll come back if i'm struggling if i may?
 
Upvote 0

Forum statistics

Threads
1,215,062
Messages
6,122,925
Members
449,094
Latest member
teemeren

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