Get Path and Workbook name only

Generally, the Cell function returns the full file name contain workbook and worksheet name and it is absolute path.

If you want to get the workbook name and its path only without worksheet name, you can use a combination of the SUBSTITUTE function, the LEFT function, the CELL function and the FIND function.

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

The CELL function will get the full information of the current worksheet contain the full file name and its path.

=CELL("filename",B1)

Get the Current Worksheet Name only11

As you just want to extract the string that contain only the path and workbook name, so using the FIND function to get the position of the right bracket symbol. Then you can get the length of the path and workbook name only using the below Find formula:

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

Get Path and Workbook name only1

The LEFT function will get the leftmost the text characters based on the length of the string returned by the above FIND formula.

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

Get Path and Workbook name only2
Last, you still need to use SUBSTITUTE to replace the left bracket symbol within the result returned by the first CELL function.

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

Get Path and Workbook name only3


Related Formulas

  • Get the Current Worksheet Name only
    If you want to get the current worksheet name only in excel, you can use a combination of the MID function, the CELL function and FIND function.…
  • Get full File Name (workbook and worksheet) and Path
    In excel, you can get the current workbook name and it is absolute path using the CELL function.  Just refer to the following formula:=CELL(“filename”,B1).…
  • Get the Current Workbook Name
    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…

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 LEFT function
    The Excel LEFT function returns a substring (a specified number of the characters) from a text string, starting from the leftmost character.The LEFT function is a build-in function in Microsoft Excel and it is categorized as a Text Function.The syntax of the LEFT function is as below:= LEFT(text,[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])…
  • Excel Substitute function
    The Excel SUBSTITUTE function replaces a new text string for an old text string in a text string.The syntax of the SUBSTITUTE function is as below:= SUBSTITUTE  (text, old_text, new_text,[instance_num]) ….
Related Posts
How to Remove All Asterisk Characters from Cells in Excel
How to Remove All Asterisk Characters7

Sometimes when we opening an excel spreadsheet to check data, we may notice that there are some asterisks exist in texts for security or other reasons. If you feel these special characters are invalid you can remove them from cells. ...

How to Convert Date Format from Dot MM.DD.YYYY to Slash MM/DD/YYYY in Excel
Convert Date Format from Dot to Slash 6

We often enter dates in excel tables, and we can enter current date by quickly press ‘Ctrl+;’ simultaneously. If in some cases we enter a date format that is not what we want, we have to switch the date format ...

How to Remove Quotes for Text or Strings in Excel
How to Remove Quotes 8

When we importing data from other source into Excel we may import quotes or quotations from initial file. And we want to remove these quotes from current file, if we remove them one by one it needs a lot of ...

How to Remove Specific Character from Text Cell in Excel
remove specific character from text string6

This post will guide you how to remove a specific character from text cell in Excel. How do I remove certain character from a cell with a formula in Excel 2013/2016. Remove Specific Character Using Find and Replace function Remove ...

How to Count Comma Separated Value in One Cell in Excel
count value separated by comma2

This post will guide you how to count values in a single cell separated by commas with a formula in Excel. How do I count comma separated values in one cell in Excel 2013/2016. Is it possible to have a ...

How to Count the Number of Letters or Numbers separately in a Cell in Excel
count number of letters3

This post will guide you how to count the number of a given character in a cell in Excel. How do I count only numbers within a single cell excluding all letters and other characters with a formula in Excel. ...

How to Remove the First/Last Word from Text string in Cell
remove first last word in cell2

This post will guide you how to remove the first and the last word from a text string in cells in Excel. How do I use a formula to remove first and last word of a text string in Excel. ...

How to Remove Line Breaks (Carriage Returns) in Excel
remove line breaks9

This post will explain that how to remove line breaks in your data set in Excel. How do I remove carriage returns or line breaks with a formula in Excel. How to remove line breaks with VBA Macro in Excel. ...

How to Convert DD-MM-YYYY text string or date to a standard date format in Excel
convert ddmmyyy test to date format1

This post will guide you how to convert dd-mm-yyyy test string or a date to a standard date format mm/dd/yyyy with a formula in Excel. Convert Text DD-MM-YYYY to Date Format Video: Convert DD-MM-YYYYY to Standard Date Format Convert Text ...

How to convert Column Letter to Number in Excel
convert column letter to number8

This post will guide you how to convert column letter to number in Excel. How do I convert letter to number with a formula in Excel. How to convert column letter to number with VBA macro in Excel. How to ...

Sidebar