+ Reply to Thread
Results 1 to 7 of 7

COUNTIFS with sorts?

  1. #1
    Registered User
    Join Date
    11-23-2019
    Location
    dallas
    MS-Off Ver
    Excel
    Posts
    5

    Question COUNTIFS with sorts?

    In cell F77 of my spreadsheet I would like the count/sum the number of "P" and "EX" in cells F4:F66 that correspond to any "H", "M", "L" entries in cells AY3:AY66. All cells in F4:F66 either have a "P", "I", "EX", or "C" or they are blank. All cells in AY3:AY66 either have a "H", "M", "L" or they are blank. I created the following function and it works, but I would like the ability to sort or filter by either column and have the sum/count reflect the sort/filter.

    =SUM(COUNTIFS($AY4:$AY66,"*",F4:F66,{"P","EX"}))

    I think I have to use SUMPRODUCT.

    Any help would be greatly appreciated.

    -B

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: COUNTIFS with sorts?

    Welcome to the forum

    Please read the yellow banner at the top of the page.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    11-23-2019
    Location
    dallas
    MS-Off Ver
    Excel
    Posts
    5

    Re: COUNTIFS with sorts?

    See attached sample file. I would like to be able to sort on columns A & B and have the results in C18:C20 reflect the sorts. You can see the current results show the full data set vs the sorted data set.
    Attached Files Attached Files

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: COUNTIFS with sorts?

    Please try this in your upload C18:P20.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  5. #5
    Registered User
    Join Date
    11-23-2019
    Location
    dallas
    MS-Off Ver
    Excel
    Posts
    5

    Re: COUNTIFS with sorts?

    Dave..thanks for reaching out! Did you get it to work in the sample upload? When I copy that to c:18:p20 I get #N/A.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: COUNTIFS with sorts?

    I can not get a N/A error, but there is (I think) a typo in the formula:
    =SUM(COUNTIFS(INDEX($Q$2:$S$12,,MATCH($B18,$Q$1:$S$1,0)),"*",C$2:C$12,{"P","EX"}))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  7. #7
    Registered User
    Join Date
    11-23-2019
    Location
    dallas
    MS-Off Ver
    Excel
    Posts
    5

    Re: COUNTIFS with sorts?

    Dave...were you thinking this:?

    =SUM(COUNTIFS(INDEX($Q$2:$S$12,,MATCH($A18,$Q$1:$S$1,0)),"*",C2:C12,{"P","EX"}))

    I am able to get the right values using above, but when I go to filter on either column A (programs) or B (portfolio) I was wanting the C18:p20 to reflect the filtered values. The function above and my original function have the same problem. They don't reflect the filtered values...
    Last edited by bmcraney; 11-25-2019 at 03:09 PM.

+ 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. Replies: 6
    Last Post: 03-19-2019, 09:14 PM
  2. [SOLVED] Sumproduct to replace countifs as countifs don't work on external source reference
    By KrishnaSagar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2017, 02:33 AM
  3. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  4. Linking Cells so sorts of one columb sorts another
    By excellerator22 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 04-12-2008, 11:26 PM
  5. Sorts
    By Mona Marie in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-21-2006, 01:15 PM
  6. [SOLVED] Need a spreadsheet that sorts by month/yr & 2 other sorts w/total
    By Spreadsheet in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2006, 09:45 AM
  7. Sorts
    By Mike in forum Excel General
    Replies: 2
    Last Post: 03-10-2006, 07:00 PM

Tags for this Thread

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