0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Excel シート名・ドキュメント名を関数で取得する

Posted at

システム作ってたら結構使うので、まとめておこうかと。。。

関数でシート名取得

探せば、詳細は出てくるので、結論として関数だけ。
※一度名前を付けてファイルを保存しないと効かないので、注意

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

関数でドキュメント名取得

こちらも探せば、詳細は出てくるので結論として関数だけ。
※置換で「.xlsx」の拡張子を削除しているので、利用する際にカスタマイズすれば、「.xlsm」なども対応できます

sample
=SUBSTITUTE(MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1), ".xlsx", "")
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?