Month from Worksheet Name

Hello,

I have an Microsoft Excel spreadsheet where I get month details in a cell from the formula below.

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

Assuming my worksheet name is “Apr 2021”. I get the same in the cell where the formula is used.

However, when I open the spreadsheet in Libreoffice I see only a #VALUE!

Is there a replacement formula which will work in both Microsoft Excel and Libre Office

Thanks for helping me

Excel and Calc return the file name differently in the function CELL(“ADDRESS”) - in one case, you have to look for a closing square bracket, in the other - #

=IFERROR(MID(CELL("filename";A1);FIND("]";CELL("filename";A1))+1;256);MID(CELL("filename";A1);FIND("#";CELL("filename";A1))+2;256))

Perfect Solution. Thank you very much !!

Question:

=MID(CELL("filename");SEARCH("(.]|#\$)";CELL("filename"))+2;99)  

that works for Calc with enabled Option allow Regexes in Formulas , does it work in Excel ??

@karolus Unfortunately - no, Excel will return #VALUE!