#NUM! error in Excel: causes and how to fix it
Fix #NUM! in Excel: square roots and logs of negatives, IRR and RATE that cannot converge, LARGE and DATEDIF arguments, numbers too large to store.
#NUM! means "this number is not possible". The formula is correctly written and its inputs are numbers, but the maths has no valid answer: the square root of a negative number, a result too large for Excel to store, an argument outside the range a function allows, or an iterative calculation such as IRR that never settles on an answer. Where #VALUE! complains about the type of an input, #NUM! complains about its value. Below is every common cause with a small sheet that reproduces it and the fix. For all error values see Formula errors: what each one means and how to fix it.
What #NUM! means
Excel can store numbers between about -1.8 × 10^308 and 1.8 × 10^308, with 15 significant digits. Within that space each function has its own rules: SQRT needs a value of 0 or more, LOG needs a positive number, LARGE needs k between 1 and the number of values, dates must fall between 1 January 1900 and 31 December 9999. When an input breaks the rule, or the result leaves the storable range, you get #NUM!.
Cause 1: impossible maths (square roots, logs, fractional powers)
Square roots and logarithms of negative numbers have no real answer, and neither does a negative number raised to a power such as 1/2 or 1/4 (an even root). A typical case is a square root of a value that came out negative:
| A | B | C | |
|---|---|---|---|
| 1 | Metric | Value | Square root |
| 2 | Variance check | -16 | #NUM! |
Excel will not take an even root (here a square root) of a negative number.
Result: #NUM!
| A | B | C | |
|---|---|---|---|
| 1 | Metric | Value | Square root |
| 2 | Variance check | -16 | 4 |
If the sign is meaningless, take the root of the absolute value. Odd roots are fine: =(-8)^(1/3) returns -2.
Result: 4
=SQRT(-16)and=(-16)^(1/2)return #NUM!. If a negative value means bad data, fix the data; Excel does calculate odd roots of negatives, so=(-8)^(1/3)gives -2.=LOG(0),=LN(-5)and=LOG10(0)return #NUM!. Zero or negative values often come from blank inputs, so guard with=IF(A2>0, LN(A2), "").- Square roots of negative numbers are defined with complex numbers; IMSQRT returns
4ifor -16, if that is what you need.
Cause 2: IRR or RATE cannot find an answer
IRR, XIRR, RATE and MIRR-style calculations search for an answer by trial and error. They return #NUM! if the search does not settle within its limit of attempts, and they always fail if the cash flows never change sign, because no interest rate can make the net present value zero.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Year | Cash flow | IRR | |
| 2 | 0 | 10000 | #NUM! | |
| 3 | 1 | 3000 | ||
| 4 | 2 | 4000 | ||
| 5 | 3 | 5000 |
The initial investment was typed without its minus sign, so every flow is positive.
Result: #NUM!
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Year | Cash flow | IRR | |
| 2 | 0 | -10000 | 8.9% | |
| 3 | 1 | 3000 | ||
| 4 | 2 | 4000 | ||
| 5 | 3 | 5000 |
With the outflow negative, IRR finds 8.9% (formatted as a % with one decimal).
Result: 8.9%
Fix. Check the signs first: money you pay out is negative, money you receive is positive. If the signs are right and you still get #NUM!, give the function a guess close to the expected answer, for example =IRR(B2:B5, -0.2) for a project that loses money, or =RATE(60, -250, 12000, , , 0.01). Unusual cash flow patterns with several sign changes can have more than one valid rate, and the guess decides which one is found.
Cause 3: an argument outside the allowed range
Many functions have limits on their arguments. Asking LARGE for the fifth-largest of four numbers is a typical case, for example in a "top 5" report when only four reps have results:
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Rep | Sales | 5th best | |
| 2 | Ana | 900 | #NUM! | |
| 3 | Ben | 750 | ||
| 4 | Chen | 820 | ||
| 5 | Dana | 610 |
There are only four values, so there is no fifth largest.
Result: #NUM!
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Rep | Sales | 5th best | |
| 2 | Ana | 900 | ||
| 3 | Ben | 750 | ||
| 4 | Chen | 820 | ||
| 5 | Dana | 610 |
Show a blank until enough values exist.
Result:
Other examples of the same kind:
- SMALL with k larger than the count, or k of 0.
- NORM.INV, PERCENTILE.INC and QUARTILE.INC with a probability or quart outside 0 to 1 (or 0 to 4 for quartiles).
- DATE with a negative year, or a date before 1900-01-01 or after 9999-12-31; YEAR or MONTH of a negative serial number.
- BIN2DEC, HEX2DEC and the other conversion functions with digits that are not valid in that number system or more than 10 characters.
- COMBIN or PERMUT where the number chosen is larger than the number available.
Cause 4: DATEDIF with the dates the wrong way round
DATEDIF calculates whole years, months or days between two dates, and it requires the start date first. Swapping them is very common, and the result is #NUM!:
| A | B | C | |
|---|---|---|---|
| 1 | Hired | Review date | Years |
| 2 | 2019-04-01 | 2026-03-31 | #NUM! |
The later date is given as the start.
Result: #NUM!
| A | B | C | |
|---|---|---|---|
| 1 | Hired | Review date | Years |
| 2 | 2019-04-01 | 2026-03-31 | 6 |
1 April 2019 to 31 March 2026 is 6 complete years (the 7th year completes the next day).
Result: 6
If either order is possible, use =DATEDIF(MIN(A2:B2), MAX(A2:B2), "y"). YEARFRAC and plain subtraction (=B2-A2) do not mind the order; they return a negative number instead.
Cause 5: a result that is too large (or a number too precise)
The largest number Excel can hold is about 1.8 × 10^308. Anything beyond it gives #NUM!: =10^309, =FACT(171) (171! has 310 digits; =FACT(170) still works and returns about 7.26 × 10^306), or a compound growth formula run over too many periods. Very small results do not error; they simply become 0.
| A | B | |
|---|---|---|
| 1 | n | n! |
| 2 | 170 | 7.26E+306 |
| 3 | 171 | #NUM! |
171 factorial is larger than the biggest number Excel can store. B2 shows FACT(170) in scientific format.
Result: #NUM!
Fix. Rearrange the calculation so that huge intermediate values cancel out. For combinations, =COMBIN(200, 3) returns 1,313,400 directly, whereas =FACT(200)/(FACT(3)*FACT(197)) fails with #NUM!. For probabilities, logarithmic functions such as GAMMALN keep numbers small.
Cause 6: iteration settings
If iterative calculation is switched on (File › Options › Formulas › Enable iterative calculation) for a deliberate circular model, Excel stops after the maximum number of iterations. If the model diverges instead of converging, its values grow with every pass until they exceed the largest number Excel can store, and the cells show #NUM!. See Circular reference warning in Excel: how to find and fix it for how to set up iterative models safely, and consider replacing the circularity with an algebraic formula.
How to find every #NUM! in a workbook
- Go To Special. Press
F5orCtrl+G(the same on a Mac), click Special, choose Formulas and leave only Errors ticked, then OK. Excel selects every formula on the sheet that shows an error, of any kind. Give the selection a fill colour so the cells stay visible after you click away. - Find All. Press
Ctrl+F(Cmd+F), type#NUM!, open Options, set Look in to Values, tick Match entire cell contents, set Within to Workbook and click Find All. The list at the bottom shows sheet, cell and formula for every hit;Ctrl+Ainside the list selects them all. - Error Checking. Formulas › Formula Auditing › Error Checking jumps from one error to the next and offers Show Calculation Steps, which opens Evaluate Formula on that cell so you can see the exact step that fails.
- Trace Error. Select an error cell and choose Formulas › Error Checking (the arrow beside it) › Trace Error. Red arrows lead back to the cell where the error started; blue arrows show the healthy inputs. Errors travel downstream, so fixing the first cell often clears dozens of others.
- Count them with a formula.
=COUNTIF(B2:B500, "#NUM!")counts the cells in a range that show this error, and=SUMPRODUCT(--ISERROR(B2:B500))counts every kind of error. Put the count next to a report total as an early-warning light. - Check inputs at the boundary. #NUM! often appears for just one row: the one with a zero, a negative value or a reversed date. Sort or filter the input column to look at the smallest and largest values.
When you should NOT hide #NUM!
- Financial models. An IRR of #NUM! usually means the cash flow signs are wrong. Replacing it with 0% suggests the project breaks even, which is a different statement from "cannot be calculated".
- Data quality checks. A #NUM! from SQRT or LOG flags a negative or zero value where none should exist, often a typing or import error.
- Dates. A DATEDIF #NUM! means the dates are in the wrong order; hiding it hides a data entry problem such as an end date before a start date.
- It is fine to show a blank for cases you have understood, like the top-5 list with only four names.
Version notes
- #NUM! exists in every version of Excel and in other spreadsheet programs.
- The numeric limits (about 1.8 × 10^308, 15 significant digits) are the same in all current versions on Windows, Mac and the web.
- DATEDIF is an old compatibility function: it works in every version, but AutoComplete does not offer it, so you have to type it in full.
- Excel's 1900 date system cannot show dates before 1 January 1900; Excel for Mac files that use the 1904 date system start on 1 January 1904.
Check yourself
1. =IRR(B2:B6) returns #NUM! and all five cash flows are positive. What is the fix?
IRR needs at least one negative and one positive cash flow.
2. Which formula returns #NUM!?
The start date is later than the end date.
3. Why does =FACT(171) return #NUM!?
171! is larger than about 1.8 × 10^308.
4. Which formula returns #NUM!?
A negative number has no real square root, so ^(1/2) gives #NUM!. Odd roots work: =(-8)^(1/3) returns -2.