+ Reply to Thread
Results 1 to 3 of 3

Formula to get sheet name

  1. #1
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Formula to get sheet name

    Hello

    Assume I have the following sheets

    'Sheet1', 'Start', '100', '101', '102', 'End', 'Something', 'AnotherSheet'.

    Now in Sheet1 from A1 to Ax, is there a formula that can give me the sheet name from the sheet range of 'Start' to 'End'?

    In the above example, I'd like to have cell
    A1 to return '100'
    A2 to return '101'
    A3 to return '102'

    And if a user move sheet 'Something' in between '101' and '102', then my formula would automatically update the value to be
    A1 to return '100'
    A2 to return '101'
    A3 to return 'Something'
    A4 to return '102'
    Last edited by dluhut; 06-06-2018 at 12:04 PM.

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula to get sheet name

    You would need a VBA code for this
    1. Copy code below
    2. Press Alt and F11 on your keyboard to open VB Editor
    3. Click on Insert and select Module
    4. Paste code into Module and close VB Editor.

    Use formula:
    Enter in A1 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Formula to get sheet name

    Another way to do this, is to use a UDF (which is still essentially a macro)

    1st create a range name (I called mine Sheetnanes
    Then put this in the Refers To box: =REPLACE(GET.WORKBOOK(1),1,FIND("]",GET.WORKBOOK(1)),"")

    To get a list of sheet names, put this in a cell and copy down (started in A2)...
    =IFERROR(INDEX(Sheetnames,ROWS($A$2:A2)),"")

    If you want to be able to click the cell and go to that worksheet, change that formula to this...
    =IFERROR(HYPERLINK("#"&"'"&INDEX(Sheetnames,ROWS($A$2:A2))&"'!A1",INDEX(Sheetnames,ROWS($A$2:A2))),"")

    Note that this uses a UDF (User Defined Function) and requires that you save the file a .xlsm
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Sub CallMacro to copy data to dest sheet is deleting formula in destination sheet
    By 962371 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-02-2017, 12:38 PM
  2. Replies: 3
    Last Post: 06-02-2016, 01:04 PM
  3. [SOLVED] Use cell reference on one sheet as a sheet name in a formula on another sheet
    By GavJ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-10-2013, 05:06 AM
  4. Replies: 1
    Last Post: 10-30-2012, 08:51 PM
  5. [SOLVED] Formula help for sheet to sheet countif / adding same page formula
    By Jon-Michael in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-14-2012, 11:23 AM
  6. Replies: 1
    Last Post: 07-30-2012, 02:35 PM
  7. Replies: 2
    Last Post: 01-12-2006, 10:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1