+ Reply to Thread
Results 1 to 12 of 12

Count rows with multiple criteria; comparing ranges and ranges to value in one statement

  1. #1
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Smile Count rows with multiple criteria; comparing ranges and ranges to value in one statement

    Hello Excel people!

    My question is similar to many that I have seen but not exactly the same. I need to count the number of records/rows where a number of criteria are met. One of the criteria compares one range of cells with another range, and the next criteria compares one range of cells with a value.

    I have a list of tasks each with planned & actual start dates, and planned and actual end dates. Here is an illustration (actual table is massive).


    This Week 25-Apr > 29-Apr [this is the value I need to compare with]

    Plan Strt | Plan End | Act Strt | Act End
    Task 1 26-Apr | 19-Apr | 20-Apr | 26-Apr
    Task 2 25-Apr | 22-Apr | 2-May | 25-Apr
    Task 3 6-May | 4-Apr | 10-May | 10-May
    Task 4 13-Apr | 11-Apr | 18-Apr | 18-Apr
    Task 5 19-Apr | 13-Apr | 17-Apr | 26-Apr
    Task 6 25-Apr | 14-Apr | 28-Apr | 2-May
    Task 7 26-May | 16-May | 27-May | 18-May
    [these are the ranges I need to compare]




    I need to find out:

    - Of the tasks completed this week, how many started earlier than planned, AND of these tasks how many finished later than planned.

    It sounds simple, but I am confused about how to compare ranges and values in the same formula. I tried SUMPRODUCT, but could not figure out how to combine with COUNTIFS.
    **I cannot add any columns to the table to make it easier***. I appreciate any help I can get.

    Best, chomo (Tokyo)

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Count rows with multiple criteria; comparing ranges and ranges to value in one stateme

    Try this, data range A1:E7
    =SUMPRODUCT(($B$1:$B$7>$D$1:$D$7)*($C$1:$C$7<$E$1:$E$7))

  3. #3
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Unhappy Re: Count rows with multiple criteria; comparing ranges and ranges to value in one stateme

    Thanks kvsrinivasamurthy.
    This returns those records where tasks have started earlier than planned, AND finished later than planned. I also need to know if how many of these finished this week.

    So there are three criteria (of which you have captured 1 & 2)>

    1. All records where tasks have started earlier than planned
    -AND-
    2. Finished later than planned
    -AND-
    3. Finished this week.

    Inclusion of this last criteria is where I am having problems. I thought perhaps combine SUMPRODUCT with COUNTIFS??

    Please advise.

    Cheers, chomo

  4. #4
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Count rows with multiple criteria; comparing ranges and ranges to value in one stateme

    Hi Chomo,

    Please upload a sample workbook with expected result.

    For uploading workbook, Go to Advance click on paper clip icon and attach the workbook
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  5. #5
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Re: Count rows with multiple criteria; comparing ranges and ranges to value in one stateme

    Thanks Ankur. Please see attached file.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Re: Count rows with multiple criteria; comparing ranges and ranges to value in one stateme

    Seems everyone else is as stumped as I am...

  7. #7
    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: Count rows with multiple criteria; comparing ranges and ranges to value in one stateme

    Confused.

    The upload says you expect a return of 7 ... filtering the 7 yellow cells if find only 3 or 4 that meet criteria #3.

    Formula: copy to clipboard
    Please Login or Register  to view this content.




    B
    C
    D
    E
    F
    5
    Start (plan)
    Start (Actual)
    End (plan)
    End (actual)
    236
    Task 230
    25-May-16
    23-May-16
    27-May-16
    30-May-16
    237
    Task 231
    25-May-16
    24-May-16
    27-May-16
    30-May-16
    239
    Task 233
    25-May-16
    2-May-16
    27-May-16
    2-Jun-16
    240
    Task 234
    31-May-16
    3-May-16
    3-Jun-16
    3-Jun-16
    258
    Task 252
    2-Jun-16
    1-Jun-16
    3-Jun-16
    2-Jun-16
    259
    Task 253
    2-Jun-16
    1-Jun-16
    3-Jun-16
    2-Jun-16
    260
    Task 254
    2-Jun-16
    1-Jun-16
    3-Jun-16
    2-Jun-16
    Last edited by FlameRetired; 06-27-2016 at 09:52 PM.
    Dave

  8. #8
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Re: Count rows with multiple criteria; comparing ranges and ranges to value in one stateme

    Hi Dave. You are correct. the result should be 3. My error. I am looking at your formula (thank you very much). It seems to be working! However, I cannot see this considering the end date of "this week". If I wanted to input restrict results in between 2 dates as I do for criteria 1, how can I do this?

    Criteria 1 Tasks that have ended this week (actual end) > (are between May-30 & Jun 3 in the xls)
    Criteria 2 Start date is before planned start date
    Criteria 3 Actual end date is past planned end date

    Cheers,
    Nic

  9. #9
    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: Count rows with multiple criteria; comparing ranges and ranges to value in one stateme

    OK. I've re-read your notes to kvsrinivasamurthy.

    Try this one.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I get 5 now. Filtering confirms it.

  10. #10
    Registered User
    Join Date
    06-22-2016
    Location
    Tokyo
    MS-Off Ver
    the latest
    Posts
    15

    Re: Count rows with multiple criteria; comparing ranges and ranges to value in one stateme

    FlameRetired is THE MAN!!! You totally nailed it! I had to change the operator before C7 to = (instead of<=), and I got 3 which is what I was expecting. Thank you very much!

  11. #11
    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: Count rows with multiple criteria; comparing ranges and ranges to value in one stateme

    You are welcome. Glad you got it working.

  12. #12
    Registered User
    Join Date
    08-19-2014
    Location
    Dallas, TX
    MS-Off Ver
    Office2013
    Posts
    44

    Re: Count rows with multiple criteria; comparing ranges and ranges to value in one stateme

    Quote Originally Posted by chomo View Post
    FlameRetired is THE MAN!!! You totally nailed it! I had to change the operator before C7 to = (instead of<=), and I got 3 which is what I was expecting. Thank you very much!
    I got 3, but in the workbook you provided you said you expected 7 (not nice!). The 3 I got were: Task 230, Task 231, and Task 233

+ 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. Find count of unique values with multiple criteria inlcuding date ranges
    By jdooley in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-21-2016, 01:05 PM
  2. [SOLVED] countifs statement with multiple criteria for multiple criteria ranges
    By mcdermott2 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-07-2015, 11:48 AM
  3. Replies: 11
    Last Post: 02-12-2015, 10:44 AM
  4. Replies: 5
    Last Post: 05-04-2014, 10:56 AM
  5. IF THEN statement comparing Ranges of Numbers
    By Jupasto in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-31-2012, 12:07 PM
  6. Count Multiple Criteria within Multiple Date Ranges
    By E6BAV8R in forum Excel General
    Replies: 3
    Last Post: 12-08-2010, 05:06 PM
  7. [SOLVED] Count rows that match criteria in 2 different column cell ranges
    By JoAnn in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-09-2005, 01:55 PM

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