Solved

# CountIFS Date Range

Posted on 2014-10-30
172 Views
Hi

Excel 2010

I have two tabs on my worksheet
Main and Stats

In the Main I have data as follows
Matter       Date
1                  01/09/2014
2                  21/09/2014
3                  03/10/2014

In the stats I have
Month                Number
01/09/2014
01/102014

for the number column, I want to count all dates that correspond to the month and year in the Month column in the Stats tab

i.e. I would get the following based on the example data

Month                Number
01/09/2014         2
01/102014           1

Any help would be appreciated
0
Question by:halifaxman
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 27

Expert Comment

ID: 40414261
You can use an array formula to determine this.

If your Main data is in columns A&B and your Stats "Month" is in column A and you want the number of occurrences to appear in column B, you'd insert this formula (this is in cell B2, use [Ctrl]+[Shift]+[Enter] to enter):
=SUM(IF(MONTH(Main!\$B\$2:\$B\$51)&"-"&YEAR(Main!\$B\$2:\$B\$51)=MONTH(A2)&"-"&YEAR(A2),1,0))

Then copy that formula down as far as needed.  I'm only testing through row 51; you'll want to change that value to the number of rows in your Main sheet.

Example file attached.  It also has a PivotTable that verifies the results (using Group option on the dates to show month and year).

-Glenn
EE-Q28547994.xlsx
0

LVL 33

Accepted Solution

Rob Henson earned 500 total points
ID: 40415462
Don't need an array formula, this can be done with COUNTIF:

Stats sheet
Col A            Col B
Date             Count
01/09/14     =COUNTIF(Main!B:B,"<="&EOMONTH(A2,0))-COUNTIF(Main!B:B,"<"&A2)

Thanks
Rob H
0

LVL 27

Expert Comment

ID: 40416114
^Nice.  Couldn't get much simpler.
0

LVL 47

Expert Comment

ID: 40462291
I've requested that this question be closed as follows:

Accepted answer: 500 points for Rob Henson's comment #a40415462

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

: Microsoft Office Collaborate for free and online versions of Microsoft  Word, Excel, Powerpoint, OneNote, Onedrive , Email, Calendar etc. In short we can say that Microsoft office is a suite of servers, applications and services developed by  Micrâ€¦
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabilâ€¦