+ Reply to Thread
Results 1 to 5 of 5

File name only in cell?

Hybrid View

  1. #1
    Registered User
    Join Date
    09-08-2009
    Location
    Norfolk, UK
    MS-Off Ver
    Excel 2003
    Posts
    3

    File name only in cell?

    Is it possible to set a cell equal the the file name of the Excel file?

    I know you can set it equal to the full path but I want the file name only!

    Thanks, Ben

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: File name only in cell?

    Try this:

    =MID(CELL("FILENAME",F10),FIND("[",CELL("FILENAME",F10))+1,FIND("]",CELL("FILENAME",F10))-FIND("[",CELL("FILENAME",F10))-1)
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    09-08-2009
    Location
    Norfolk, UK
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: File name only in cell?

    Wow........thanks Dave.

    Is it possible to get rid of the '.xls' too?

    Cheers, Ben

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: File name only in cell?

    Yes,

    but this will only work for .xls files - not .xlsx or .xlsm

    =SUBSTITUTE(MID(CELL("FILENAME",F10),FIND("[",CELL("FILENAME",F10))+1,FIND("]",CELL("FILENAME",F10))-FIND("[",CELL("FILENAME",F10))-1),".xls","")

  5. #5
    Registered User
    Join Date
    09-08-2009
    Location
    Norfolk, UK
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: File name only in cell?

    That's OK.

    Thanks again for you help.

    Ben

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1