Transpose every set of 5 rows into 1 row

howdedo

New Member
Joined
May 21, 2009
Messages
2
I have a large data set where a single account is represented as a fixed number of rows (i.e. 5) in a single column. In other words, the first 5 rows in the column represent a single account. The next 5 rows represent the next account, etc.

I want to convert each set of 5 rows into a single row with 5 colums so that I can sort and aggregate the data. How can I convert every 5 rows into 5 columns in a single row?

For example, I want to convert this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

into this:
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15

Is this possible to do this in a manner that could be easily be repeated to accomodate 10-15 thousand rows of input data in this format?

Thanks for your help.
Tom
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Assuming that A2:A16 contains the data, try...

C2, copied across and down:

=INDEX($A$2:$A$16,ROWS(C$2:C2)*5-5+COLUMNS($C2:C2))

Adjust the references, accordingly.
 
Upvote 0
Thanks Domenic!, amazing how can this be achieved with just standard formulas

Actually, the formula uses standard/native functions that are available to all versions of Excel...
 
Upvote 0
Actually, the formula uses standard/native functions that are available to all versions of Excel...

This is my exact question (except I want to transpose every 6 lines), but I can't get it to work... What do you mean by "C2, copied across and down:" I don't know what I'm doing wrong.
 
Last edited:
Upvote 0
This is my exact question (except I want to transpose every 6 lines), but I can't get it to work... What do you mean by "C2, copied across and down:" I don't know what I'm doing wrong.

First, enter the following formula in cell C2...

=INDEX($A$2:$A$16,ROWS(C$2:C2)*6-6+COLUMNS($C2:C2))

Then, place your cursor over the lower right corner of C2 until it changes to a cross, click and drag across to H2. Then, place your cursor over the lower right corner of H2 until it changes to a cross, click and drag down.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,148
Members
448,552
Latest member
WORKINGWITHNOLEADER

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