Sub topic 14
Volatile Functions and When They Recalculate
This chapter assumes you can enter formulas, use cell references, and change number formats in Google Sheets. It also assumes you know that dates and times are stored as numbers, even when they are displayed as readable dates.
A volatile function recalculates when the spreadsheet recalculates, even if none of its direct input cells changed. This behavior is useful for current dates and random values, but it can also make results change unexpectedly or slow a large sheet.
Date and time functions that change over time
TODAY() returns the current date. NOW() returns the current date and time.
=TODAY()
=NOW()These functions do not update every second on the screen. They update when Google Sheets recalculates the spreadsheet. A recalculation can happen after an edit, when the file is opened, or according to the spreadsheet's calculation setting.
For example, this formula calculates an age from a birth date in A2:
=DATEDIF(A2, TODAY(), "Y")The result can change when the date changes, even though A2 stays the same.
Other functions can also produce changing values:
| Function | Typical result | Why the result changes |
|---|---|---|
| `TODAY()` | Current date | The calendar date changes or the sheet recalculates |
| `NOW()` | Current date and time | The sheet recalculates |
| `RAND()` | Random decimal from 0 to 1 | The sheet recalculates |
| `RANDBETWEEN(1, 100)` | Random whole number | The sheet recalculates |
Choosing a recalculation setting
Open the spreadsheet's calculation settings through File > Settings > Calculation. The available choices normally include:
- On change: recalculate when a value is edited.
- On change and every hour: also recalculate at least hourly.
- On change and every minute: also recalculate at least every minute.
The setting applies to the spreadsheet, not just one formula. A frequent recalculation interval can be useful for a live countdown or current-time display. It can be wasteful for a report with many formulas.
Avoiding unintended changes
Suppose B2 contains a due date. This formula shows whether the item is overdue:
=IF(B2<TODAY(), "Overdue", "Open")That status is intentionally dynamic. However, using TODAY() inside a historical report can make yesterday's results change today. If a report must remain reproducible, store the report date in a cell such as F1, then reference that fixed value:
=IF(B2<$F$1, "Overdue", "Open")The absolute reference $F$1 keeps the comparison date fixed when the formula is copied.
Recalculation flow
Use volatile formulas when the changing value is part of the intended model. Use a fixed input when the value represents an event that must not change later.
Exercise
A worksheet uses =NOW() to record when each task was entered. Why will the recorded times keep changing, and what should you use instead for permanent timestamps?
Show answer
NOW() is volatile and recalculates, so it always shows a newer current time. Use a fixed timestamp value, or an Apps Script trigger that writes the time once.