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

T

T. Valko

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.
 
S

Shane Devenshire

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 said:
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.
 
D

Dave Peterson

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 said:
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 said:
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.
 
T

T. Valko

Sorry to piggy back on your answer

Biting my tongue

--
Biff
Microsoft Excel MVP


Shane Devenshire said:
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 said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top