Solved

CountIFS Date Range

Posted on 2014-10-30
5
157 Views
Last Modified: 2014-11-24
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
Comment
Question by:halifaxman
  • 2
5 Comments
 
LVL 27

Expert Comment

by:Glenn Ray
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 31

Accepted Solution

by:
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

by:Glenn Ray
ID: 40416114
^Nice.  Couldn't get much simpler.
0
 
LVL 45

Expert Comment

by:Martin Liss
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now