Excel Error Codes

Fix the Excel #NAME? Error in a Data Validation Lookup

Chanuka GeekiyanageChanuka Geekiyanage Nov 18, 2026 870 views

Question details

Fix a lookup formula that returns #NAME? when matching a name selected from a data validation list.

Fix the Excel #NAME? Error in a Data Validation Lookup
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the result cell

Click the cell where the email address should appear, not F4 if F4 contains the dropdown selection.

2
Enter the corrected formula

In the formula bar, enter =IF(F4="Anna","anna@example.com",IF(F4="Sally","sally@example.com",IF(F4="Diana","diana@example.com",""))).

3
Add your email addresses

Replace the example email addresses in the formula bar with the actual addresses, keeping the quotation marks around each name and address. Press Enter.

4
Test the dropdown

Select Anna, Sally, or Diana from the dropdown in F4 and check that the result cell displays the matching address.

Quote the text in the nested IF lookup
Formula separators: If Excel rejects the formula because of your regional settings, try replacing the commas between arguments with semicolons.
Work with dropdown lookups in WPS

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. 1. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
  2. 2. Select the result cell: Click the cell where you want the email address to appear. Keep the dropdown selection in F4.
  3. 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. 4. Test and save: Choose a name from the F4 dropdown, verify the result, and use File > Save to save the workbook.
Return an email address based on a dropdown selectionOpen and edit Microsoft Excel XLSX filesUse familiar spreadsheet formulas and menusWork with a free, lightweight office suite
microsoft office alternative - wps office

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.