Closed Thread
Results 1 to 6 of 6

Using COUNTIFS with dynamic ranges?

  1. #1
    Registered User
    Join Date
    11-05-2006
    Posts
    14

    Using COUNTIFS with dynamic ranges?

    Does COUNTIFS not work with named ranges/dynamic ranges? Everytime I try, I get a #VALUE! error.

    These are my 2 dynamic ranges:

    ResultsM=OFFSET([results_list.xls]Results!$M$4,0,0,COUNTA([results_list.xls]Results!$M:$M),1)

    ResultsQ=OFFSET([results_list.xls]Results!$Q$4,0,0,COUNTA([results_list.xls]Results!$Q:$Q),1)
    The formula is simply:
    =COUNTIFS(ResultsQ,"GENDER",ResultsM,"MALE"
    However, this does NOT work. it returns the #VALUE! error. However, odly enough, when I use column references, it works:

    =COUNTIFS([results_list.xls]Results!Q:Q, "GENDER", [results_list.xls]Results!M:M, "MALE")
    This makes me think that COUNTIFS just don't work with named references..

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Cross posting

    http://www.ozgrid.com/forum/showthread.php?t=72189
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    11-05-2006
    Posts
    14
    Was I not suppose to post on other excel forums as well? I'm really sorry if I broke the rules

  4. #4
    Registered User
    Join Date
    11-05-2006
    Posts
    14
    This problem is solved:

    Quote Originally Posted by Dutchy
    I don't have Excel 2007 so just a guess.....

    Are your named ranges the same size?, the way you have defined them leaves open the possibility that they are not
    It turns out this WAS the case. Column Q has data in Row 1, whereas Column M has nothing.

    However, I don't see WHY this happened.. I specifically tell my dynamic ranges to START at row 4. Why is it looking at data from Row 1?

  5. #5
    Registered User
    Join Date
    06-11-2007
    Location
    Nonthaburee Province, Thailand
    MS-Off Ver
    MS Office 2003 to MS Office 2010
    Posts
    82
    Are there any data in the cells above Cell M4? If the answer is yes, please deduct with the number of non blank above cell.

    For example All of cell M1, M2 and M3 contain Data. You should change reference of dynamic range of ResultsM from

    ResultsM=OFFSET([results_list.xls]Results!$M$4,0,0,COUNTA([results_list.xls]Results!$M:$M),1)
    to

    ResultsM=OFFSET([results_list.xls]Results!$M$4,0,0,COUNTA([results_list.xls]Results!$M:$M)-3,1)
    From help online of COUNTIFS Function

    COUNTIFS
    Counts the number of cells within a range that meet multiple criteria.

    Syntax

    COUNTIFS(range1, criteria1,range2, criteria2…)

    Range1, range2, … are 1 to 127 ranges in which to evaluate the associated criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored.

    Criteria1, criteria2, … are 1 to 127 criteria in the form of a number, expression, cell reference, or text that define which cells will be counted. For example, criteria can be expressed as 32, "32", ">32", "apples", or B4.


    I do not sure that the criteria that you assign is missing equal sign.

    =COUNTIFS(B2:B5,"=Yes",C2:C5,"=Yes")
    N. Yauvasuta
    Power User Excel.

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Closed for cross posting. Please read forum rules. IF you agree to them then PM me and I will unlock the thread

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

Closed 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