Transposing Several Rows Into Multiple Columns

12learnexcel

New Member
Joined
Aug 3, 2009
Messages
7
Hi everyone. I've been searching for a thread about this query but all I found refer to Multiple Rows to Single Columns and the like.
I need help in transposing Several Rows into Multiple Columns and I would appreciate if it's in a formula format and not VBA.
The table looks like this:

[TABLE="width: 555"]
<tbody>[TR]
[TD]Product[/TD]
[TD]Detail[/TD]
[TD="colspan: 5"]Sale[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Product 1[/TD]
[TD]Date of Sale[/TD]
[TD]A1[/TD]
[TD]A2[/TD]
[TD]A3[/TD]
[TD]A4[/TD]
[TD]A5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Client Name[/TD]
[TD]B1[/TD]
[TD]B2[/TD]
[TD]B3[/TD]
[TD]B4[/TD]
[TD]B5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Quantity[/TD]
[TD]C1[/TD]
[TD]C2[/TD]
[TD]C3[/TD]
[TD]C4[/TD]
[TD]C5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Price / Pc[/TD]
[TD]D1[/TD]
[TD]D2[/TD]
[TD]D3[/TD]
[TD]D4[/TD]
[TD]D5[/TD]
[/TR]
[TR]
[TD]Product 2[/TD]
[TD]Date of Sale[/TD]
[TD]A6[/TD]
[TD]A7[/TD]
[TD]A8[/TD]
[TD]A9[/TD]
[TD]A10[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Client Name[/TD]
[TD]B6[/TD]
[TD]B7[/TD]
[TD]B8[/TD]
[TD]B9[/TD]
[TD]B10[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Quantity[/TD]
[TD]C6[/TD]
[TD]C7[/TD]
[TD]C8[/TD]
[TD]C9[/TD]
[TD]C10[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Price / Pc[/TD]
[TD]D6[/TD]
[TD]D7[/TD]
[TD]D8[/TD]
[TD]D9[/TD]
[TD]D10[/TD]
[/TR]
[TR]
[TD]Product 3[/TD]
[TD]Date of Sale[/TD]
[TD]A11[/TD]
[TD]A12[/TD]
[TD]A13[/TD]
[TD]A14[/TD]
[TD]A15[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Client Name[/TD]
[TD]B11[/TD]
[TD]B12[/TD]
[TD]B13[/TD]
[TD]B14[/TD]
[TD]B15[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Quantity[/TD]
[TD]C11[/TD]
[TD]C12[/TD]
[TD]C13[/TD]
[TD]C14[/TD]
[TD]C15[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Price / Pc[/TD]
[TD]D11[/TD]
[TD]D12[/TD]
[TD]D13[/TD]
[TD]D14[/TD]
[TD]D15[/TD]
[/TR]
</tbody>[/TABLE]

Please note that the Sale number extends up to 20 and the Products are up to 200.

I need it to look like this on another worksheet:

[TABLE="width: 501"]
<tbody>[TR]
[TD="colspan: 3"]Consolidated Sales List[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product[/TD]
[TD]Date of Sale[/TD]
[TD]Client Name[/TD]
[TD]Quantity[/TD]
[TD]Price / Pc[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 1[/TD]
[TD]A1[/TD]
[TD]B1[/TD]
[TD]C1[/TD]
[TD]D1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 1[/TD]
[TD]A2[/TD]
[TD]B2[/TD]
[TD]C2[/TD]
[TD]D2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 1[/TD]
[TD]A3[/TD]
[TD]B3[/TD]
[TD]C3[/TD]
[TD]D3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 1[/TD]
[TD]A4[/TD]
[TD]B4[/TD]
[TD]C4[/TD]
[TD]D4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 1[/TD]
[TD]A5[/TD]
[TD]B5[/TD]
[TD]C5[/TD]
[TD]D5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 2[/TD]
[TD]A6[/TD]
[TD]B6[/TD]
[TD]C6[/TD]
[TD]D6[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 2[/TD]
[TD]A7[/TD]
[TD]B7[/TD]
[TD]C7[/TD]
[TD]D7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 2[/TD]
[TD]A8[/TD]
[TD]B8[/TD]
[TD]C8[/TD]
[TD]D8[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 2[/TD]
[TD]A9[/TD]
[TD]B9[/TD]
[TD]C9[/TD]
[TD]D9[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 2[/TD]
[TD]A10[/TD]
[TD]B10[/TD]
[TD]C10[/TD]
[TD]D10[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 3[/TD]
[TD]A11[/TD]
[TD]B11[/TD]
[TD]C11[/TD]
[TD]D11[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 3[/TD]
[TD]A12[/TD]
[TD]B12[/TD]
[TD]C12[/TD]
[TD]D12[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 3[/TD]
[TD]A13[/TD]
[TD]B13[/TD]
[TD]C13[/TD]
[TD]D13[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 3[/TD]
[TD]A14[/TD]
[TD]B14[/TD]
[TD]C14[/TD]
[TD]D14[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Product 3[/TD]
[TD]A15[/TD]
[TD]B15[/TD]
[TD]C15[/TD]
[TD]D15[/TD]
[/TR]
</tbody>[/TABLE]


I've been trying to research about this and work it out myself but my deadline is fast approaching. Thanks everyone in advance for your help.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Step 1 in same sheet. Copy formula down and across as far as you need to

Sheet1

*ABCDEFGH
Product*******
***
Product 1Date of SaleA1A2A3A4A5A6
*Client NameB1B2B3B4B5*
*QuantityC1C2C3C4C5*
*Price / PcD1D2D3D4D5*
Product 2Date of SaleA6A7A8A9A10*
*Client NameB6B7B8B9B10*
*QuantityC6C7C8C9C10*
*Price / PcD6D7D8D9D10*
Product 3Date of SaleA11A12A13A14A15*
*Client NameB11B12B13B14B15*
*QuantityC11C12C13C14C15*
*Price / PcD11D12D13D14D15*

<tbody>
[TD="bgcolor: #cacaca, align: center"]1[/TD]

[TD="bgcolor: #cacaca, align: center"]2[/TD]

[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]5[/TD]

[TD="bgcolor: #cacaca, align: center"]3[/TD]

[TD="bgcolor: #cacaca, align: center"]4[/TD]

[TD="bgcolor: #cacaca, align: center"]5[/TD]

[TD="bgcolor: #cacaca, align: center"]6[/TD]

[TD="bgcolor: #cacaca, align: center"]7[/TD]

[TD="bgcolor: #cacaca, align: center"]8[/TD]

[TD="bgcolor: #cacaca, align: center"]9[/TD]

[TD="bgcolor: #cacaca, align: center"]10[/TD]

[TD="bgcolor: #cacaca, align: center"]11[/TD]

[TD="bgcolor: #cacaca, align: center"]12[/TD]

[TD="bgcolor: #cacaca, align: center"]13[/TD]

[TD="bgcolor: #cacaca, align: center"]14[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
H3=OFFSET($C3,4*INT((COLUMN()-3)/5),MOD(COLUMN()-3,5))

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Last edited:
Upvote 0
Step 2 in new sheet. Copy Formula Down, Copy second formula down and across as far as you need to. You will have to tweak these formulas to adjust for number of products, etc.

Sheet2

*ABCDE
ProductDate of SaleClient NameQuantityPrice / PC
Product 1A1***

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:63px;"><col style="width:78px;"><col style="width:78px;"><col style="width:56px;"><col style="width:67px;"></colgroup><tbody>
[TD="bgcolor: #cacaca, align: center"]1[/TD]

[TD="bgcolor: #cacaca, align: center"]2[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
A2="Product "&INT((ROW()+3)/5)
B2=OFFSET(Sheet1!$C$3,COLUMN()-2,ROW()-2)

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
hi smkyle,

the formulas are awesome. thank you.

in sheet 1, everything looks great. i have no problem with the formula. thank you.

but in sheet 2, it was also ok except that i need all the 20 sales records of all the 200 products to be consolidated into all 5 columns only (Product, Date of Sale, Client Name, Quantity and Price/Pc) such that under these 5 headers there will be 20 rows of Product1's followed by 20 rows of Product2's and so on up to 20 rows of Product200's. what the formula did was,it consolidated the 20 sales records of each product into 20 different list sets (which i believe was my mistake since i mentioned that i needed it to be transposed, i apologize, i actually needed them to be consolidated). i tried tweaking the formula myself but it seemed i need more training.

anyway, help please. and thank you so much in advance.
 
Last edited:
Upvote 0
could you use Excel Jeanie to show me what you have? I think you may want to either use a pivot table or to do something like this:

Excel Workbook
ABCDE
1Product 11Product 115
2Product 12Product 210
3Product 13
4Product 14
5Product 15
6Product 21
7Product 22
8Product 23
9Product 24
Sheet1


Personally I would go with a pivot table because they are flexible and easy to change to suit your style preferences. Totally up to you though
 
Upvote 0
hi smkyle,

thank you very much for your help. i rearranged my table to achieve the results that i wanted and the formula you suggested is working fine now.

thanks again.
 
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

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