Google Spreadsheets: How to get a first (Nth) row/column from a range? (built-in functions)

前端 未结 4 850
攒了一身酷
攒了一身酷 2020-12-30 23:56

Say I have this named range, not at A1.

      idz01  idz04  ida02
foo     a      1      b
bar     c      3      8
baz     8      2      g

N

4条回答
  •  情深已故
    2020-12-31 00:44

    Partial answer: (still open to better ones)

    1st row

    OFFSET(Data, 0 , 0, 1)
    

    First column:

    You simply can call some functions on the range and they take 1st column.
    Or, if needed:

    OFFSET(Data, 0, 0, MAX(ARRAYFORMULA(ROW(Data))), 1)
    

    Nth row:
    The key here is that OFFSET() only fills right and down. So you only need to crop these directions by it's parameters.

    OFFSET(Data, N, 0, 1);
    

    Could be also achieved by feeding the first row to ARRAYFORMULA() and for each column (cell), get the last row's cell using INDEX(COLUMN(),ROW() + N).

    Nth column:

    Similarly to above, only you need to get the number of rows.

    OFFSET(Data, 0, N, ROWS(Data), 1);
    

    I was playing with TRANSPOSE() but seems that OFFSET() doesn't digest it well.

提交回复
热议问题