Technical Anshu
Tutorials Blog
Excel Fix

SpellNumber Shows NAME Error in Excel and the Fix Is Module Placement

The code is pasted, the formula is typed exactly right - and the cell answers with a cold #NAME?. Before you doubt the code, doubt its address. In Excel, where VBA code lives decides whether a formula is allowed to use it at all.

By Technical AnshuMicrosoft ExcelTwo minute fix
Watch the full video - the add-in installed and =SPELLNUMBER working live, step by step

This error has a reputation for wasting afternoons, because everything looks correct. The code is present, the spelling matches - and yet. Work through this page in order: what the error means, the one placement mistake behind most cases, the two-minute move, and the short checklist for the rest.

The error - and where the code is sitting
B2  =SPELLNUMBER(A2)#NAME?
Code pasted under Sheet1 in the VBA editorWILL NOT WORK
Code pasted in Module1 (Insert - Module)WORKS

The NAME error usually means the function exists - just in a place worksheet formulas are not allowed to look.

1

What the NAME Error Is Actually Telling You

#NAME? is Excel saying: I do not know anything with that name. The formula is typed fine. The amount is fine. Excel simply cannot find a function called SPELLNUMBER available to this workbook.

That narrows the cause to a short list: the code is in the wrong place, the code is switched off, or the code is in a different file from the one you are looking at. Nine times out of ten it is the first one.

2

The Number One Cause - Code Pasted Into a Sheet Module

Open the VBA editor with Alt + F11 and look at the tree on the left. Every sheet has its own code window, and double-clicking Sheet1 opens it invitingly - so that is where most people paste.

Code in a sheet's window belongs to that sheet's private events. Worksheet formulas are not allowed to call functions from there - nor from the ThisWorkbook window. A custom function becomes a real Excel function only when it lives in a standard module: a module you add yourself with Insert then Module. Same code, same file - one window works, the other silently does not.

3

Move the Code - Two Minutes

  1. Press Alt + F11 and open the window where your code is sitting now - usually Sheet1
  2. Select all the code (Ctrl + A) and cut it (Ctrl + X)
  3. Click Insert then Module - a new Module1 window opens
  4. Paste (Ctrl + V) and go back to the sheet
  5. Click the error cell, press F2 then Enter to make Excel try the formula again - the words appear

Proof you did it right: press Shift + F3 (Insert Function), choose the User Defined category - SpellNumber is listed there when Excel can truly see it.

4

If the Module Is Right and It Still Fails

Work down this short list:

  1. Macros are disabled - a blocked function reports as #NAME? too. Enable content for your own file, or see the macros-blocked page in this series if the bar is red
  2. The add-in got unticked - if your function comes from an add-in file, check File then Options then Add-ins then Go - the tick must be on, and the add-in file must still be in the folder Excel remembers
  3. You saved as .xlsx - the format strips code on saving; the function is gone, not hidden. The XLSM page in this series covers it
  4. A spelling slip - the function is called SpellNumber; Excel ignores capital letters but not missing ones

Watch the Full Video

See the file downloaded, the add-in switched on and the formula typed live - the complete method in about a minute.

Watch Full Video
Common Questions

The function worked yesterday and shows NAME today. What changed?

Something removed or disconnected the code between then and now: the file was saved as .xlsx which strips code, the add-in was unticked or its file moved, or the workbook was opened with macros blocked. Check in that order - format, add-in tick, security bar - before touching the code itself.

I can see SpellNumber written in the VBA editor. Why can the formula not see it?

Because the editor shows every window in the file, including sheet modules and ThisWorkbook, and functions in those windows are private to them. Formulas can only call functions in a standard module - the kind added with Insert then Module. Move the code there and the same formula works unchanged.

Does the function appear in formula autocomplete when it is installed properly?

Yes. Once the code sits in a standard module (or the add-in is ticked), SpellNumber appears in the Insert Function dialog under the User Defined category, and typing =Spell offers it in autocomplete. If it is missing from both places, Excel has not loaded it - placement, add-in tick or macro security is the reason.

This guide is based on the Technical Anshu video on converting numbers to words in Excel - if a step gets stuck, ask in the video comments and you will get an answer.