Sub topic 7
Fixing #NAME?: misspelled names and functions
This chapter assumes you can enter and edit formulas, you understand cell references and ranges such as A2 and A2:A10, and you know basic functions such as SUM, AVERAGE and VLOOKUP. It also assumes you can tell numbers from text in a cell.
What #NAME? means
Excel returns #NAME? when it reads a piece of your formula as a name and cannot find anything with that name. A name can be a function such as SUM, a defined name you created for a cell or range, a table name, or a column name inside a table. If Excel cannot match the text to any of these, it stops and shows #NAME? instead of a result.
The error is about recognition, not about the data. The cells your formula points to may be perfectly fine. The formula itself contains something Excel does not understand.
Here is the most common case, a misspelled function:
=SUMM(A1:A5)SUMM is not a function, so Excel returns #NAME?. Correcting it to the following fixes the error:
=SUM(A1:A5)Common causes
| Cause | Example | Fix |
|---|---|---|
| Misspelled function | `=SUMM(A1:A5)` | Correct the spelling: `=SUM(A1:A5)` |
| Misspelled defined name | `=Total_Sles*0.2` | Match the name in Name Manager |
| Text without quotation marks | `=IF(A2=Yes,1,0)` | Write `"Yes"` in quotes |
| Missing colon in a range | `=SUM(A1A5)` | Write `A1:A5` |
| Function not available in your version | `=XLOOKUP(...)` in an older Excel | Use a supported function such as INDEX and MATCH |
| Deleted or out-of-scope name | A name was removed or belongs to another sheet | Recreate the name or fix its scope |
| Table or column name that no longer exists | `=SUM(Sales[Amnt])` | Use the real column name |
Each row has the same underlying reason: Excel looked for a name and found nothing.
Fixing a misspelled function
Excel gives you help here, so use it instead of typing everything by hand.
- Click the cell that shows #NAME? and look at the formula bar.
- Check each function name for typos. Functions are not case sensitive, but the letters must be right.
- Retype the function name and watch the autocomplete list that appears under the cell. Pick the correct entry with Tab.
- Press Enter.
A useful habit: type function names in lowercase. Excel converts a valid function name to uppercase when you press Enter. If the name stays lowercase after you commit the formula, Excel did not recognize it. This is a quick visual test for a typo.
=sum(A1:A5)After Enter this becomes =SUM(A1:A5). Typing =summ(A1:A5) stays lowercase and returns #NAME?.
Fixing text that is missing quotation marks
Text inside a formula must be wrapped in double quotation marks. Without them, Excel treats the word as a name.
=IF(B2=Paid,"Done","Open")Excel looks for a name called Paid, finds none, and returns #NAME?. The corrected formula is:
=IF(B2="Paid","Done","Open")The same problem appears when you copy formulas from a web page or document. Word processors often replace straight quotation marks with curly ones. Excel does not accept curly quotes as text delimiters, so it reads the contents as names. If a formula looks right but returns #NAME?, delete the quotation marks and retype them directly in Excel.
Fixing range typos
A range needs a colon between its two cells. If you leave it out, Excel reads the text as a single name.
=SUM(A1A5)A1A5 is not a valid cell reference, so Excel treats it as a name and returns #NAME?. Writing A1:A5 fixes it.
A related mistake is a column reference to a sheet name with spaces. Sheet names containing spaces or special characters must be wrapped in single quotes, for example 'Q1 Sales'!A2. Excel adds the quotes for you when you click the cell, so it is safest to build references by clicking instead of typing them.
Defined names and Name Manager
A defined name is a label you give to a cell, a range or a formula, such as TaxRate. Formulas that use it, like =A2*TaxRate, are easier to read. If the name is misspelled, deleted or not visible from the current sheet, the formula returns #NAME?.
To check what names exist:
- Open the Formulas tab.
- Choose Name Manager.
- Look at the Name column for the exact spelling, and at the Scope column.
Scope matters. A name with workbook scope works on every sheet. A name with sheet scope works only on the sheet it belongs to, so using it from another sheet returns #NAME? unless you write the sheet name first, as in Sheet1!TaxRate.
To insert a name without typing it, click the cell where you want it, go to Formulas, choose Use in Formula, and pick the name from the list. You can also press F3 while editing a formula to paste a name.
=A2*TaxRateIf TaxRate was deleted, every formula that uses it returns #NAME?. Recreating the name with the same spelling restores all of them at once, with no need to edit each formula.
Functions your version of Excel does not have
Newer functions such as XLOOKUP, FILTER, SORT, UNIQUE and LET exist only in recent versions of Excel. If you open a workbook in an older version, a formula using them cannot be evaluated, and it shows #NAME?. The formula is spelled correctly, but your copy of Excel does not know the function.
Two ways to handle this:
- Update Excel, or open the file in a version that supports the function.
- Rewrite the formula with an older function. For a lookup, INDEX and MATCH work in all versions.
=INDEX(B2:B100,MATCH(E2,A2:A100,0))This returns the value from column B in the row where column A matches E2. It does the same job as =XLOOKUP(E2,A2:A100,B2:B100) and works in older versions.
Add-in functions are a similar case. A function supplied by an add-in, or by a macro in another workbook, returns #NAME? when the add-in is not loaded or the other workbook is closed.
Table and column names
When you work in an Excel table, formulas can use structured references such as Sales[Amount]. If you rename a column header, Excel usually updates formulas automatically. If you type the reference by hand and misspell the table or column name, you get #NAME?.
=SUM(Sales[Amnt])If the column header is Amount, this returns #NAME?. Correct the spelling:
=SUM(Sales[Amount])Finding the cause systematically
When the cause is not obvious, work from the simplest check to the most detailed one.
The last step uses a tool covered in a later chapter. Evaluate Formula, on the Formulas tab, runs the formula one piece at a time, so you can see which piece turns into #NAME?.
You can also use Error Checking, which puts a small green triangle in the corner of the cell. Selecting the cell shows a warning icon, and its menu offers help for the specific error.
Common mistakes when fixing #NAME?
- Wrapping the formula in IFERROR before finding the cause. This hides the error, but the formula is still broken and will return the fallback value forever.
- Retyping a long formula from scratch instead of reading it. Most #NAME? errors come from a single wrong character.
- Assuming the data is at fault. A #NAME? error rarely depends on cell values. Look at the formula text first.
- Forgetting that a name can be deleted by someone else. If a formula that worked yesterday now fails everywhere, check Name Manager.
Do not use IFERROR as the fix here. The IFERROR function replaces any error with a value you choose, including a #NAME? caused by a typo, so a broken formula can look like a normal result. Fix the spelling or the name instead.
Summary of the fix
- Read the formula text in the formula bar.
- Check every function name, defined name and table name for spelling.
- Check that text values are in straight double quotation marks.
- Check that ranges include a colon.
- Check Name Manager for deleted names or the wrong scope.
- Confirm your version of Excel supports the function.
Exercise
A formula =IF(C2=Approved,"Yes","No") returns #NAME?. What is the cause, and what is the corrected formula?
Show answer
Approved is not in quotation marks, so Excel looks for a name called Approved and does not find one. The corrected formula is =IF(C2="Approved","Yes","No").
Exercise
A colleague opens your workbook in an older version of Excel. Cells that contain =XLOOKUP(E2,A2:A100,B2:B100) show #NAME?, although the spelling is correct. Why does this happen, and how can you fix it?
Show answer
The older version does not include XLOOKUP, so it cannot recognize the function name. Update Excel, or replace the formula with an older equivalent such as =INDEX(B2:B100,MATCH(E2,A2:A100,0)).
Exercise
You use the name TaxRate in a formula on Sheet2 and get #NAME?. Name Manager shows TaxRate exists with Scope set to Sheet1. What are two ways to fix it?
Show answer
Refer to the name with its sheet, as in =A2*Sheet1!TaxRate, or recreate the name with workbook scope so every sheet can use it.