Sub topic 12
Fixing #NULL!: incorrect range operators
This chapter assumes you can enter and edit formulas, you understand cell references and ranges such as A2:A10, and you know basic functions such as SUM and AVERAGE. By the end, you should be able to recognize a #NULL! error, find the operator that caused it, and fix the formula.
What #NULL! means
Excel returns #NULL! when a formula uses the intersection operator and the ranges on either side of it share no cells. The error usually has one of two causes:
- You meant to separate two ranges with a comma but typed a space.
- You meant to write a range with a colon but left it out or typed something else, such as a semicolon or a period.
Most #NULL! errors are typing slips. The name suggests an empty value, but the actual cause is an operator that produced an empty intersection.
The three range operators
Excel has three reference operators. #NULL! appears when you confuse them.
| Operator | Character | Meaning | Example |
|---|---|---|---|
| Range | colon `:` | One block of cells from the first reference to the second | `A1:A5` |
| Union | comma `,` | Combines several references into one | `A1:A5,C1:C5` |
| Intersection | space | Only the cells that both references share | `A1:C5 B3:D8` |
The space is the hazard. In most formulas you never want an intersection. A space between two references looks like harmless whitespace, but Excel reads it as an operator.
Note: in some regional settings the union operator is a semicolon, not a comma. This follows the same list separator that your function arguments use. If your Excel separates arguments with semicolons, use that character wherever this chapter shows a comma.
A worked example
Suppose A1:A5 holds sales for the first quarter and C1:C5 holds sales for the second quarter. You want the total of both.
This formula is wrong:
=SUM(A1:A5 C1:C5)The space between A1:A5 and C1:C5 is the intersection operator. Column A and column C have no cells in common, so the intersection is empty and the result is #NULL!.
This formula is correct:
=SUM(A1:A5,C1:C5)The comma is the union operator. SUM receives two ranges as two arguments and adds all ten cells.
When an intersection does work
An intersection is a valid feature, and it does not always return an error. If the two ranges overlap, the formula returns the overlapping cells.
Consider a small table with months across the top and regions down the side. You can name a row and a column, then intersect them to pick one cell. For example, =B2:D2 C1:C5 selects the single cell at C2, because it is the only cell in both ranges.
Two points follow from this:
- A formula with a stray space can sometimes return a wrong number instead of an error. If the ranges happen to overlap, you get a result and no warning.
- If a result looks too small or covers fewer cells than you expect, check for a space between references.
A silent wrong answer is harder to catch than #NULL!, so an error is arguably the better outcome of this mistake.
Common causes and fixes
| Cause | Example of the mistake | Fix |
|---|---|---|
| Space instead of comma between ranges | `=SUM(A1:A5 C1:C5)` | `=SUM(A1:A5,C1:C5)` |
| Missing colon inside a range | `=SUM(A1 A5)` | `=SUM(A1:A5)` |
| Wrong separator for your regional settings | `=SUM(A1:A5;C1:C5)` in a comma-based setup | Use the separator your Excel expects |
| Space between a function name and its arguments, combined with a reference | `=SUM (A1:A5 B1:B5)` | Remove the stray spaces and add a comma |
| Intersection of named ranges that do not overlap | `=Sales Costs` | Use a comma, or check that the names should overlap |
The last row is easy to miss. If you define the names Sales and Costs for two separate ranges, then type =SUM(Sales Costs), Excel treats the space as an intersection. The same happens with whole-column references such as A:A C:C.
A related case: a missing colon
Typing =SUM(A1 A5) asks for the cell shared by A1 and A5. Those are two different cells, so nothing is shared and the result is #NULL!. Replacing the space with a colon gives A1:A5, the whole block.
Diagnosing a #NULL! error
Work through these steps in order.
- Select the cell and look at the formula bar.
- Find every place where two references sit next to each other. Look for a space between them where you expected a comma or a colon.
- If the formula uses names, check whether a space separates two names.
- If the formula looks correct but still fails, press F2 to enter edit mode. Excel highlights each reference in a color, which makes it easier to see how many separate ranges it found.
- Select the suspicious part of the formula and use Evaluate Formula on the Formulas tab. You can step through it and see where the result turns into
#NULL!.
The diagram shows the decision.
Do not mask this error
Wrapping the formula in IFERROR removes the visible #NULL!, but it does not fix the formula. =IFERROR(SUM(A1:A5 C1:C5),0) shows 0, and that figure is wrong. A #NULL! error nearly always means a typing mistake, not missing data. Correct the operator instead of hiding the result.
Prevention habits
- Use the formula argument boxes. Open the Insert Function dialog and fill in each argument separately. Excel inserts the separators for you.
- Select ranges with the mouse. When you click and drag, or hold Ctrl to add a second range, Excel writes the correct operators.
- Avoid typing spaces inside formulas unless you are using an intersection on purpose.
- Add a short note beside any formula that intentionally uses an intersection, because most readers will assume the space is an error.
Check your understanding
Exercise
A worksheet has monthly costs in B2:B13 and extra charges in D2:D13. The formula =SUM(B2:B13 D2:D13) returns #NULL!. Explain why, and write the corrected formula.
Show answer
The space between B2:B13 and D2:D13 is the intersection operator. Column B and column D share no cells, so the intersection is empty and Excel returns #NULL!. To add both ranges, separate them with a comma: =SUM(B2:B13,D2:D13).
Exercise
A formula =SUM(A1 A10) returns #NULL!. The author wanted the total of everything from A1 to A10. What is the fix, and why did the original fail?
Show answer
Use =SUM(A1:A10). The space is the intersection operator, and A1 and A10 are different cells with nothing in common, so the result is #NULL!. The colon is the range operator and defines the block from A1 to A10.
Exercise
Why can a stray space between two references sometimes give a wrong number instead of #NULL!?
Show answer
If the two references overlap, the intersection operator returns the cells they share, which is a valid result. The formula then calculates on fewer cells than intended and gives no error, so you must check the operator yourself.