Fix the Excel #NAME? Error in a Data Validation Lookup
Question details
Fix a lookup formula that returns #NAME? when matching a name selected from a data validation list.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user selects a name in cell F4 and wants a formula to return the corresponding email address.
- Observed behavior
- Excel returns #NAME? because unquoted text such as Anna is interpreted as an undefined name.
Identify the cell containing the selected name and the cell where you want the email address to appear. The examples below use F4 as the selection cell; adjust the reference if needed.
Quote the text in the nested IF lookup
Use this formula when you have a short list of names and want a blank result if none matches.
Click the cell where the email address should appear, not F4 if F4 contains the dropdown selection.
In the formula bar, enter =IF(F4="Anna","anna@example.com",IF(F4="Sally","sally@example.com",IF(F4="Diana","diana@example.com",""))).
Replace the example email addresses in the formula bar with the actual addresses, keeping the quotation marks around each name and address. Press Enter.
Select Anna, Sally, or Diana from the dropdown in F4 and check that the result cell displays the matching address.

Use XLOOKUP with a name and email table
Use this option in Microsoft 365 when the names and email addresses are stored in worksheet ranges.
Fix a Dropdown Lookup in WPS Spreadsheets
Use a nested IF formula in WPS Spreadsheets to return an email address for a selected name while keeping literal text in quotation marks.
- 1. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
- 2. Select the result cell: Click the cell where you want the email address to appear. Keep the dropdown selection in F4.
- 3. Enter the formula: In the formula bar, enter =IF(F4="Anna","anna@example.com",IF(F4="Sally","sally@example.com",IF(F4="Diana","diana@example.com",""))). Replace the example addresses with your own and press Enter.
- 4. Test and save: Choose a name from the F4 dropdown, verify the result, and use File > Save to save the workbook.

Frequently Asked Questions
Why does Excel show #NAME? for a person's name?
Without quotation marks, Excel treats a name such as Anna as a defined name. If it is not defined, Excel returns #NAME?. In the formula bar, use "Anna" for literal text.
Where should I enter the email lookup formula?
Enter it in the cell where you want the email address to appear. Keep the dropdown selection in F4, or change F4 in the formula to reference your selection cell.
How can I leave the result blank when a name is not found?
Use "" as the final value in a nested IF formula, or as the fourth argument in XLOOKUP, such as =XLOOKUP(F4,A2:A4,B2:B4,"").
What should I check if the formula is rejected?
Check the quotation marks and parentheses in the formula bar. If your regional settings use semicolons as argument separators, replace the commas between formula arguments with semicolons.




