Formula to show worksheet name?

J

Jack Schitt

=RIGHT(CELL("filename",cellref),LEN(CELL("filename",cellref))-FIND("]",CELL(
"filename",cellref)))

Or some use

=MID(CELL("filename",cellref),1+FIND("]",CELL("filename",cellref)),255)

Not sure if there is any preference between the two.

For "cellref" substitute the cell reference of the formula.

Both of the above will only work after the workbook has been saved at least
once.
 
J

JE McGimpsey

Both work, but the first uses six function calls while the second uses
four. String functions are relatively slow, so I prefer to use fewer of
them.

If you only have one such construction, you'd be hard pressed to put the
millisecond saved to good use. OTOH, if your model is function
intensive, maximizing the efficiency of calculations may be worthwhile.

Note that "cellref" can be any cell on the desired worksheet.
 
J

Jack Schitt

Thanks for that.

I tend to recommend that "cellref" be the cell of the calling formula, so
that any subsequent deletion of columns or rows will not give rise to a
#REF! error.

JE McGimpsey said:
Both work, but the first uses six function calls while the second uses
four. String functions are relatively slow, so I prefer to use fewer of
them.

If you only have one such construction, you'd be hard pressed to put the
millisecond saved to good use. OTOH, if your model is function
intensive, maximizing the efficiency of calculations may be worthwhile.

Note that "cellref" can be any cell on the desired worksheet.



Jack Schitt said:
=RIGHT(CELL("filename",cellref),LEN(CELL("filename",cellref))-FIND("]",CELL(
"filename",cellref)))

Or some use

=MID(CELL("filename",cellref),1+FIND("]",CELL("filename",cellref)),255)

Not sure if there is any preference between the two.

For "cellref" substitute the cell reference of the formula.
 
J

JE McGimpsey

Instead of "Book1" you should have "filename". Take a look at Excel Help
for "CELL"
 

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