# CountIFS Date Range

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
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Excel VBA DeveloperCommented:
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
Finance AnalystCommented:
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

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Excel VBA DeveloperCommented:
^Nice.  Couldn't get much simpler.
Older than dirtCommented:
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.
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.