Countif for entire current month and previous month

willow1985

Well-known Member
Joined
Jul 24, 2019
Messages
929
Office Version
  1. 365
Platform
  1. Windows
I am looking for a formula that counts all the dates in a list of the current month and of the previous month. I have this formula but I am getting no results when I should be receiving: 210 results

=COUNTIF(G2:G1000000,MONTH(TODAY()))

Any help would be appreciated

Thank you

Carla
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try:
Code:
[COLOR=#0000ff]=SUMPRODUCT(--(TEXT(G2:G1000000,"mmyyyy")=TEXT(TODAY(),"mmyyyy")))[/COLOR]+[COLOR=#ff0000]SUMPRODUCT(--(TEXT(G2:G1000000,"mmyyyy")=TEXT(EDATE(TODAY(),-1),"mmyyyy")))[/COLOR]
Note that the blue part does this month, and the red part does last month.
 
Upvote 0
Another option
=SUMPRODUCT((G2:G1000000>=EOMONTH(TODAY(),-2)+1)*(G2:G1000000<=EOMONTH(TODAY(),0)))
 
Upvote 0
Sorry I did not specify. I needed 2 individual formulas. One that counts current month and one that counts previous month.

But the above formula did not count all the dates that were in Sept and Aug. I still not a 0 result.

I have this formula that is working but it is only meant to count yesterday: =COUNTIF(G2:G1000000,TODAY()-1)

The result was 18 dates.

If it counted every date in the month of Sept I would have got over 200 results.

Thank you very much

Carla
 
Last edited:
Upvote 0
In that case just split Joe's formula into two.
 
Upvote 0
I understand what I was entering in incorrectly.

The formula works perfect. Thank you very much

Is there a way to Sum it instead of count as well? If G2:G10000 was a dollar value instead of a date?
 
Upvote 0
Actually this question is more complicated. I will start a new thread.

Thank you again!! :)
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,141
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