Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Formula to Get Table Name: Step-by-Step Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Excel does not have a built-in formula that returns the name of the table a cell belongs to. The closest you can get is a short formula that returns the name of the Excel Table object itself when you are inside a table, or a formula that returns the name of the worksheet. If you need the actual table name, the reliable approach is to use a defined name, a small macro, or the Table Design tab. This guide explains what each method does, when to use it, and how to avoid the common errors that make people think a table-name formula exists.

What You'll Need

  • Excel for Microsoft 365, Excel 2021, 2019, or 2016 on Windows or Mac. The steps below use the desktop app because the Table Design tab and Name Manager are not available in Excel for the web in the same form.
  • A worksheet that contains at least one Excel Table (created with Insert > Table or Ctrl+T).
  • Basic familiarity with the Name Box, the formula bar, and the Table Design tab.

Step-by-Step

  1. Confirm the range is a real Excel Table, not just formatted cells. Click any cell inside the data. If the Table Design tab appears on the ribbon, it is a table. If you only see the Home tab and a colored fill, it is a formatted range and has no table name. Select the range and press Ctrl+T (Windows) or Command+T (Mac), confirm the range, and make sure My table has headers is ticked.
  2. Read the table name from the Table Design tab. With a cell selected inside the table, open Table Design. The Table Name box sits at the far left of the ribbon. That is the name Excel uses in formulas, and it is the value you will return if you build a helper formula.
  3. Use the Name Box for a quick check. Click inside the table and look at the Name Box to the left of the formula bar. It shows the table name when the active cell is inside a table. This is a display, not a formula, so it will not update a cell for you.
  4. Create a helper cell that returns the table name with a formula. Excel has no direct TABLE() function, but you can use a defined name that points to the table and then return that name with a formula. Go to Formulas > Name Manager > New. In Name, type a label such as TableNameHelper. In Refers to, type the table name exactly as shown in Table Design, for example =SalesData. Click OK. In any cell, enter =TableNameHelper. Excel returns the table name as text. This works because a defined name that refers to a table returns the table object, and Excel displays its name.
  5. Return the worksheet name instead if that is what you actually need. If your real goal is to label a report with the sheet a value came from, use =CELL("filename",A1). It returns the full path and sheet name, for example C:\Reports\[Book1.xlsx]Sheet1. Wrap it in MID and FIND to strip the path: =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255). This is a formula, but it returns the sheet name, not the table name.
  6. Use a short macro if you need the table name dynamically for many cells. Press Alt+F11 (Windows) or Option+F11 (Mac) to open the editor, insert a module, and add a function such as: Function TableName(r As Range) As String: Dim lo As ListObject: For Each lo In r.Worksheet.ListObjects: If Not Intersect(r, lo.Range) Is Nothing Then TableName = lo.Name: Exit Function: Next: TableName = "": End Function. Save the workbook as .xlsm, then call =TableName(A1) from any cell inside the table. This is the only method that returns the table name from a cell reference without manual setup per table.
  7. Test the result. Change the table name in Table Design and press Enter. The defined-name formula and the macro formula should both update. If they do not, the reference is pointing at a fixed text string rather than the table object.

Common Mistakes

  • Expecting a built-in TABLE() function. Excel does not have one. Any page that shows =TABLE() or =TABLENAME() as a native formula is describing a custom macro, not a built-in function.
  • Using a formatted range instead of a table. A range with banded rows and a filter has no name. Only Insert > Table creates a ListObject with a name.
  • Typing the table name as text in the defined name. If Refers to contains "SalesData" with quotes, the formula returns that literal text and will not update when the table is renamed. Refer to the table without quotes.
  • Forgetting the workbook must be macro-enabled. A .xlsx file will drop the VBA function when saved. Use .xlsm and keep macro security settings in mind.
  • Confusing sheet name with table name. CELL("filename") returns the sheet, not the table. They are different objects and need different methods.

Tips

  • Give tables short, unique names with no spaces. Excel converts spaces to underscores, which makes formulas harder to read.
  • Use structured references inside the table, such as =SUM(SalesData[Amount]), so formulas stay readable and survive row additions.
  • If you only need the name for a label, type it once in a cell and reference that cell. It is simpler and less fragile than a macro.
  • Keep a small helper sheet that lists each table name and its sheet. It doubles as documentation when workbooks grow.
  • When sharing a workbook, note that macros may be blocked by default. Tell recipients to enable macros only if they trust the file.

Troubleshooting

  • The formula returns #NAME?. The defined name or the macro function is not recognized. Check spelling in Name Manager, and confirm the workbook is saved as .xlsm and macros are enabled.
  • The formula returns a fixed name after renaming the table. The reference is a text string, not a table object. Edit the defined name so Refers to points to the table itself.
  • The macro returns an empty string. The cell you passed is outside the table range. Pass a cell that is inside the table, or adjust the Intersect check.
  • Table Design does not appear. The selected range is not a table. Create one with Ctrl+T, then retry.
  • CELL("filename") returns a blank or #VALUE!. The sheet has not been saved yet, or the reference cell is invalid. Save the workbook and point the formula at a valid cell on the same sheet.

Frequently Asked Questions

Is there a native Excel function that returns the table name?

No. Excel has no built-in function for this. You can return the table name through a defined name that refers to the table, or through a short VBA function. Anything else is returning the sheet name or a typed text value.

Can I get the table name without macros?

Yes, for a single table. Create a defined name in Name Manager that refers to the table, then use that name in a cell. For many tables, you would need one defined name per table or a macro.

Why does my formula return the sheet name instead of the table name?

You are probably using CELL("filename"), which returns the workbook path and sheet name. That function does not know about tables. Use the defined-name or macro method for table names.

Does this work in Excel for the web?

Partially. Excel for the web supports tables and some defined names, but the Table Design tab and VBA are limited or unavailable. For full control, use the desktop app.

Will the table name update if I rename the table?

Yes, if the formula refers to the table object through a defined name or a macro. It will not update if the name was typed as text.

Can I use this to list all tables in a workbook?

Not with a single formula. A macro can loop through worksheets and ListObjects to list every table name, but that requires VBA and a macro-enabled file.