+ Reply to Thread
Results 1 to 3 of 3

Only show sheet name in list if the name is stored in a named range

  1. #1
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2013
    Posts
    177

    Only show sheet name in list if the name is stored in a named range

    Hi all,
    I have the following formula for showing the sheet names in a vertical list:
    Please Login or Register  to view this content.
    I need to only show the sheet name if it is within the named range 'classcodes', if it isn't I don't want it to show, BUT, also don't want an empty row.

    Any ideas?

    Cheers Luke

  2. #2
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: Only show sheet name in list if the name is stored in a named range

    Create a sheet with a list of the sheet names in Col B starting in B2 (Lets call it SHEETNAMES for this example).
    Then in A2 type =IF(IFERROR(VLOOKUP(B2,classcodes,1,0),0)=B2,MAX($B$1:B1)+1,"") and drag drown
    If the sheet name is in the classcodes list it will assing it the next available lowest number. Note I assume the first column of the classcodes range contains the sheet names. this sheet can be hidden once done to keep your work tidy.

    On the sheet where you want to sheet the sheetnames in Col A type 1,2,3 etc going down from A2 (assuming you want a header row). Continue untill you have the same number of possible sheet names. This column can be hidden. Then in B2 type =IFERROR(VLOOKUP(A2,SHEETNAMES!A:B,2,0),"") and drag down as far as needed.

    This will then show available sheet names without any blank rows inbetween.
    Say thanks, click *

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Only show sheet name in list if the name is stored in a named range

    Assuming that SheetNames is a named range of cells and that both SheetNames and ClassCodes are 1 dimensional arrays (single rows or columns).

    Array entered** in A2:

    =IFERROR(INDEX(SheetNames,SMALL(IF(ISNUMBER(MATCH(SheetNames,ClassCodes,0)),ROW(SheetNames)),ROWS(A$2:A2))-MIN(ROW(SheetNames))+1),"")

    Copy down until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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