Count if date matches specific month

Papi

Well-known Member
Joined
May 22, 2007
Messages
1,592
Rows are created when maintenance is performed on equipment. The date will be entered in column A of each row. Yes will be entered each time a filter is changed (Air Filter, Oil Filter and Hydraulic filter. The Main worksheet is where the data is entered. The Month worksheet is where the count of filters is to be calculated. I simply entered the number of filters to give an example of how the totals would look based on the main worksheet. March shows 4 dates of which 2 air filters were used, 2 Oil filters were used and 1 Hydraulic filter.
Thank you.

MAIN WORKSHEET
DateAirOilHydr
Mon Jan 06YesYesYes
Wed Feb 05Yes
Fri Feb 28Yes
Fri Mar 06YesYes
Mon Mar 16Yes
Mon Mar 23Yes
Mon Mar 30Yes
Tue Apr 07YesYes
Sat Apr 18YesYes
Thu Apr 30YesYesYes

MONTH COUNTS WORKSHEET

MonthAir FilterHydraulicOil
Jan
1​
1​
1​
Feb
2​
Mar
2​
1​
2​
Apr
3​
1​
3​
Total
6​
3​
8​

 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi,

I'll have a look more at this a little later as this probably isn't the best way.

Firstly you'll need to make the date it actual dates formats so the date formulas will work.

You can add a column to the left with the month and year if necessary.

Then use a formula like below, with the C17 cell referencing the month so say Feb, you can add another criteria for year as well.

Air Formula
=COUNTIFS(C2:C11,"Yes",C2:C11,MONTH(C17))

MonthDateAirOilHydr
2​
08/02/2019​
YesYesYes
2​
02/02/2019​
YesYes
2​
03/02/2019​
Yes
2​
04/02/2019​
YesYes
2​
05/02/2019​
Yes
2​
06/02/2019​
Yes
2​
07/02/2019​
Yes
2​
06/02/2019​
YesYes
2​
09/02/2019​
YesYes
2​
10/02/2019​
YesYesYes
 
Upvote 0
I created a counts worksheet with the filter types in B1:D1 and the months in A2:A5, then entered the following formula in B2 and copied across and down with shift+control+enter:
=SUMPRODUCT(IF(ISNUMBER(FIND($A2,Main!$A$3:$A$12)),1,0)*(Main!B$3:B$12="Yes"))
 
Upvote 0
Sorry for not returning to respond to both replies. Thanks so much for all the help. It works great!
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top