Countifs: how can I refer to an entire month rather then a single day?

Nelson78

Well-known Member
Joined
Sep 11, 2017
Messages
526
Office Version
  1. 2007
Hello everybody?

Suppose in L10 the following formula:

=COUNTIFS('Sheet1'!$H:$H;Report!$B29;'Sheet1'!$AF:$AF;L1;'Sheet1'!$M:$M;Report!$B$23)

L1 is a date: 27/03/2019

In this case, the result in L10 is a number that considers in Sheet1 column AF only the records dated 27/03/2019.


Now, I'd like to consider all the records dated March 2019 (from 1st to 31th): what do I have to write in L1?
 
Last edited:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Can you make another column in Sheet1 that has the year and month concatenated YYYY-MM and use a formula to put the same format in L1?

If the date you want is in some other cell, such as K1, then put this in L1:

Code:
=year(K1)&"-"&text(month(K1),"00")
 
Last edited:
Upvote 0
You can use start and end date cells (say L1 and L2) so that you use two criteria:

=COUNTIFS('Sheet1'!$H:$H;Report!$B29;'Sheet1'!$AF:$AF;">="&L1;'Sheet1'!$AF:$AF;"<="&L2;'Sheet1'!$M:$M;Report!$B$23)
 
Upvote 0
You can use start and end date cells (say L1 and L2) so that you use two criteria:

=COUNTIFS('Sheet1'!$H:$H;Report!$B29;'Sheet1'!$AF:$AF;">="&L1;'Sheet1'!$AF:$AF;"<="&L2;'Sheet1'!$M:$M;Report!$B$23)

This could be a good idea, but I'm not sure when I could have available the end date cell to refer to.

I mean: suppose today is the 15th of March 2019 and I have to calculate the records in the month of March 2019 so far, it is not granted that I already have somewhere in the sheet the end date (1st of April 2019). Presumibly, I will have it avalaible from the 2nd of April 2019 in cell M1.
 
Last edited:
Upvote 0
If L1 always has a date in the month you're interested in, you could use:

=COUNTIFS('Sheet1'!$H:$H;Report!$B29;'Sheet1'!$AF:$AF;">"&EOMONTH(L1;-1);'Sheet1'!$AF:$AF;"<="&EOMONTH(L1;0);'Sheet1'!$M:$M;Report!$B$23)
 
Upvote 0
If L1 always has a date in the month you're interested in, you could use:

=COUNTIFS('Sheet1'!$H:$H;Report!$B29;'Sheet1'!$AF:$AF;">"&EOMONTH(L1;-1);'Sheet1'!$AF:$AF;"<="&EOMONTH(L1;0);'Sheet1'!$M:$M;Report!$B$23)

Yes!
Thank's.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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