Sep 17 2020 05:23 PM
I have a standard header I put on almost every excel workbook I create I have been using for years. It includes several standard items, including Workbook name and Worksheet name, which are extracted via CELL("Filename",A1) formula.
For Excel workbooks that are being viewed in Excel Online, however, whether through onedrive, sharepoint, or whatever, this formula yields a #VALUE! error. When I open in desktop, it renders fine, just not when looking at browser window.
Is there an alternative that I can use to display current workbook and worksheet names via a formula in a cell that is compatible with Excel Online?
Sep 17 2020 11:38 PM - edited Sep 17 2020 11:39 PM
you need to create a Name like "SheetName" and use GET.CELL(32,A1) in the Refers To area. Whenever you need the sheet name you need to type "=SheetName" in the cell and you will get workbook and sheet name.
This is a Excel 4 Macro and not being supported. You can use it in Names though.
Sep 18 2020 01:34 AM
SolutionAfraid for Excel Online that's only with Office Script, there are properties getName both for workbook and worksheet.
VBA and related functions don't work in Excel Online.
Sep 18 2020 03:27 AM
Read out the designation / name of the worksheet
Read out by formula
The focus of the formula solution is the CELL function (infotype; reference). In addition to the file name and the full path, the File Name infotype also returns the name of the worksheet. This is extracted using further functions so that only the sheet name is output at the end.
The result is achieved with these two formulas:
(formulas are from German Translate)
a) = PART (CELL ("filename"; A1); FIND ("]"; CELL ("filename"; A1)) + 1; 255)
or
b) = PART (CELL ("filename"; A1); FIND ("]"; CELL ("filename"; A1)) + 1; LENGTH (CELL ("filename"; A1)) - FIND ("]"; CELL ("filename"; A1)))
2. Read out via VBA
The following VBA function reads out the sheet name via VBA and displays it in a cell. To do this, enter the following code in a code module.
Public Function sheetname () As String
Application.Volatile
sheetname = ActiveSheet.Name
End function
If you now enter the function = sheetname () in a cell, the sheet name is read out and output in the corresponding cell.
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.
Sep 18 2020 04:43 AM
@NikolinoDE , VBA doesn't work with Excel Online
Sep 18 2020 04:48 AM
Sep 18 2020 10:37 AM
@Sergei Baklan Hmm, wasn't aware of office scripts. From my 30 seconds of research it looks like they are 1) pretty new, 2) basically VBA/macros for online
If I did an office script to accomplish this functionality, does that in any way translate to the workbook when I download it?
Such a simple thing. Seems weird to have to use an online-specific solution. As an aside, do you happen to know why CELL doesn't work online?
Sep 18 2020 11:46 AM
Does Office 365 Excel support VBA?
All versions of Windows desktop Excel from Excel 5 through Excel 2019 support VBA.
This includes the version of Excel installed by Office 365. ...
There is no version of Excel Online, iOS Excel or Android Excel that supports VBA.
Nor does any version of Excel that runs on Windows RT support VBA.
In my humble opinion, it would be good to always have the possibility of VBA in Excel.
All new options such as editing PDF and cloud options, in all future versions, will be require VBA.
Unless someone has already adjusted to Java script ... which I don't hope.
What I don't know is, if you maybe can open from the Developer tab in Visual Basic editor, I don't have Office 365 yet. You can try it, maybe…maybe it will work.
The sequence is in Excel 2016
Click File
Click Options
Click Customize Ribbon
Under the list of Main Tabs, select Developer
Click OK
The Developer tab will now appear on the Ribbon and from it you can open the Visual Basic Editor.
If opening the Developer tab and clicking a button is a little too much work, you can also open the editor with the keyboard shortcut Alt+F11, which works whether the Developer tab is enabled or not.
As I told you before, with the logic of Excel 2016.
Nikolino
I know I don't know anything (Socrates)
Sep 18 2020 01:26 PM
You are right, Office Script is relatively new functionality available only for targeted tenants, that means not for everyone so far. And yes, basically they have the same role as VBA/macro for desktop versions, but that's totally different technology. Since the engines which runs online and desktop versions are different.
Back to question, Excel Online has limited functionality compare to desktop version which, however, is expanded quite fast. To my knowledge there is no built-in function which allows to return file/sheet name.
Sep 18 2020 03:19 PM
Sep 19 2020 03:37 AM
- you may always check if function available for online version or not here Excel functions (alphabetical) In particular, what it says for CELL
- you may vote for the idea to add CELL() for the online version here CELL function added to online . In theory more votes more chances it'll be added.
- Perhaps one day functionality of desktop and online versions will be synced, at least that's how I understand Microsoft intention. But with that most probably not VBA will go online but Office Script will go on desktop. That's a long way.
Nov 20 2020 10:34 PM
@NikolinoDE Before moving to Office 365 I used this function to include the workbook name in the Heading of the Workbook (not in the header) so new versions automatically pick up the right name. It almost works in 365, using =MID(CELL("filename"),SEARCH("[",CELL("filename"))+1, SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-6) but as soon as I open a 2nd workbook it changes the content of the cell in the 1st workbook to the filename of the newly opened workbook. Very frustrating and confusing!
Nov 21 2020 01:01 PM
Excel
Feature availability
Thank you for your patience and time.
Wish you a nice day / night with lots of health, joy and love.
Nikolino
I know I don't know anything (Socrates)
Nov 21 2020 02:04 PM
You may vote here CELL function added to online for this function. More votes sooner it could appear.
May 26 2021 11:16 PM
Jul 19 2021 04:16 AM
Jul 19 2021 07:46 AM
If you had some value in last saved in desktop version file, it is shown in Online version from cache till you recalculate worksheet. After that an error.
Dec 29 2022 09:26 AM
Dec 29 2022 09:39 AM
You may sync online regional settings with your local one in File->Options->Regional Format Settings
Jan 17 2023 09:20 AM
Thanks to the help above the following formula worked for me.
=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))
CELL("filename",A1) returns the full path filename and worksheet name with the work book in square brackets []
LEN (string) gives the length of a string
FIND (string1, string2)returns the position from the left of the first occurrence of string1 in string2.
RIGHT(string ,n) gives the last n characters counting from the right.