Cell formula that returns the name of a table

BrandonAS

New Member
Joined
May 20, 2014
Messages
23
Couldn't find a built in formula to do this, and didn't want to write VBA. So found a way to get the name of a table in Excel. It's a little clunky and I'm hoping for a cleaner solution,but here it is. Used three functions: MID, FORMULATEXT, and INDEX.

Have a table with name tblHarry

1. cell A1: =index(tblHarry,1,1)
2. cell A2: =MID(FORMULATEXT(A1),8,FIND(",",FORMULATEXT(A1),1)-8)

value in cell A1: 52 (this is arbitrary, it's just the value in row 1, column 1 of the table)
value in cell A2: tblHarry

FORMULATEXT(A1) returns the string value "=index(tblHarry,1,1)"
Then the MID function just pulls out the table name from the text string.

The clunky part is FORMULATEXT requires a reference to a cell, one cannot put the formula into the argument of FORMULATEXT, so it requires two formulas to get the result: The cell with the index formula and the cell with the MID(FORMULATEXT(...) formula.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Do you plan on changing the table name?

Yes, as items are added to the file, each gets it's own table. Then a bunch of calculations are done on the data in the table. Having the name of the new table in a cell allows using INDIRECT to reference table values in the formulas calculations.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top