I have a table in Excel that often uses OFFSET
to get one column relative to another one. This is necessary to allow me to dynamically resize the table.
So for example in cell D5
of a MyTable
, I have a formula like this - where D$2 is the first row of the table
=INDEX(
OFFSET(
D$2,
0,
(- OffsetDistance ),
ROWS(
MyTable
)
),
MATCH(
LARGE(
OFFSET(
D$2,
0,
(- 1 ),
ROWS(
MyTable
)
),
ROW() -
ROW(
MyTable[#Headers]
)
),
OFFSET(
D$2,
0,
(- 1 ),
ROWS(
MyTable
)
),
0
)
)
Now I've heard it said that "OFFSET
is slow because it's volatile". That's like saying RAND()
is slow; generating a random number is not slow, nothing compared to sorting a list or searching for a substring - the slowness is because the sheet recalculates often.
I'm wondering, how much slower using the OFFSET function is than a Range literal. Basically I have a tradeoff between flexibility and being able to dynamically resize my table vs faster hardcoded offsets.
So generally, is OFFSET itself likely to be the source of slowness in the sheet? I imagine not, because I'm guessing it's an O(1)
operation that just has to add a couple of numbers together. But I can't think how to quantify this