Offset vs Index

Jeffrey Mahoney

Well-known Member
Joined
May 31, 2015
Messages
2,801
Office Version
  1. 365
Platform
  1. Windows
I keep getting told that the function OFFSET is volatile and very inefficient. That each time a calculation is done, Offset always refreshes even if the formulas with Offset have nothing to do with the edited cell. I use Offset in dynamic named range formulas like in the example below.

Will it make a difference in a named range?

Is the efficiency gain going to be realized only if I change a large number of cell formulas?

Is this:
=INDEX($A$3:$A$4,2,1):INDEX($A$3:$ZZ$123456,MATCH(1E+300,$A:$A,1)-ROW($A$3)+1,40)

better than:
=OFFSET('Header Data'!$A$3,1,0,MATCH(1E+300,'Header Data'!$A:$A,1)-ROW('Header Data'!$A$3),40)
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Your basic description of how OFFSET works, and why it's volatile is largely correct. And some people avoid all volatile functions as a matter of principle. HOWEVER, the story is not as simple as that!

I'm relying on some other information I've found, some of which I'll include links for, some of which I can't find anymore. I can't independently verify what I read, so read the following links with a critical eye.

First, I read an article by a Microsoft engineer which said that OFFSET is very fast, so you shouldn't worry about performance with it. Yes, it may calculate more often, but even so, you may end up better off than with a workaround that takes longer to calculate. I suspect that you'll never see a difference unless you have a "large" number of them in your worksheet. "Large" of course is dependent on many factors, so it's impossible to say that you're OK if you use less than 1000 (for example) OFFSETs. If you actually perform some comparisons, feel free to post your results.

Second, if I read this article correctly:


your improved, theoretically non-volatile INDEX function is actually volatile too! That sort of negates switching OFFSET to INDEX in many cases. I like the final section "Word to the Wise" that basically states that a good spreadsheet is a balancing act, and you have to balance the use of volatile functions, with clarity, functionality, Conditional Formatting, and other factors. Just excluding all volatile functions is not necessarily the "best" solution.

This article:


also gives a good rundown of volatile functions, with the pros and cons. A lot of times on this forum, when you're just focused on a single formula and not the bigger picture, it's just easier to avoid volatile functions, so as to avoid this kind of discussion. But I don't think that it's always that simple.

Anyway, that's my 2 cents worth, hope you get something useful from it.
 
Upvote 0
Hey, thank you for the response.

The first article pointed out that Index can be volatile. The author of the other article seemed to embrace volatile functions as if they're not that big of a deal.

I'm going to need to keep an open mind while doing some more research. Meanwhile, I was in the middle of changing all my dynamic named ranges with offset to index. That is coming to a grinding halt because I don't think it'll make enough of a difference.
 
Upvote 0

Forum statistics

Threads
1,215,202
Messages
6,123,625
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top