Forum Discussion
Sgreever
Jan 17, 2025Copper Contributor
Is there a formula / function for displaying the "Name" of a reference cell?
I am trying to see if there is an Excel function to display the "Name" of another cell. I looked through all of the options using the =CELL() function (there are many) but none seem to return the "N...
SergeiBaklan
Jan 20, 2025MVP
With Office Script names and related ranges could be shown with
function main(workbook: ExcelScript.Workbook) {
const names = workbook.getNames()
let items: string[][] = []
items.push( ["Name", "Range"] )
names.forEach( (item) => {
if (!item.getName().startsWith("_xl") ) {
items.push(
[
item.getName(),
"'" + item.getFormula()
] )
}
}
)
workbook.getWorksheet("List of Names")
.getRange("D2")
.getAbsoluteResizedRange(items.length,2)
.setValues(items)
}
PeterBartholomew1
Jan 20, 2025Silver Contributor
I was just about to message you to ask for a TypeScript version! You must have read my mind.🙃