Search code examples
excelformula

excel get sheet name from address


i am trying to get the full sheetname dynamically from the address with the below formula in another sheet. is there a better way ?

address : '[Airport - Daily Burn Rate_2024.05.08.xlsx]HQ 2024'!$A$1

result : 'HQ 2024'

my formula :

="'"&MID(TEXTAFTER(CELL("address";'HQ 2024'!A1);"]";1;0);1;
               FIND("~";SUBSTITUTE(TEXTAFTER(CELL("address";'HQ 2024'!A1);"]";1;0);"'";"~";1))
               )

PS if the sheename changes, i dont want my other formula connected to this sheet to be ruined...


Solution

  • Here is an alternative way, one could try using TEXTBEFORE() and TEXTAFTER():

    enter image description here


    ="'"&TEXTBEFORE(TEXTAFTER(CELL("address",'HQ 2024'!A1),"]"),"!")