Can someone explain how the below formula to transpose all rows to one column works?

antman2988

Board Regular
Joined
Jun 28, 2018
Messages
78
Hello,

I have used this formula: **=INDEX( MyData,INT((ROW()-ROW( $Z$1 ))/COLUMNS( MyData ))+1,MOD(ROW()-ROW( $Z$1 ),COLUMNS( MyData ))+1)** to transpose all of my rows of data into one column. Unfortunately, I can't entirely wrap my head around how it works.

Would someone be willing to explain it to me? Any assistance is appreciated.

Thanks,
Anthony Smith
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Break it into parts. I assume you're putting the formula in Z1 and dragging down.

ZAAABAC
15011
23112
31213
40314
510415
60516
77617
810718
91821
107922
1131023
1231124
1351225
1491326
1511427
1681528
1781631
1811732
1921833
2061934
2112035
2282136
2372237
2422338

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
Z1=INDEX( MyData,INT((ROW()-ROW( $Z$1 ))/COLUMNS( MyData ))+1,MOD(ROW()-ROW( $Z$1 ),COLUMNS( MyData ))+1)
AA1=ROW()-ROW($Z$1)
AB1=INT((ROW()-ROW( $Z$1 ))/COLUMNS( MyData ))+1
AC1=MOD(ROW()-ROW( $Z$1 ),COLUMNS( MyData ))+1

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Workbook Defined Names
NameRefers To
MyData=Sheet1!$F$3:$M$10

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



Put the AA1 formula in and drag down. As you can see, it just counts up from 0. Subtracting the starting row from the current row does that.

Put the AB1 formula in and drag down. When you divide the number in AA by the number of columns in your table (my sample table has 8), and drop the remainder (INT), you get a counter that only increments by 1 for every row in your table.

Put the AC1 formula in and drag down. The MOD function is equivalent to dividing by the number of columns and taking the remainder, then we add 1. So this pattern repeats 1-8 over and over.

Then finally INDEX uses the first number (AB) as an index into your table for the row, and uses the second number (AC) as an index for the column.

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,215,579
Messages
6,125,646
Members
449,245
Latest member
PatrickL

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