+ Reply to Thread
Results 1 to 7 of 7

Countif - reference a sheet via a cell

  1. #1
    Registered User
    Join Date
    10-14-2007
    Posts
    12

    Countif - reference a sheet via a cell

    Hi All

    Need some help how would i reference a sheet via a cell, i want to replace 'Sheet-A' in the formula with a reference to A2. I can reference the criteria but not the range.

    =COUNTIF('Sheet-A'!A:A,B2)


    SHEET 1 called Summary
    Sheet Colour
    Sheet-A Red
    Sheet-B Green
    Sheet-C Yellow
    Sheet-D Blue
    Sheet-E White
    Sheet-A Blue
    Sheet-B White
    Sheet-C Red
    Sheet-D Green
    Sheet-E Yellow


    SHEET2 called Sheet-A
    Colour
    Red
    Green
    Yellow
    Blue
    White
    Blue
    White
    Red
    Green
    Yellow
    Last edited by dips_007; 09-30-2012 at 04:44 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,036

    Re: Coiuntif - reference a sheet via a cell

    tRY WITH indirect FUNCTION:

    =COUNTIF(INDIRECT("'Sheet-"&A2&"'!A:A"), b2)
    Never use Merged Cells in Excel

  3. #3
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Coiuntif - reference a sheet via a cell

    Try..

    =COUNTIF(INDIRECT("'"&A2&"'!A:A"),B2)

    where A2 has Sheet-A
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,036

    Re: Coiuntif - reference a sheet via a cell

    Note:
    ACE_XL referencing to Sheet-A while I referencing to just A.
    Otherwise are same.

  5. #5
    Registered User
    Join Date
    10-14-2007
    Posts
    12

    Re: Coiuntif - reference a sheet via a cell

    Thanks guys, never used indirect before will come in handy.

  6. #6
    Registered User
    Join Date
    10-14-2007
    Posts
    12

    Re: Countif - reference a sheet via a cell

    How would i go about using Indirect if i had a "summary" sheet and the sheet name was in cell A2 for all references to Sheet-B.

    =SUMIFS('Sheet-B'!B:B,'Sheet-B'!A:A,"Finance",'Sheet-B'!C:C,"Rejected")

  7. #7
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Countif - reference a sheet via a cell

    Same logic

    =SUMIFS(INDIRECT("'"&A2&"'!B:B"),INDIRECT("'"&A2&"'!A:A"),"Finance",INDIRECT("'"&A2&"'!C:C"),"Rejected")

+ 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