Sub topic 7
TODAY and volatile recalculation
This chapter assumes you can enter formulas, use cell references such as A2, and apply a number format. It also assumes you know that Excel stores a date as a serial number, a count of days. Time of day is the fraction after the decimal point.
What TODAY returns
TODAY() returns the current date from your computer's clock, as a serial number with no time part. It takes no arguments, but you must still type the parentheses.
The cell usually formats itself as a date. If you change the format to General, you see a whole number such as 46353, which is today's serial number.
Because TODAY returns an ordinary serial number, you can use it in the date arithmetic from the previous chapter.
=TODAY()-A2If A2 holds a date, this returns the days elapsed since then. Format the result cell as General or Number. If the cell shows a date instead of a count, Excel has inherited a date format from TODAY, and the result looks like a date in January 1900.
Volatile recalculation
TODAY is a volatile function. Excel normally recalculates a formula only when one of its inputs changes. A volatile function is recalculated every time the workbook recalculates, because its result can change without any cell changing.
Recalculation happens when:
- You open the workbook.
- You edit any cell that triggers a calculation.
- You press F9 to calculate manually.
The cell with =TODAY()-A2 therefore shows a different value each day you open the file. This is useful for live countdowns and ages. It is a problem for records that must not change.
Do not use the fence above. The diagram follows.
Common uses
| Goal | Formula | Result |
|---|---|---|
| Days since a start date in A2 | `=TODAY()-A2` | Count of days |
| Days until a deadline in A2 | `=A2-TODAY()` | Negative if overdue |
| Flag overdue items | `=IF(A2<TODAY(),"Overdue","OK")` | Text label |
| Date 30 days from now | `=TODAY()+30` | A date |
For the deadline formula, a negative result means the deadline has passed. Wrap it in MAX(0, ...) if you want a floor at zero.
Gotchas
- Stored dates should not use TODAY. If you need to record the date an entry was made, type it with Ctrl+; (Windows) or Ctrl+; on Mac. This inserts a fixed value that never changes. A TODAY formula in an invoice date column rewrites history every day.
- Calculation mode. If the workbook is set to Manual calculation, TODAY does not update until you press F9. A stale date is a common sign of this setting.
- Performance. A volatile cell also forces every formula that depends on it to recalculate. A few uses are harmless. Thousands of dependents in a large workbook can slow it.
- Time of day. TODAY drops the time. Use
NOW()if you need the current date and time. NOW is also volatile. - Unsaved prompts. Because the workbook recalculates on open, Excel may ask whether to save changes when you close a file you did not edit.
A worked example
Suppose A2 holds a project start date, 1 March 2024, and you want a running count of elapsed days.
- Select B2.
- Type
=TODAY()-A2and press Enter. - Set B2's number format to General.
- Press F9 to see that the cell recalculates. The value stays the same during one day and rises by 1 the next day.
To freeze the value for a report, copy B2 and use Paste Special > Values. The pasted number no longer changes.
Exercise
A2 holds the due date of an invoice. Write a formula that returns "Late" if the due date is before today and "On time" otherwise. Then explain why the result in the same cell can differ between Monday and Tuesday without anyone editing the sheet.
Show answer
Use =IF(A2<TODAY(),"Late","On time"). TODAY is volatile, so Excel recalculates it whenever the workbook recalculates, such as on opening the file. When the date changes, TODAY returns a new serial number, and the comparison with A2 can change from "On time" to "Late".