Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Doug
 
Posts: n/a
Default Entering a filename as a variable into cell similar as for footer

Would like to have a cell value the the name of the excell file I am creating.
Similar to inserting the file name into the header or footer.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Miguel Zapico
 
Posts: n/a
Default Entering a filename as a variable into cell similar as for footer

You can use the function CELL, with the "filename" argument:
=CELL("filename")
This returns the full path. In case you just want the name you may need to
use some text functions. In the case I tried, with Excel 2003, the file name
was enclosed in braquets, so this formula gave just the bare name:
=MID(CELL("filename"),FIND("[",CELL("filename"),1)+1,FIND("]",CELL("filename"),1)-FIND("[",CELL("filename"),1)-1)

Hope this helps,
Miguel.

"Doug" wrote:

Would like to have a cell value the the name of the excell file I am creating.
Similar to inserting the file name into the header or footer.

  #3   Report Post  
Posted to microsoft.public.excel.misc
Peo Sjoblom
 
Posts: n/a
Default Entering a filename as a variable into cell similar as for footer

Just for fun

=REPLACE(SUBSTITUTE(CELL("filename"),INFO("directo ry")&"[",""),FIND("]",SUBSTITUTE(CELL("filename"),INFO("directory" )&"[","")),255,"")

--

Regards,

Peo Sjoblom

Excel 95 - Excel 2007
Northwest Excel Solutions
www.nwexcelsolutions.com
"It is a good thing to follow the first law of holes;
if you are in one stop digging." Lord Healey


"Miguel Zapico" wrote in message
...
You can use the function CELL, with the "filename" argument:
=CELL("filename")
This returns the full path. In case you just want the name you may need
to
use some text functions. In the case I tried, with Excel 2003, the file
name
was enclosed in braquets, so this formula gave just the bare name:
=MID(CELL("filename"),FIND("[",CELL("filename"),1)+1,FIND("]",CELL("filename"),1)-FIND("[",CELL("filename"),1)-1)

Hope this helps,
Miguel.

"Doug" wrote:

Would like to have a cell value the the name of the excell file I am
creating.
Similar to inserting the file name into the header or footer.



  #4   Report Post  
Posted to microsoft.public.excel.misc
CaptainQuattro
 
Posts: n/a
Default Entering a filename as a variable into cell similar as for footer


Doug Wrote:
Would like to have a cell value the the name of the excell file I am
creating.
Similar to inserting the file name into the header or footer.


The following formula will return the full path, filename and current
sheet name:

=CELL("filename",A1)

Where it gets interesting is if you want to isolate the file name only.
For example, =CELL("filename",A1) may return

D:\Jupiter\MyDocuments\[doobie.xls]Sheet1

If all you want is

doobie.xls

you need:

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

The portion of the formula in red returns the position of the first
character of the actual filename.

The portion of the formula in blue returns the length of the actual
filename.
If all you want is -doobie.xls- you need the following:


--
CaptainQuattro
------------------------------------------------------------------------
CaptainQuattro's Profile: http://www.excelforum.com/member.php...o&userid=32763
View this thread: http://www.excelforum.com/showthread...hreadid=542743

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with this conditional IF statement C-Dawg Excel Discussion (Misc queries) 3 May 15th 06 06:01 PM
Aling multiple sets of data by header column MarkusO Excel Discussion (Misc queries) 2 April 12th 06 07:29 PM
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
substitute the filename in a cell reference with a string in another cell. flummi Excel Discussion (Misc queries) 11 February 22nd 06 01:14 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


All times are GMT +1. The time now is 02:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"