Sunday, April 23, 2017

Worksheet Name

Formula construction


There may come a time when you need to display the name of a worksheet.

This formula will do the job:
=MID(CELL("filename",$A$1),FIND("]",CELL("filename",$A$1))+1,31)

=CELL("filename",$A$1) 
returns the path, the Workbook name and the Worksheet name. (C:\Documents\[April.xls]\Costs)
=MID(text,start_num,num_chars) 
selects the text that starts at a certain point and goes on for a certain number of characters.

The formula, as written, looks at the full path and selects the first time a closing bracket (]) is found.

It then moves 1 character to the right and displays the results up to 31 characters.
(A worksheet name cannot be more that 31 characters long.)

You could include a reference to that cell on other worksheets.



See all Topics

No comments: