+ Reply to Thread
Results 1 to 5 of 5

Countifs criteria between two dates

  1. #1
    Registered User
    Join Date
    08-02-2009
    Location
    Lancashire, England
    MS-Off Ver
    Excel 2007
    Posts
    84

    Countifs criteria between two dates

    Hi All

    Im trying to use a COUNTIFS function to return the number of times a football team plays between two given dates.

    I've tried various combinations but cannot get it to work!!

    I'll attach a copy of the workbook, but basically i have Date in Column A, Home team Column B, Away team column C.

    I have a cell with the start date (I2) and cell with end date (I3) to set the required period.

    I have list of the teams in the league H5:H24, results for each team to be displayed in next column next to relevant team.

    My last effort =COUNTIFS(B:C,H5,A:A,">= I2",A:A,"<= I3") results in #VALUE!

    Not sure weather countifs is appropriate, maybe something better?

    Any pointers in the right direction would be greatly appreciated.

    Thanks in advance
    Attached Files Attached Files
    Last edited by Si902; 12-24-2011 at 05:00 AM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Countifs criteria between two dates

    All the ranges need to be the same size with COUNTIFS so to use that function you need to use it twice, once for each column, i.e. this formula in I5 copied down

    =COUNTIFS(B:B,H5,A:A,">="&I$2,A:A,"<= "&I$3)+COUNTIFS(C:C,H5,A:A,">="&I$2,A:A,"<= "&I$3)

    ....or if you prefer to avoid the repetition you can use an "array formula" for the same result, i.e.

    =SUM(IF(B$2:C$300=H5,IF(A$2:A$300>=I$2,IF(A$2:A$300<=I$3,1))))

    confirmed with CTRL+SHIFT+ENTER
    Audere est facere

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Countifs criteria between two dates

    Another possibility might be
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-02-2009
    Location
    Lancashire, England
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Countifs criteria between two dates

    Thanks daddylonglegs, i understand why it wouldnt work now.

    Thanks Marcol, im sure it works very well but im no good with code, ill stick with the COUNTIFS function, thanks all the same!

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Countifs criteria between two dates

    SUMPRODUCT() is a standard Excel function.

    The forum doesn't have tags for formulae, and there are occassions when it strips and splits a formula unless some sort of tags are used.
    Some members use code tags with native formula, some don't.

    Sorry for the confussion.

+ Reply to 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