Tag: excel

  • Excel code snippets for file, path and tab names in cells

    From xlDynamic.com

    File path, file and worksheet name:

    =CELL("filename",A1)

    File path only:

    =LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1)

    File name only:

    =MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,

    FIND("]",CELL("filename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

    The sheet name:

    =MID(CELL("Filename",A1),FIND("]",CELL("Filename",A1))+1,255)

    Restriction: this technique only works for workbooks that have been saved at least once.