ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   i want to insert the file name in a cell, how do I do this (https://www.excelbanter.com/excel-discussion-misc-queries/221903-i-want-insert-file-name-cell-how-do-i-do.html)

jcb

i want to insert the file name in a cell, how do I do this
 


T. Valko

i want to insert the file name in a cell, how do I do this
 
Try this:

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

Enter the formula in any cell on any sheet. The file must have been saved at
least once for it to work.

Do not change anything in the formula.

--
Biff
Microsoft Excel MVP


"JCB" wrote in message
...




Shane Devenshire[_2_]

i want to insert the file name in a cell, how do I do this
 
Hi,

Sorry to piggy back on your answer, but since to OP didn't include anything
in the body of the post I can't reply using the web interface.

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

This is a great time to create a range name, say F which is
=CELL("filename"), then the formula would be

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

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"T. Valko" wrote:

Try this:

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

Enter the formula in any cell on any sheet. The file must have been saved at
least once for it to work.

Do not change anything in the formula.

--
Biff
Microsoft Excel MVP


"JCB" wrote in message
...





Dave Peterson

i want to insert the file name in a cell, how do I do this
 
Without the reference to a cell in the worksheet/workbook, then this formula:

=CELL("filename")

will return info about the workbook that is active when excel recalculates.

Adding a reference to a cell in the workbook/worksheet with the formula will
make this problem go away:

=CELL("filename",A1)

(I like to use the cell that contains the formula)

Shane Devenshire wrote:

Hi,

Sorry to piggy back on your answer, but since to OP didn't include anything
in the body of the post I can't reply using the web interface.

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

This is a great time to create a range name, say F which is
=CELL("filename"), then the formula would be

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

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire

"T. Valko" wrote:

Try this:

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

Enter the formula in any cell on any sheet. The file must have been saved at
least once for it to work.

Do not change anything in the formula.

--
Biff
Microsoft Excel MVP


"JCB" wrote in message
...





--

Dave Peterson

T. Valko

i want to insert the file name in a cell, how do I do this
 
Sorry to piggy back on your answer

Biting my tongue

--
Biff
Microsoft Excel MVP


"Shane Devenshire" wrote in
message ...
Hi,

Sorry to piggy back on your answer, but since to OP didn't include
anything
in the body of the post I can't reply using the web interface.

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

This is a great time to create a range name, say F which is
=CELL("filename"), then the formula would be

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

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"T. Valko" wrote:

Try this:

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

Enter the formula in any cell on any sheet. The file must have been saved
at
least once for it to work.

Do not change anything in the formula.

--
Biff
Microsoft Excel MVP


"JCB" wrote in message
...








All times are GMT +1. The time now is 08:59 PM.

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