+ Reply to Thread
Results 1 to 11 of 11

Countifs - using multiple cell references as part of one criteria

  1. #1
    Registered User
    Join Date
    05-03-2011
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    35

    Countifs - using multiple cell references as part of one criteria

    Hi there, I am using a countifs formula to count all values meeting a variety of conditions - here is an example of what I have used below. You will see that it repeats from $D$24 to $D29 to $D34 and so on. Ideally I would love to create a formula that would allow me to reference these three cells along with cells every 5 rows after that (in the same D column which ends at $179) without having to repeat the whole formula (I almost tried but I keep hitting my character maximum!) I've been scratching my head trying to figure out a way to do this but it seems that Excel won't let you create multiple cell references within an array, only constant values. Is there a way around this?

    =COUNTIFS('Client_Demographic 2'!$V$3:$V$50000,T$1,'Client_Demographic 2'!$AC$3:$AC$50000,$G$2,'Client_Demographic 2'!$H$3:$H$50000,"?*",'Client_Demographic 2'!$I$3:$I$50000,"Active",'Client_Demographic 2'!$L$3:$L$50000,0,'Client_Demographic 2'!$M$3:$M$50000,0,'Client_Demographic 2'!$N$3:$N$50000,0,'Client_Demographic 2'!$AA$3:$AA$50000,$D24+COUNTIFS('Client_Demographic 2'!$V$3:$V$50000,T$1,'Client_Demographic 2'!$AC$3:$AC$50000,$G$2,'Client_Demographic 2'!$H$3:$H$50000,"?*",'Client_Demographic 2'!$I$3:$I$50000,"Active",'Client_Demographic 2'!$L$3:$L$50000,0,'Client_Demographic 2'!$M$3:$M$50000,0,'Client_Demographic 2'!$N$3:$N$50000,0,'Client_Demographic 2'!$AA$3:$AA$50000,$D29)+COUNTIFS('Client_Demographic 2'!$V$3:$V$50000,T$1,'Client_Demographic 2'!$AC$3:$AC$50000,$G$2,'Client_Demographic 2'!$H$3:$H$50000,"?*",'Client_Demographic 2'!$I$3:$I$50000,"Active",'Client_Demographic 2'!$L$3:$L$50000,0,'Client_Demographic 2'!$M$3:$M$50000,0,'Client_Demographic 2'!$N$3:$N$50000,0,'Client_Demographic 2'!$AA$3:$AA$50000,$D34) +COUNTIFS('Client_Demographic 2'!$V$3:$V$50000,T$1,'Client_Demographic 2'!$AC$3:$AC$50000,$G$2,'Client_Demographic 2'!$H$3:$H$50000,"?*",'Client_Demographic 2'!$I$3:$I$50000,"Active",'Client_Demographic 2'!$L$3:$L$50000,0,'Client_Demographic 2'!$M$3:$M$50000,0,'Client_Demographic 2'!$N$3:$N$50000,0,'Client_Demographic 2'!$AA$3:$AA$50000,$D39) +COUNTIFS('Client_Demographic 2'!$V$3:$V$50000,T$1,'Client_Demographic 2'!$AC$3:$AC$50000,$G$2,'Client_Demographic 2'!$H$3:$H$50000,"?*",'Client_Demographic 2'!$I$3:$I$50000,"Active",'Client_Demographic 2'!$L$3:$L$50000,0,'Client_Demographic 2'!$M$3:$M$50000,0,'Client_Demographic 2'!$N$3:$N$50000,0,'Client_Demographic 2'!$AA$3:$AA$50000,$D44)

    Thanks,

    David

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,934

    Re: Countifs - using multiple cell references as part of one criteria

    Can you post a sample file with expected results.

  3. #3
    Registered User
    Join Date
    05-03-2011
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Countifs - using multiple cell references as part of one criteria

    I apologise it's a bit difficult because it is a work document with internal client data. With that countifs formula, I am trying to count number of clients residing in a particular county and meeting a number of demographic criteria. The "Client_Demographic 2" reference is to sift through data from another tab with internal client data. The repeating cell reference ($D24,$D29,$D34,$D39,$D44 etc) is pulling clients (with certain demographic information) from different counties. The reason I am pulling county information as well as region information is because there are data entry issues where the county and region both have blank/incorrect values so I'm trying to present the data both ways. Is there a way to consolidate the formula to something along the lines of $D29 to ($D24,$D29,$D34,$D39,$D44) and eliminate all of the summing that I make (the + signs between all of the countif formulas).
    Cheers,
    David

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,934

    Re: Countifs - using multiple cell references as part of one criteria

    I don't know if this will work (I am no guru) hence my request for sample data:

    Enter with Ctrl+Shift+Enter

    =COUNTIFS('Client_Demographic 2'!$V$3:$V$50000,T$1,'Client_Demographic 2'!$AC$3:$AC$50000,$G$2,'Client_Demographic 2'!$H$3:$H$50000,"?*",'Client_Demographic 2'!$I$3:$I$50000,"Active",'Client_Demographic 2'!$L$3:$L$50000,0,'Client_Demographic 2'!$M$3:$M$50000,0,'Client_Demographic 2'!$N$3:$N$50000,0,'Client_Demographic 2'!$AA$3:$AA$50000,CHOOSE({1,2,3,4,5},$D$24,$D$29,$D$34,$D$39,$D$44))

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Countifs - using multiple cell references as part of one criteria

    @davidharper2005

    You get better help on your question if you add a small excel file, without confidential information.

    Please also add manualy the expected result in your file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Countifs - using multiple cell references as part of one criteria

    What is in the cells 'between' the desired $D24,$D29,$D34,$D39,$D44 cells?
    So D25:D28, D30:D33, D35:D38 ??

    If those 'between' cells will never be a match to cells in 'Client_Demographic 2'!$AA$3:$AA$50000 (or at least not on the same rows where all the other criteria are true as well).

    Then you can do this

    =SUMPRODUCT(COUNTIFS('Client_Demographic 2'!$V$3:$V$50000,T$1,'Client_Demographic 2'!$AC$3:$AC$50000,$G$2,'Client_Demographic 2'!$H$3:$H$50000,"?*",'Client_Demographic 2'!$I$3:$I$50000,"Active",'Client_Demographic 2'!$L$3:$L$50000,0,'Client_Demographic 2'!$M$3:$M$50000,0,'Client_Demographic 2'!$N$3:$N$50000,0,'Client_Demographic 2'!$AA$3:$AA$50000,$D24:$D44))

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,934

    Re: Countifs - using multiple cell references as part of one criteria

    @jonmo1

    would this work ??

    =SUMPRODUCT(COUNTIFS('Client_Demographic 2'!$V$3:$V$50000,T$1,'Client_Demographic 2'!$AC$3:$AC$50000,$G$2,'Client_Demographic 2'!$H$3:$H$50000,"?*",'Client_Demographic 2'!$I$3:$I$50000,"Active",'Client_Demographic 2'!$L$3:$L$50000,0,'Client_Demographic 2'!$M$3:$M$50000,0,'Client_Demographic 2'!$N$3:$N$50000,0,'Client_Demographic 2'!$AA$3:$AA$50000,(IF(MOD(ROW(24:44),5)=4,D24:D44))))

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Countifs - using multiple cell references as part of one criteria

    Quote Originally Posted by JohnTopley View Post
    would this work ??
    I doubt it, but try it and see. You tell us if it works..

  9. #9
    Registered User
    Join Date
    05-03-2011
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Countifs - using multiple cell references as part of one criteria

    Johnmo you win the prize for the correct formula - thank you very much! And yes you are right that the between cells (D25:D28, D30:D33, D35:D38 and so on) didn't contain any values. I didn't realise you could nest a countifs formula within a sumproduct. That's really handy. Thanks again for your help! John Topley, I tried your formula as well but sorry I couldn't get it to work.

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Countifs - using multiple cell references as part of one criteria

    You're welcome

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,934

    Re: Countifs - using multiple cell references as part of one criteria

    David,
    Thank you for the feedback. As you will have gathered from my response I am receiving (learning) as much (if not more) as I am giving in replying to the threads.

    I often look at responses simply to acquaint myself with new (to me) solutions: the trouble is at my age, I forget them quickly.

    Anyway, glad you have a solution.

+ 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. Retrieve multiple cell references based on a criteria
    By Danut Alexandru in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-04-2014, 02:16 PM
  2. [SOLVED] COUNTIFS and multiple criteria per cell
    By jimbosi in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-04-2013, 06:37 PM
  3. Replies: 3
    Last Post: 11-21-2012, 04:57 PM
  4. countifs with references as criteria
    By Kaigi in forum Excel General
    Replies: 8
    Last Post: 08-13-2009, 04:00 PM
  5. Return multiple cell references based on a search criteria
    By ruddocg in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-30-2006, 07:49 AM

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