• Name of sheet containing this cell

    • This topic has 4 replies, 3 voices, and was last updated 24 years ago.
    Author
    Topic
    #355958

    I’d like to put a formula into a cell that contains the name of the sheet that contains the cell.

    After looking through an earlier discussion, I came up with the following formula:

    =MID(CELL(“filename”),FIND(“]”,CELL(“filename”))+1,100)

    However, the CELL() function refers to properties of the active cell rather than the cell containing the formula. So for example if:
    Sheet2!A1 contains
    =MID(CELL(“filename”),FIND(“]”,CELL(“filename”))+1,100)
    Sheet1!A1 contains
    =Sheet2!A1

    Then when Sheet1 is active, it will display “Sheet1” not “Sheet2”. If the calculations in Sheet2 depend on its name (which is why I want the name there) they will be incorrect.

    Any suggestions?

    Ian.

    Viewing 1 reply thread
    Author
    Replies
    • #525993

      Take a look here

      • #525996

        Thanks, kjktoo, but that’s what I found before. It gives the name of the sheet containing the active cell at any given time, which need not be the cell containing the formula.

    • #526003

      The CELL function accepts a second argument, a cell reference. try adapting your formula like this:

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

      This will always give the sheet name the formula is on.

      • #526004

        Thanks Jan. Just what I needed! (and thanks again kjktoo – I should have read the earlier post more carefully)

        All the best

        Ian.

    Viewing 1 reply thread
    Reply To: Name of sheet containing this cell

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: