+ Reply to Thread
Results 1 to 7 of 7

Count values in a row pertaining to a specific date range column

  1. #1
    Registered User
    Join Date
    09-23-2015
    Location
    Milwuakee, Wisconsin
    MS-Off Ver
    2010
    Posts
    3

    Count values in a row pertaining to a specific date range column

    I’ve been struggling with this and need some help…

    Column A is a range of dates, columns B thru E whether a room is in compliance or out of compliance for that specific date. For B-E contains the following data:

    “1” represents compliance.
    “0” represents non-compliance.
    Anything else (“np” or a blank space, or other text should be ignored)

    There can be repeat and skipped dates (as seen in screenshot). I need to be able to specify a range of dates and then obtain the compliance rate for those dates.

    Right now I’m using =Countif, and manually selecting my range every time. The problem is that this spreadsheet has 1000s of entries and I need to frequently change a long list of dates that I’m looking at. What I want to be able to do is choose a start and end date, and then obtain my compliance rate for that date range. Below is an example of the spreadsheet. Thank you for any help!
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by MattStolz; 09-23-2015 at 11:05 AM. Reason: Attach Sample File

  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
    28,150

    Re: Count values in a row pertaining to a specific date range column

    Please post a sample file many of us cannot view an image: it also helps to test/validate any replies you may get.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Count values in a row pertaining to a specific date range column

    COUNTIF() is good for checking data with one criteria.
    COUNTFS() is good for checking data with more than one criteria.

    A: Dates

    M1: Start Date
    N1: End Date

    =COUNTIFS(A:A, ">="&M1, A:A, "<="&N1)

    Something like that....
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    09-23-2015
    Location
    Milwuakee, Wisconsin
    MS-Off Ver
    2010
    Posts
    3

    Re: Count values in a row pertaining to a specific date range column

    I've tried this, but I need to count the "1" for those specific dates. I tried: =COUNTIFS(A:A,">="&START_DATE,A:A,"<="&END_DATE,B:E,1) But that give a #VALUE error...

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Count values in a row pertaining to a specific date range column

    Sumproduct then, you can't use a whole column for this function:

    =SUMPRODUCT(($A$1:$A$21>=START_DATE)*($A$1:$A$21<=END_DATE)*($B1:$E21=1))
    Last edited by JBeaucaire; 09-23-2015 at 03:20 PM.

  6. #6
    Registered User
    Join Date
    09-23-2015
    Location
    Milwuakee, Wisconsin
    MS-Off Ver
    2010
    Posts
    3

    Re: Count values in a row pertaining to a specific date range column

    Great thanks! This is counting my "Compliant" (or "1") perfectly. Only issue is when I try to count the "0" non compliant by changing it to:

    =SUMPRODUCT(($A$1:$A$21>=START_DATE)*($A$1:$A$21<=END_DATE)*($B1:$E21=0))

    I see that it counts every blank cell as a '0' How do I change this so that it does not count blank (empty) cells?

    Thanks so much for the help!

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Count values in a row pertaining to a specific date range column

    Maybe add in:

    SUMPRODUCT(($A$1:$A$21>=START_DATE)*($A$1:$A$21<=END_DATE)*($B1:$E21=0)*(LEN($B1:$E21)>0))

+ 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. Copy range to specific column with specific date with macro
    By SEERC in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2015, 03:09 AM
  2. [SOLVED] Count cells within a specific date range that contain a specific word
    By oneillp1 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-23-2014, 08:34 AM
  3. [SOLVED] Excel-13 Add values in array matching specific row labels, column labels within date range
    By fadeoutagain27 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-18-2014, 03:55 PM
  4. Replies: 1
    Last Post: 02-05-2013, 09:14 AM
  5. Count values in a range that appear for specific dates
    By galvinpaddy in forum Excel General
    Replies: 1
    Last Post: 11-02-2011, 03:45 PM
  6. count specific values in a range
    By tammy25 in forum Excel General
    Replies: 6
    Last Post: 09-01-2011, 08:09 AM
  7. Count column w/blanks & values based on specific date
    By nickelcell1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-30-2009, 04:08 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