What Excel formula returns the sheet name?

2019-02-17 03:10发布

I have searched the excel function documentation and general MSDN search but have been unable to find a way to return the sheet name without VBA.

Is there a way to get the sheet name in an excel formula without needing to resort to VBA?

5条回答
趁早两清
2楼-- · 2019-02-17 03:27

For recent versions of Excel, the formula syntax is:

=MID(CELL("filename";A1);FIND("]";CELL("filename";A1))+1;255)
查看更多
太酷不给撩
3楼-- · 2019-02-17 03:29

I'm pretty sure you could have Googled this. I just did, and here is the very first thing that came up for me.

In Excel it is possible to use the CELL function/formula and the MID and FIND to return the name of an Excel Worksheet in a Workbook. The formula below shows us how;

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

Where A1 is any non error cell on the Worksheet. If you want the full path of the Excel Workbook, simply use;

=CELL("filename",A1)

The only catch is that you have to save the file for this to work!

查看更多
家丑人穷心不美
4楼-- · 2019-02-17 03:33

Not very good with excel, but I found these here

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

and A1 can be any non-error cell in the sheet.
For the full path and name of the sheet, use

=CELL("filename",A1)
查看更多
唯我独甜
5楼-- · 2019-02-17 03:36

The below will isolate the sheet name:

=RIGHT(CELL("filename"),LEN(CELL("filename"))-FIND("]",CELL("filename")))
查看更多
手持菜刀,她持情操
6楼-- · 2019-02-17 03:42

I had a module already open so I made a custom function:

Public Function Sheetname (ByRef acell as Range) as string
Sheetname = acell.Parent.Name 
End Function 
查看更多
登录 后发表回答