Spreadsheet: 752281d1634681852-reshaping-a-matrix-with-formulas-ef1552_reshape_matrix
Sheet: Sheet1

 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | For conversion from 5 x 4 to 2 x 10 ==> |  | Need to convert numbers from ROWS($1:1) and
 | Original Matrix: |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | COLUMNS($O:O) into the corresponding numbers
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | from the original matrix |  |  |  |  |  | [NAME] and |  | [NAME] into required |  |  | Substitute expession in
 | 59 | 59 | 63 | 30 | 70 | 9 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | Transformed matrix |  |  | Original matrix |  |  | AE to sequential |  | series, using INT and MOD |  |  | column AJ to get terms
 | 40 | 6 | 45 | 75 | 92 | 1 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | Row | Column |  | Row | Column |  | series |  | Row | Column |  | Row | Column
 | 6 | 19 | 6 | 93 | 78 | 1 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1 | 1 |  | 1 | 1
 | 89 | 100 | 30 | 44 | 9 | 9 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1 | 2 |  | 1 | 2
 | 51 | 80 | 89 | 53 | 62 | 2 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1 | 3 |  | 1 | 3
 | 81 | 9 | 33 | 39 | 16 | 8 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1 | 4 |  | 1 | 4
 | 99 | 58 | 74 | 19 | 77 | 2 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1 | 5 |  | 2 | 1
 | 41 | 66 | 51 | 73 | 7 | 7 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1 | 6 |  | 2 | 2
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1 | 7 |  | 2 | 3
 | Reshape to Matrix where MOD(columns_new,columns_old)=0 and MOD(rows_old,rows_new)=0 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1 | 8 |  | 2 | 4
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1 | 9 |  | 3 | 1
 |  | old_cols |  |  |  | new_cols | 12 |  | MOD |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1 | 10 |  | 3 | 2
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 2 | 1 |  | 3 | 3
 |  | old_rows |  |  |  | new_rows | 4 |  | MOD |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 2 | 2 |  | 3 | 4
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 2 | 3 |  | 4 | 1
 | Reshaped Matrix: |  |  | Pattern to repeat: |  |  |  | equiv. |  |  |  |  | 3 | Transposed using INDEX with named values for new and old cols and rows, and appropriate indexed range: |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 2 | 4 |  | 4 | 2
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 2 | 5 |  | 4 | 3
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 2 | 6 |  | 4 | 4
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 2 | 7 |  | 5 | 1
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 2 | 8 |  | 5 | 2
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 2 | 9 |  | 5 | 3
 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 2 | 10 |  | 5 | 4
 | Reshape to Matrix where MOD(columns_new,columns_old)<>0 and MOD(rows_old,rows_new)<>0
 | e.g. take 5 × 4 matrix and turn into 10 × 2 matrix
 | 19 | 18 | 99 | 37
 | 100 | 23 | 79 | 15
 | 6 | 20 | 70 | 46
 | 24 | 2 | 90 | 12
 | 90 | 89 | 48 | 85
 |  | old_cols2 |  |  |  | new_cols2 | 10 |  | MOD
 |  | old_rows2 |  |  |  | new_rows2 | 2 |  | MOD
 | Reshaped Matrix: |  |  | Pattern to repeat: |  |  |  | equiv. |  |  |  |  | 2 | Transposed using INDEX with named values for new and old cols and rows:
 | Should be: |  |  |  |  |  |  |  |  |  |  |  | 1 | Old and new cols and rows hard-coded:
 | 19 | 18 | 99 | 37 | 100 | 23 | 79 | 15 | 6 | 20
 | 70 | 46 | 24 | 2 | 90 | 12 | 90 | 89 | 48 | 85
Check