Matrix is named range of matrix

Horizontal =OFFSET(Matrix,TRUNC((ROW()-ROW($A$12))/COLUMNS(Matrix)),MOD(ROW()-ROW($A$12),COLUMNS(Matrix)),1,1)

Vertical =OFFSET(Matrix,MOD(ROW()-ROW($A$12),ROWS(Matrix)),TRUNC((ROW()-ROW($A$12))/ROWS(Matrix)),1,1)

source: http://www.cpearson.com/excel/MatrixToVector.aspx

Horizontal =OFFSET(Matrix,TRUNC((ROW()-ROW($A$12))/COLUMNS(Matrix)),MOD(ROW()-ROW($A$12),COLUMNS(Matrix)),1,1)

Vertical =OFFSET(Matrix,MOD(ROW()-ROW($A$12),ROWS(Matrix)),TRUNC((ROW()-ROW($A$12))/ROWS(Matrix)),1,1)

source: http://www.cpearson.com/excel/MatrixToVector.aspx