Forum Discussion
Chan_Tze_Leong
May 11, 2021Brass Contributor
Link part of file name to Excel cell
I would like to link part of the filename to part of a cell. The name of the Excel file is Excel Mar Sample. The string in an Excel cell is "MTD Mar CY2021". I would like to like the Mar in the filen...
HansVogelaar
May 11, 2021MVP
Create a defined name FileName that refers to =GET.DOCUMENT(88)
You can then use
="MTD "&MID(FileName,FIND(" ",FileName)+1,FIND(" ",FileName,FIND(" ",FileName)+1)-FIND(" ",FileName)-1)&" CY2021"
See the attached version (now a macro-enabled workbook).
Chan_Tze_Leong
May 17, 2021Brass Contributor
Dear Hans, When I save the filename say to Apr, the output still shows Mar.
- HansVogelaarMay 17, 2021MVP
Unfortunately, that formula isn't updated automatically, you have to do that manually.
Here is another version. It uses a helper cell.
This time it is an ordinary workbook (not macro-enabled).
- Chan_Tze_LeongMay 17, 2021Brass Contributor
HansVogelaar Even though I saved as Apr, the link could not be updated.
- JMB17May 18, 2021Bronze ContributorExcel recalculates prior to saving the workbook, not immediately after (if it did, and something changed, then it would prompt the user to save it again before closing because it changed since the last save operation and could create a confusing cycle for the user). But, it will update when next excel calculates (if you save the workbook, then enter a value in any cell you will see it update). Also, it should update when the file is closed/reopened.
- Chan_Tze_LeongMay 17, 2021Brass ContributorThis will basically reside is Sharepoint/MS Teams. Can it still run?