Volatile Excel Functions

Today I was talking to a customer and his issue was a strange one which I hadn’t seen before.

Every time he changed ANYTHING on his spreadsheet he noticed that it would refresh unrelated formulas, i.e. formulas that did not reference the cells he was updating.

The main formula on his sheet was this:

=EPF.Yahoo.HistoricDatePeriod("AMD","Weekly","1 Jan 2020", TODAY(), "DESC", 1)

This is an Excel Price Feed dynamic array formula which returns weekly historical stock market data for AMD stock from 1 Jan 2020 to today.

This formula is non-volatile so should only update when any of its parameters change.

So, what was going on?

The culprit was actually one of the parameters: the Excel TODAY() function.

This built-in Excel function is a volatile function and will update ANYTIME ANYTHING on the spreadsheet changes.

What is a Volatile Function?

Microsoft defines a volatile function as follows:

…one whose value cannot be assumed to be the same from one moment to the next even if none of its arguments (if it takes any) has changed.

https://docs.microsoft.com/en-us/office/client-developer/excel/excel-recalculation

There are 8 built-in volatile Excel formulas, and it is worth being aware that using these in your spreadsheet could have unintended consequences:

  • NOW
  • TODAY
  • RANDBETWEEN
  • OFFSET
  • INDIRECT
  • INFO (depending on its arguments)
  • CELL (depending on its arguments)
  • SUMIF (depending on its arguments)

The Solution

The solution was simple, replace the TODAY() function with a string value of the current date. This could be either hardcoded into the formula or better still entered into a cell and referenced from the formula.

So, if you every notice your spreadsheet starting to slow-down or start doing unnecessary calculations then look out for volatile functions.

One thought on “Volatile Excel Functions

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s