How to use the TODAY function
What is the TODAY function?
The TODAY function returns the Excel date (serial number) of the current date. Note, this function is volatile!
Table of Contents
1. Introduction
What is a volatile function?
The TODAY function is a volatile function, it updates or recalculates every time the worksheet is recalculated. This may slow down your workbook calculations considerably if there are many formulas that depend on the TODAY function.
It may also slow down your worksheet/workbook if you have many volatile functions.
When is the worksheet calculated?
Cells containing non volatile functions are only calculated once or until you force a recalculation, however, volatile functions are recalculated each time you type in a cell and press enter.
Can you stop recalculating a worksheet?
Yes, you can change a setting to manual recalculations.
- Go to tab "Formulas".
- Press with left mouse button on the "Calculation Options" button, a popup menu appears.
- Press with mouse on "Manual".
This stops the automatic recalculations.
How to force a recalculation?
Pressing F9 key will recalculate or refresh all the formulas and values in every worksheet of every workbook you have open.
Pressing Shift+F9 will only recalculate the formulas and values on the single worksheet you're currently viewing or active.
Pressing Ctrl+Alt+F9 is the quickest way to force a full recalculation of absolutely everything in all open workbooks, even if nothing has changed. It ignores whether changes were made or not and completely recomputes.
Are there more volatile functions in Excel?
Yes. OFFSET, TODAY, RAND, NOW among others.
Function | Syntax | Description |
---|---|---|
OFFSET | OFFSET(reference, rows, cols) | Returns a cell offset from a reference cell. |
NOW | NOW() | Returns the current time. |
RAND | RAND() | Returns a random decimal between 0 and 1. |
RANDARRAY | RANDARRAY([rows], [columns], [min], [max], [whole_number]) | Returns an array with random numbers. |
RANDBETWEEN | RANDBETWEEN(bottom, top) | Returns a random whole number between bottom and top |
Note, that conditional formatting is extremely volatile or super-volatile meaning it is recalculated as you scroll through a worksheet.
What are dates in Excel?
Dates are stored numerically but formatted to display in human-readable date/time formats, this enables Excel to do work with dates in calculations.
For example, dates are stored as sequential serial numbers with 1 being January 1, 1900 by default. The integer part (whole number) represents the date the decimal part represents the time.
This allows dates to easily be formatted to display in many date/time formats like mm/dd/yyyy, dd/mm/yyyy and so on and still be part of calculations as long as the date is stored numerically in a cell.
You can try this yourself, type 10000 in a cell, press CTRL + 1 and change the cell's formatting to date, press with left mouse button on OK. The cell now shows 5/18/1927.
2. Syntax
TODAY()
The TODAY function has no arguments
3. Example 1
Formula in cell B4:
What does the TODAY function return?
The Excel date the TODAY function returns is a serial number that Excel recognizes and can be filtered, sorted and used in other date calculations.
Excel dates are actually serial numbers formatted as dates, 1/1/1900 is 1 and 2/2/2018 is 43133. There are 43132 days between 2/2/2018 and 1/1/1900.
You can try this yourself, type 10000 in a cell, press CTRL + 1 and change the cell's formatting to date, press with left mouse button on OK. The cell now shows 5/18/1927.
4. Example 2 - filter the upcoming dates for next week
This example demonstrates a formula that extracts records from cell range B3:C18 if the dates fall during the next seven days. The formula automatically changes the date, this is why it is volatile.
Excel 365 formula in cell E5:
This formula works only in Excel 365, the FILTER function may return multiple values that automatically spills to cells below. The formula in cell E5 returns records from cell range B3:C18 if the date is within the next 7 days based on the date today. The date today is in cell F2 for reference.
4.1 Explaining formula
An Excel date is a serial number that Excel recognizes and can be filtered, sorted and used in other date calculations.
Excel dates are actually serial numbers formatted as dates, 1/1/1900 is 1 and 2/2/2018 is 43133. There are 43132 days between 2/2/2018 and 1/1/1900.
You can try this yourself, type 10000 in a cell, press CTRL + 1 and change the cell's formatting to date, press with left mouse button on OK. The cell now shows 5/18/1927.
Step 1 - Add 7 days to today's date
The plus sign + lets you perform addition in an Excel formula.
TODAY()+7
becomes
45241+7
equals 45248 (11/18)
Step 2 - Check dates smaller than today plus 7 days
The less than sign. larger than sign, and the equal sign are comparison operators that let you create logical expressions. The logical expression returns the boolean value, TRUE or FALSE.
B3:B18<=TODAY()+7
becomes
{45249; 45244; 45234; 45245; 45245; 45251; 45241; 45241; 45252; 45247; 45241; 45251; 45252; 45253; 45240; 45240}<=45248
and returns
{TRUE; TRUE; TRUE; TRUE; TRUE; FALSE; TRUE; TRUE; FALSE; TRUE; TRUE; FALSE; FALSE; FALSE; TRUE; TRUE}
Step 3 - Check dates later than or equal to today
B3:B18>=TODAY()
{45249; 45244; 45234; 45245; 45245; 45251; 45241; 45241; 45252; 45247; 45241; 45251; 45252; 45253; 45240; 45240}<=45241
and returns
{TRUE; TRUE; FALSE; TRUE; TRUE; TRUE; FALSE; FALSE; TRUE; TRUE; FALSE; TRUE; TRUE; TRUE; FALSE; FALSE}
Step 4 - Multiply boolean values to perform AND logic
The asterisk character lets you multiply numbers and boolean values in an Excel formula. The numerical equivalent to boolean value TRUE is 1 and FALSE is 0 (zero)
(B3:B18<=TODAY()+7)*(B3:B18>=TODAY())
becomes
{TRUE; TRUE; TRUE; TRUE; TRUE; FALSE; TRUE; TRUE; FALSE; TRUE; TRUE; FALSE; FALSE; FALSE; TRUE; TRUE} * {TRUE; TRUE; FALSE; TRUE; TRUE; TRUE; FALSE; FALSE; TRUE; TRUE; FALSE; TRUE; TRUE; TRUE; FALSE; FALSE}
and returns
{1;1;0;1;1;0;0;0;0;1;0;0;0;0;0;0}
Step 5 - Filter records
The FILTER function extracts values/rows based on a condition or criteria.
Function syntax: FILTER(array, include, [if_empty])
FILTER(B3:C18,(B3:B18<=TODAY()+7)*(B3:B18>=TODAY()))
becomes
FILTER(B3:C18,{1;1;0;1;1;0;0;0;0;1;0;0;0;0;0;0})
and returns the following array in cell E5 and spills to adjacent cells to the right and below as far as needed.
{45249, "#001"; 45244, "#007"; 45245, "#016"; 45245, "#012"; 45247, "#009"}
5. Function not working
The image above demonstrates a particular error value that is displayed if you misspell the TODAY function which is shown in the formula bar.
7.1 Troubleshooting the error value
When you encounter an error value in a cell a warning symbol appears, displayed in the image above. Press with mouse on it to see a pop-up menu that lets you get more information about the error.
- The first line describes the error if you press with left mouse button on it.
- The second line opens a pane that explains the error in greater detail.
- The third line takes you to the "Evaluate Formula" tool, a dialog box appears allowing you to examine the formula in greater detail.
- This line lets you ignore the error value meaning the warning icon disappears, however, the error is still in the cell.
- The fifth line lets you edit the formula in the Formula bar.
- The sixth line opens the Excel settings so you can adjust the Error Checking Options.
Here are a few of the most common Excel errors you may encounter.
#NULL error - This error occurs most often if you by mistake use a space character in a formula where it shouldn't be. Excel interprets a space character as an intersection operator. If the ranges don't intersect an #NULL error is returned. The #NULL! error occurs when a formula attempts to calculate the intersection of two ranges that do not actually intersect. This can happen when the wrong range operator is used in the formula, or when the intersection operator (represented by a space character) is used between two ranges that do not overlap. To fix this error double check that the ranges referenced in the formula that use the intersection operator actually have cells in common.
#SPILL error - The #SPILL! error occurs only in version Excel 365 and is caused by a dynamic array being to large, meaning there are cells below and/or to the right that are not empty. This prevents the dynamic array formula expanding into new empty cells.
#DIV/0 error - This error happens if you try to divide a number by 0 (zero) or a value that equates to zero which is not possible mathematically.
#VALUE error - The #VALUE error occurs when a formula has a value that is of the wrong data type. Such as text where a number is expected or when dates are evaluated as text.
#REF error - The #REF error happens when a cell reference is invalid. This can happen if a cell is deleted that is referenced by a formula.
#NAME error - The #NAME error happens if you misspelled a function or a named range.
#NUM error - The #NUM error shows up when you try to use invalid numeric values in formulas, like square root of a negative number.
#N/A error - The #N/A error happens when a value is not available for a formula or found in a given cell range, for example in the VLOOKUP or MATCH functions.
#GETTING_DATA error - The #GETTING_DATA error shows while external sources are loading, this can indicate a delay in fetching the data or that the external source is unavailable right now.
7.2 The formula returns an unexpected value
To understand why a formula returns an unexpected value we need to examine the calculations steps in detail. Luckily, Excel has a tool that Here is how to troubleshoot a formula:
- Select the cell containing the formula you want to examine in detail.
- Go to tab “Formulas” on the ribbon.
- Press with left mouse button on "Evaluate Formula" button. A dialog box appears.
The formula appears in a white field inside the dialog box. Underlined expressions are calculations being processed in the next step. The italicized expression is the most recent result. The buttons at the bottom of the dialog box allows you to evaluate the formula in smaller calculations which you control. - Press with left mouse button on the "Evaluate" button located at the bottom of the dialog box to process the underlined expression.
- Repeat press with left mouse button oning the "Evaluate" button until you have seen all calculations step by step. This allows you to examine the formula in greater detail and hopefully find the culprit.
- Press "Close" button to dismiss the dialog box.
There is also another way to debug formulas using the function key F9. F9 is especially useful if you have a hunch that a specific part of the formula is the issue, this makes it faster than the "Evaluate Formula" tool since you don't need to go through all calculations to find the issue..
- Enter Edit mode: Double-press with left mouse button on the cell or press F2 to enter Edit mode for the formula.
- Select part of the formula: Highlight the specific part of the formula you want to evaluate. You can select and evaluate any part of the formula that could work as a standalone formula.
- Press F9: This will calculate and display the result of just that selected portion.
- Evaluate step-by-step: You can select and evaluate different parts of the formula to see intermediate results.
- Check for errors: This allows you to pinpoint which part of a complex formula may be causing an error.
The image above shows cell reference B3 converted to hard-coded value using the F9 key. The hardcoded value is a text string and the EOMONTH function expects a number representing the Excel date. We have found what is wrong with the formula using the F9 key.
Tips!
- View actual values: Selecting a cell reference and pressing F9 will show the actual values in those cells.
- Exit safely: Press Esc to exit Edit mode without changing the formula. Don't press Enter, as that would replace the formula part with the calculated value.
- Full recalculation: Pressing F9 outside of Edit mode will recalculate all formulas in the workbook.
Remember to be careful not to accidentally overwrite parts of your formula when using F9. Always exit with Esc rather than Enter to preserve the original formula. However, if you make a mistake overwriting the formula it is not the end of the world. You can “undo” the action by pressing keyboard shortcut keys CTRL + z or pressing the “Undo” button
Other errors
Floating-point arithmetic may give inaccurate results in Excel - Article
Floating-point errors are usually very small, often beyond the 15th decimal place, and in most cases don't affect calculations significantly.
'TODAY' function examples
Table of Contents Excel monthly calendar - VBA Calendar Drop down lists Headers Calculating dates (formula) Conditional formatting Today Dates […]
This article demonstrates ways to extract names and corresponding populated date ranges from a schedule using Excel 365 and earlier […]
The image above shows the performance across industry groups for different date ranges, conditional formatting makes the table much easier […]
Functions in 'Date and Time' category
The TODAY function function is one of 22 functions in the 'Date and Time' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form