ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   how get filename with worksheet function? (https://www.excelbanter.com/excel-worksheet-functions/52404-how-get-filename-worksheet-function.html)

Ian Elliott

how get filename with worksheet function?
 
Thanks for any help.
I would like to get the filename with a worksheet function, is this possible?
I tried help "filename" and "file" but nothing of relation. What is a good
way to search for these things on the help file?
Thanks.

Dave Peterson

how get filename with worksheet function?
 
See Debra Dalgleish's site:
http://contextures.com/xlfaqFun.html#SheetName

I think I'd search google groups first. Then I'd learn enough to know what to
look for in excel's help.



Ian Elliott wrote:

Thanks for any help.
I would like to get the filename with a worksheet function, is this possible?
I tried help "filename" and "file" but nothing of relation. What is a good
way to search for these things on the help file?
Thanks.


--

Dave Peterson

Arvi Laanemets

how get filename with worksheet function?
 
Hi

=MID(A1,FIND("[",A1)+1,FIND("]",A1)-FIND("[",A1)-1)

The formula may be in any cell.
Instead A1 you can refer to any cell - am best you refer to same cell the
formula resides in.
NB! The workbook MUST be saved - in freschly created unsave workbook it
doesn't work!


Arvi Laanemets



"Ian Elliott" wrote in message
...
Thanks for any help.
I would like to get the filename with a worksheet function, is this

possible?
I tried help "filename" and "file" but nothing of relation. What is a good
way to search for these things on the help file?
Thanks.




JMB

how get filename with worksheet function?
 
Try

=Cell("Filename")

I think Arvi meant:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

"Ian Elliott" wrote:

Thanks for any help.
I would like to get the filename with a worksheet function, is this possible?
I tried help "filename" and "file" but nothing of relation. What is a good
way to search for these things on the help file?
Thanks.


Arvi Laanemets

how get filename with worksheet function?
 
Hi

Thanks for correction. I put CELL function into A1 at start, and created an
expression to get file name from there - and of course I completly forgot to
replace the reference to A1 with formula :-(


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )



"JMB" wrote in message
...
Try

=Cell("Filename")

I think Arvi meant:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

"Ian Elliott" wrote:

Thanks for any help.
I would like to get the filename with a worksheet function, is this
possible?
I tried help "filename" and "file" but nothing of relation. What is a
good
way to search for these things on the help file?
Thanks.




JMB

how get filename with worksheet function?
 
I had assumed as much.

"Arvi Laanemets" wrote:

Hi

Thanks for correction. I put CELL function into A1 at start, and created an
expression to get file name from there - and of course I completly forgot to
replace the reference to A1 with formula :-(


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )



"JMB" wrote in message
...
Try

=Cell("Filename")

I think Arvi meant:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

"Ian Elliott" wrote:

Thanks for any help.
I would like to get the filename with a worksheet function, is this
possible?
I tried help "filename" and "file" but nothing of relation. What is a
good
way to search for these things on the help file?
Thanks.





Harlan Grove

how get filename with worksheet function?
 
Ian Elliott wrote...
....
I would like to get the filename with a worksheet function, is this possible?
I tried help "filename" and "file" but nothing of relation. What is a good
way to search for these things on the help file?


First, online help. You could always try looking up the term filename
in the help index. Actually, there's no entry for 'filename', but you'd
see 'file name' in the 'Or choose keywords' section of the help dialog.
The first topic for 'file name' is the CELL worksheet functions (at
least in XL10 (XP/2002)).

That said, CELL("Filename",A1) only returns the pathname if the file
has been saved. If you had other worksheets, you could use some
trickery. If you wanted the filename in a cell in worksheet A and you
also had a worksheet B, try

=MID(CELL("Address",B!$A$1),FIND("[",CELL("Address",B!$A$1))+1,
FIND("]",CELL("Address",B!$A$1))-FIND("[",CELL("Address",B!$A$1))-1)

This CELL("Address",Range) returns the workbook and worksheet names
along with the cell address when Range is in a different worksheet from
the cell calling the CELL function in its formula, EVEN IF THE FILE
HASN'T BEEN SAVED.

So one has to wonder why CELL("Filename",Range) returns "" for unsaved
files.


Barry Clark

how get filename with worksheet function?
 

This code
Code:
--------------------
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

--------------------
works almost perfect for my needs; however, I need it to drop the
extension to where only the name of the name of the file is left.

Any thoughts?

Thanks!


--
Barry Clark
------------------------------------------------------------------------
Barry Clark's Profile: http://www.excelforum.com/member.php...o&userid=35267
View this thread: http://www.excelforum.com/showthread...hreadid=479553


Bob Phillips

how get filename with worksheet function?
 
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND(".",CELL("file
name",A1))-FIND("[",CELL("filename",A1))-1)

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Barry Clark"
wrote in message
...

This code
Code:
--------------------

=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("file
name",A1))-FIND("[",CELL("filename",A1))-1)

--------------------
works almost perfect for my needs; however, I need it to drop the
extension to where only the name of the name of the file is left.

Any thoughts?

Thanks!


--
Barry Clark
------------------------------------------------------------------------
Barry Clark's Profile:

http://www.excelforum.com/member.php...o&userid=35267
View this thread: http://www.excelforum.com/showthread...hreadid=479553





All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com