How to convert a matrix to a single column using Excel

后端 未结 3 1511
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-31 15:00

I have the following matrix in Excel:

3 Columns: A, B, C

Row 1: a b c

Row 2: d e f

相关标签:
3条回答
  • 2020-12-31 15:28

    This was already covered in Item 2 from the very general

    Excel: Formulas for converting data among column / row / matrix :

    The top cell of your target range (say, $H$1) should contain

    =INDEX($A$1:$C$3,INT((ROW()-ROW($H$1))/3)+1,MOD(ROW()-ROW($H$1),3)+1)
    

    where $A$1:$C$3 cotains your source data. Copy the formula downwards as needed.

    You could also use

    =OFFSET($A$1,INT((ROW()-ROW($H$1))/3),MOD(ROW()-ROW($H$1),3))
    

    as metioned in the referred article.

    0 讨论(0)
  • 2020-12-31 15:38

    Say we have:

    enter image description here

    In E1 enter:

    =INDEX($A$1:$C$3,ROUNDUP(ROW()/3,0),IF(MOD(ROW(),3)=0,3,MOD(ROW(),3)))
    

    and copy down to get:

    enter image description here



    Using similar formulas you can map any two dimensional table into a single row or single column. It is equally easy to map a single column or row into a table.

    0 讨论(0)
  • 2020-12-31 15:43

    The answers above are quite good, but IMHO, the solution provided by Chip Pearson here (http://www.cpearson.com/excel/TableToColumn.aspx), is superior is most respects since it immediately/automatically:

    1) Determines the Row/Col delim values on its own, and immediately works for rectangular, e.g. above one must explicitly enter 3 for num Cols and 3 for num Rows, and must also figure out which is which. Whereas Pearson's solution does this automatically (eg. rmf's comment/concern above).

    2) Pearson provides both variants for Col-ordered and also Row-ordered.

    0 讨论(0)
提交回复
热议问题