Search code examples
google-sheetsrangeoffset

Google sheet Offset 4th parameter


In Excel I am able to use like so:

OFFSET(RangeName, 0,0,,1)

this will get all values of Column 0 (first column) in my multi-column range.

But when i try to do this in Google Sheet, error comes up:

Function OFFSET parameter 4 value is 0. It should be greater than or equal to 1.

Parameter 4 is height of range from documentation. How can I get height of range "RangeName" to be input to here?

EDIT: More info.

RangeName is dynamic. It points to contents of a cell which I can change. I tried

OFFSET(RangeName,0,0,1,1)

It works, but the list is cut short to 1 item (obviously).


Solution

  • YES! I found it! Here is how to do this:

    OFFSET(RangeName,0,0,COUNTA(RangeName),1)
    

    The function COUNTA will return number of items in the range.