Hi,
I'm trying to use the CELL function to return the sheet name and it doesn't seem to work.
In experimenting if I use..
=CELL("filename",a1)
in A1 I don't see anything in the cell.
When I use F9 to evaluate it I see "".
Soooo I'm assuming a blank is returned.
The question is of course "Why" and what can I do to get the filename please?
TIA
Lisa
CELL function returns blank
-
- Administrator
- Posts: 78463
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: CELL function returns blank
If you are working in a new, unsaved workbook, =CELL("filename",A1) will return an empty string.
But if the workbook has been stored to disk, you'll get something like
C:\Folder\Subfolder\[WorkbookName.xlsx]SheetName
But if the workbook has been stored to disk, you'll get something like
C:\Folder\Subfolder\[WorkbookName.xlsx]SheetName
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: CELL function returns blank
Hello Hans!
Saving seems to be part of the solution. Thank you.
However, the CELL function now returns the name of the last sheet I calculated for ALL sheets.
Is there a solution that you know of please?
TIA
Lisa
Saving seems to be part of the solution. Thank you.
However, the CELL function now returns the name of the last sheet I calculated for ALL sheets.
Is there a solution that you know of please?
TIA
Lisa
-
- Administrator
- Posts: 78463
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: CELL function returns blank
Specify the sheet as well as the cell:
=CELL("filename",Sheet1!A1)
If you rename the sheet, Excel will automatically update it in the formula.
=CELL("filename",Sheet1!A1)
If you rename the sheet, Excel will automatically update it in the formula.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: CELL function returns blank
okay.. But the whole point is showing the sheet name. If I know it beforehand I may as well just type it in. Ahhh.. You are using the sheet ID I think which is different of course. I'll give that ago. Curiously this "problem" occurs across workbooks. Doing an F9 in one workbook and then changing to another workbook shows the sheet name there changing to the last one I calculated.
Maybe something for Alan to get his teeth into!!
As I said, I'll give your solution a go.. though there is a "sheet1" in both workbooks.
Lisa
Maybe something for Alan to get his teeth into!!
As I said, I'll give your solution a go.. though there is a "sheet1" in both workbooks.
Lisa
-
- Administrator
- Posts: 78463
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: CELL function returns blank
The formula uses the tab name, not the "code name" of the sheet.
The difference between using the formula and typing the sheet name is that the formula will be updated automatically when you rename the sheet.
The difference between using the formula and typing the sheet name is that the formula will be updated automatically when you rename the sheet.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: CELL function returns blank
Just re-read your post.. That works too!