+ Reply to Thread
Results 1 to 7 of 7

Excel 2007 : Variable Range in Countif

  1. #1
    Registered User
    Join Date
    04-08-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Variable Range in Countif

    My spreadsheet I am referencing can have a varying number of rows in Sheet1. What I am doing is using =COUNTA(A:A) in Cell D1 in Sheet 2 cell to get the number of rows. What I need to do then from Sheet3 do a COUNTIF that references Col A in Sheet1 and needs to incorporate the value I obtained in Sheet 2 D1 to define the range. It would look something like this:

    =COUNTIF(Sheet1!$A1:EndRange, XXXXXX)

    I need to know how to put the value from Sheet 2 D1 to define the EndRange above.
    Last edited by themaster25; 04-09-2012 at 06:32 AM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Variable Range in Countif

    If you are looking to count text strings
    Please Login or Register  to view this content.
    For numbers use
    Please Login or Register  to view this content.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  3. #3
    Registered User
    Join Date
    04-08-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Variable Range in Countif

    Actually, what I'm wanting is how would I put Sheet2!$D1 to define my range in, i.e. EndRange Below.:

    =COUNTIF(Sheet1!$A1:$AEndRange, XXXXXX)

    for instance, if Sheet2!$D1 has value 270, I would need the formula to evaluate to:

    =COUNTIF(Sheet1!$A1:$A275, XXXXXX)

    Thanks.

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Variable Range in Countif

    Something along the lines of:

    =COUNTIF(INDIRECT("Sheet1!$A1:$A" & Sheet2!$D1),XXXXXX)

    Although I'm confused why your example says D1 holds 270, but your formula counts to A275.

  5. #5
    Registered User
    Join Date
    04-08-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Variable Range in Countif

    Sorry, a mistype. Yes, it should be 275. Thanks.

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Variable Range in Countif

    I would think it better to avoid volatile functoins such as INDIRECT(), whereever possible
    Try
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-08-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Variable Range in Countif

    Thanks Andrew-R, that worked perfectly, exactly what I needed.

+ 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