+ Reply to Thread
Results 1 to 4 of 4

COUNTIF and arrays?

Hybrid View

aikorei COUNTIF and arrays? 08-16-2012, 11:11 AM
NBVC Re: COUNTIF and arrays? 08-16-2012, 11:14 AM
jason.b75 Re: COUNTIF and arrays? 08-16-2012, 11:17 AM
aikorei Re: COUNTIF and arrays? 08-16-2012, 11:27 AM
  1. #1
    Registered User
    Join Date
    07-18-2007
    Location
    Seattle, WA, USA
    MS-Off Ver
    2016
    Posts
    42

    COUNTIF and arrays?

    This seems like it should be very simple, but the solution has evaded me the last few days.

    Basically, I have huge amounts of data (tens of thousands of rows) that include dates and times. I'd like to simply count the rows of data between certain date ranges, e.g. how many rows of data fall between 7/1/2012 and 7/8/2012? I've considered using COUNTIF with an array of some sort, but I haven't had any luck so far. My best guess at a formula has been:

    =COUNTIF(C:C,AND(C:C>=DATE(2012,7,1),C:C<=DATE(2012,7,7)=TRUE))

    I've tried both as an array and not, as well as tossing in INDEX() nested within the AND() formula. All instances have produced a result of 0 (there should be 156).

    Again, I know it should be simple, but it's lost on me. Any help would be greatly appreciated.
    -Aikorei

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: COUNTIF and arrays?

    If you have XL2007 or 2010, try:

    =COUNTIFS(C:C,">="&DATE(2012,7,1),C:C,"<="&DATE(2012,7,7))

    else.

    =COUNTIF(C:C,">="&DATE(2012,7,1))-COUNTIF(C:C,">"&DATE(2012,7,7))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: COUNTIF and arrays?

    It is simple, with excel 2007 or later you use countifS, not countif

    =COUNTIFS(C:C,">="&DATE(2012,7,1),C:C,"<="&DATE(2012,7,7))

    With older versions you need a sumproduct equivilant.

  4. #4
    Registered User
    Join Date
    07-18-2007
    Location
    Seattle, WA, USA
    MS-Off Ver
    2016
    Posts
    42

    Re: COUNTIF and arrays?

    Ah! I knew there was a simple solution. Thanks for humoring me, guys. That did the trick. =)

+ 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