Get the Current Workbook Name

This post explains how to get the current workbook name in excel.

Get the Current Workbook Name

In excel, the CELL function can get the information of the current worksheet, it will return the full file name and its path. If you want to get the name of the current workbook only, you can use a combination of the MID function, the CELL function and the FIND Function. Just refer to the below generic formula:

=MID(CELL("filename",B1),FIND("[",CELL("filename",B1))+1,FIND("]",CELL("filename",B1))- FIND("[",CELL("filename",B1))-1)

Let’s see how the above formula works:

The MID function will extract a sub-string from a text string at the position that you specify. It contains three arguments in MID function.

The first argument is the returned results of the first CELL function. The full workbook name and its path will be returned from the below CELL function.

=CELL("filename",B1)

Get the Current Workbook name1

The first FIND function will locate the position of the first bracket along with the workbook name. It is the second arguments as the MID function.

=FIND("[",CELL("filename",B1))

Get the Current Workbook name2

The second FIND function will return the position of the second bracket right of the workbook name.

=FIND("]",CELL("filename",B1))

Get the Current Workbook name3

The third argument of the MID function is the length of the substring that you want to extract. In other words, you need to get the length of the workbook name. Using the below formula:

=FIND("]",CELL("filename",B1))- FIND("[",CELL("filename",B1))-1

Get the Current Workbook name3

Last, we can run the following excel formula to get the current workbook name:

=MID(CELL("filename",B1),FIND("[",CELL("filename",B1))+1,FIND("]",CELL("filename",B1))- FIND("[",CELL("filename",B1))-1

Get the Current Workbook name5


Related Formulas

Related Functions

  • Excel Find function
    The Excel FIND function returns the position of the first text string (substring) from the first character of the second text string.The FIND function is a build-in function in Microsoft Excel and it is categorized as a Text Function.The syntax of the FIND function is as below:= FIND  (find_text, within_text,[start_num])…
  • Excel MID function
    The Excel MID function returns a substring from a text string at the position that you specify.The syntax of the MID function is as below:= MID (text, start_num, num_chars)…
  • Excel CELL function
    The Excel CELL function returns information about the formatting, location, size, or contents of a cell.The syntax of the CELL function is as below:= CELL (info_type,[reference])…

 

Related Posts
How to Count Numbers Nth Digit Equals to Specific Number in Excel
count number n digit number7

This post will guide you how to count numbers where the Nth digit equal to a specific number in Excel 2013/2016 or Excel office 365. How do I count of numbers in a given range where the Nth digit is ...

How to Convert Text to Time in Excel
convert text to time7

This post will guide you how to convert time string to time in Excel. Assuming that you have a list of text string in your worksheet, and you wish to convert these time string to standard time format, how to ...

How to Extract Initials From a Name in Excel
extract initials from a name2

This post will guide you how to get initials from a given name using a formula in Excel. How do I extract initials from names in Excel 2013/2016. Extract Initials from a Name Using a Formula Extract Initials from a ...

How to Extract Number from Text String in Excel
extract number from text string3

This post will guide you how to extract number from a given test string in Excel. How do I extract all numbers from string using a formula in Excel. How to get all number from a given test string using ...

How to Convert mmddyy to Date in Excel
convert mmddyyy to date9

This post will guide you how to convert non-standard date formats or text to a standard date in Excel. If you have a date with mmddyy format, and you want to change it as the normal date format as mm/dd/yyyy ...

How to Convert Military Time to Standard Time in Excel
convert military time to standard5

This post will guide you how to convert military time to standard time with a formula in Excel. How do I convert from military time 17:29:30 to regular time 5:29:30PM in Excel.  How do I Convert Standard time to military ...

How to Extract Text between Two Text Strings in Excel
extract text between two words1

This post will guide you how to extract text between two given text strings in Excel. How do I get text string between two words with a formula in Excel. Extract Text between Two Text Strings Assuming that you have ...

How to Remove Numbers from Text in Excel
remove numbers from text2

This post will guide you how to remove all numbers from a text string in one cell in Excel. How do I strip all numeric characters from a given cell with a formula in Excel. How do I remove numbers ...

How to Split Word into Different Cells in Excel
split word into different cells7

This post will guide you how to split word into different columns with a formula in Excel. How do I split word or number into separate cells with VBA Macro code in Excel 2010/1013/2016. Split Word into Different Cells with ...

Insert Character or Text to Cells
insert text to cells6

This post will guide you how to insert character or text in middle of cells in Excel. How do I add text string or character to each cell of a column or range with a formula in Excel. How to ...

Sidebar