Not sure if a COUNTIFS formula is the way to go

willow1985

Well-known Member
Joined
Jul 24, 2019
Messages
871
Office Version
  1. 365
Platform
  1. Windows
Hello,

Can anyone help me with a formula that counts invoice dates?

Not sure if CountIF can do this or not

Basically count how many items were invoiced in the current month and then another formula to count how many in the previous month Both for the current year.

The formulas I am currently using seem to have errors and do not account for the current year:
=SUMPRODUCT(--(TEXT('WO Report'!M2:M1000001,"mmyyyy")=TEXT(TODAY(),"mmyyyy")))
=SUMPRODUCT(--(TEXT('WO Report'!M2:M1000001,"mmyyyy")=TEXT(EDATE(TODAY(),-1),"mmyyyy")))

For the first formula I should be getting a result of 260 but I am getting a result of 266 and
for the 2nd I should be getting a result of 258 instead I am getting 269 and I do not know why.

Here is the data:

Tab Names: WO ReportTab Name: Tables
Column MColumn VColumn SCurrent Month B14
Invoice DateMonthCurrent YearPrevious Month B15
2019-09-01September2019Formula
2019-09-25September2019
2019-08-11August2019
2018-08-01August2018


<colgroup><col span="2"><col span="6"></colgroup><tbody>
</tbody>

Answer should be for this data: 2 for current month and 1 for previous month

Thank you guys for your help!

Carla
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I can't tell why it's not working without seeing the rest of your data. COUNTIFS might work for you though. Try:

=COUNTIFS('WO Report'!M:M,">"&EOMONTH(TODAY(),-1),'WO Report'!M:M,"<="&EOMONTH(TODAY(),0))

to count dates in the current month, and

=COUNTIFS('WO Report'!M:M,">"&EOMONTH(TODAY(),-2),'WO Report'!M:M,"<="&EOMONTH(TODAY(),-1))

to count dates in the previous month.
 
Upvote 0
Then I assume the dates in column M are text values, not Excel dates. If so, try:

=COUNTIF('WO Report'!M:M,TEXT(TODAY(),"yyyy-mm")&"*")

and

=COUNTIF('WO Report'!M:M,TEXT(EDATE(TODAY(),-1),"yyyy-mm")&"*")

And that could be your problem. If your column has a mixture of text and dates, the results from the formulas would be unreliable.
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,037
Members
448,543
Latest member
MartinLarkin

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