In Excel there is no built in function to check and return a result for the workbooks name. Even though it may be in clear sight to a user at the top of the screen, there may be situations where the workbooks name is required to be referenced against, such as counting the number of times the workbooks name appears in a range for example. This formula does not return the file path or extension, just simply the workbooks name.
This straightforward UDF must be copied and pasted into a VBA Module for it to become a ‘standard’ formula in your current workbook.
To use it, simply choose any cell and type the formula, including the () at the end:
Feel free to send us a question or leave a comment below and we’ll answer your query in the open !
Function MyName() As String
MyName = ThisWorkbook.Name