I was wondering this week how to automatically link the contents of a cell to the worksheet name and found that you can use the CELL function.

Rather than enter the text independently into the both cell and worksheet name, you can use CELL to obtain workbook and worksheet information then FIND to return just the worksheet name.

The CELL function provides detail associated with the defined cell including file name and worksheet name

A1 is used as it is the first cell in the worksheet.

A < A function >
1 folderpath\[filename]worksheetname =CELL(“filename”,A1)


So if I have a worksheet called ‘Server List – Data Centre 1

A < A function >
1 folderpath\[filename]Server List – Data Centre 1 =CELL(“filename”,A1)


Add FIND to locate the ] and only return data after – resulting in just the worksheet name:

A < A function >
1 Server List – Data Centre 1 =MID(CELL(“filename”,A1),FIND(“]”,CELL(“filename”,A1))+1,255)

+1 means to start with the first character after the ], the 255 references the last character to return:

A < A function >
1 Server List =MID(CELL(“filename”,A1),FIND(“]”,CELL(“filename”,A1))+1,11)


  • The formula will not return valid results if you use it in a new workbook that hasn’t been saved. You need to save the workbook, close it then reopen so the information can be returned by the CELL function successfully.
  • It also will not work properly if the workbook or worksheet name contains the right bracket ‘]


Thanks to Allen Wyatt’s blog for the help: http://excelribbon.tips.net/T011419_Getting_the_Name_of_the_Worksheet_Into_a_Cell.html