Countif based on dates within a column

Sifuevs

New Member
Joined
May 8, 2015
Messages
25
Office Version
  1. 365
Platform
  1. Windows
Hi,
I am relatively new to Excel and I am looking for help with a formula.
So all my data is stored in the data tab (see attached image). I have another tab that will calculate and display results, the summary tab (see attached image).
So I want to the formula to do the following:
Column A in the data tab contains date. If any date within the column contains the month of Feb for instance then COUNTA(Data!C2:C4624.
I did try some formula but keep getting a spill error (as I am a novice I am not sure what I am doing wrong, sorry).

Thanks for help :)
 

Attachments

  • data tab.jpg
    data tab.jpg
    237.6 KB · Views: 24
  • summary tab.jpg
    summary tab.jpg
    40.3 KB · Views: 22

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
You're creating a spilled array, for each cell in the range A2:A4624 excel wants to place a value in the 4623 cells below the cell where you see the SPILL# message.

There are a number of ways to get around this, but some solutions may not work in your excel version. Can you please update your profile so your excel version shows up on your profile button (see how mine says 365?).

But, one way that should work for most versions of excel is:
Excel Formula:
=SUMPRODUCT((MONTH(Data!A2:A4624)=2)*(Data!C2:C4624<>""))
 
Upvote 0
Please go into your Mr Excel Account Profile and update what version of Excel you are using. (Oops duplicated the above here ;))
If you are using pre MS365 / O2021 the Awoohaw's method would be the way to go.

Since you are getting #SPILL I suspect you have MS365, in which case something like this might work for you.
Excel Formula:
=COUNTA(FILTER(Data!$C$2:$C$4624,MONTH(Data!$A$2:$A$4624)=2,""))
 
Upvote 0
You're creating a spilled array, for each cell in the range A2:A4624 excel wants to place a value in the 4623 cells below the cell where you see the SPILL# message.

There are a number of ways to get around this, but some solutions may not work in your excel version. Can you please update your profile so your excel version shows up on your profile button (see how mine says 365?).

But, one way that should work for most versions of excel is:
Excel Formula:
=SUMPRODUCT((MONTH(Data!A2:A4624)=2)*(Data!C2:C4624<>""))[/
[/QUOTE]

You're creating a spilled array, for each cell in the range A2:A4624 excel wants to place a value in the 4623 cells below the cell where you see the SPILL# message.

There are a number of ways to get around this, but some solutions may not work in your excel version. Can you please update your profile so your excel version shows up on your profile button (see how mine says 365?).

But, one way that should work for most versions of excel is:
Excel Formula:
=SUMPRODUCT((MONTH(Data!A2:A4624)=2)*(Data!C2:C4624<>""))
Thanks for your reply. I have now updated my profile and yes I am using 365.
The formula worked but it discards any dates that are the same. I need the count to include dates that are the same. So I can get a total line qty of all dates falling with the month of Feb.
Thanks again. Much appreciated :)
 
Upvote 0
Please go into your Mr Excel Account Profile and update what version of Excel you are using. (Oops duplicated the above here ;))
If you are using pre MS365 / O2021 the Awoohaw's method would be the way to go.

Since you are getting #SPILL I suspect you have MS365, in which case something like this might work for you.
Excel Formula:
=COUNTA(FILTER(Data!$C$2:$C$4624,MONTH(Data!$A$2:$A$4624)=2,""))[/CODE
[/QUOTE]
Thanks for your reply.
With this formula I get a notification box "This function is not valid"?
 
Upvote 0
not sure what you mean? the Month(cellref)=2 function will get only February records, and the cellref<>"" will get the non blanks.
Please post some examples of what you think should have been included? The xl2bb add in (link below) is very helpful with that.
 
Upvote 0
not sure what you mean? the Month(cellref)=2 function will get only February records, and the cellref<>"" will get the non blanks.
Please post some examples of what you think should have been included? The xl2bb add in (link below) is very helpful with that.
Sorry, my mistake. The formula works perfect. Thank you :)
I also have other formula that needs to do the same, look to see if column A values fall in the month of Feb and if so then do this =COUNTIFS(Data!$G$3:$G$4625,"REPLEN",Data!$I$3:$I$4625,"A")
Is this possible or too much?
Again much appreciate your help.
This forum is a god send and I value you guys so much.
 
Upvote 0
i'm guessing you want to count the number of "REPLEN" in column G, that occur when Column A has a month of February.
Excel Formula:
=SUMPRODUCT((MONTH(Data!A2:A4624)=2)*(Data!G2:G4624="REPLEN"))

I don't know what you're checking in column I.
 
Upvote 0
not sure what you mean? the Month(cellref)=2 function will get only February records, and the cellref<>"" will get the non blanks.
Please post some examples of what you think should have been included? The xl2bb add in (link below) is very helpful with that.
Sorry, my mistake. The formula works perfect. Thank you :)
I also have other formula that needs to do the same, look to see if column A values fall in the month of Feb and if so then do this =COUNTIFS(Data!$G$3:$G$4625,"REPLEN",Data!$I$3:$I$4625,"A")
Is this possible or too much?
Again much appreciate your help.
This forum is a god send and I value you guys so much.
i'm guessing you want to count the number of "REPLEN" in column G, that occur when Column A has a month of February.
Excel Formula:
=SUMPRODUCT((MONTH(Data!A2:A4624)=2)*(Data!G2:G4624="REPLEN"))

I don't know what you're checking in column I.
So sorry.
So if the dates in data range A2:A4624 = the month of Feb and if data in G2:G4624="Replen" and if code in data range I3:I4624 = "A" then count the qty of lines.
Hope this makes more sense.
Again thanks for your help.
 
Upvote 0
Just follow the pattern that awoohaw is using:
Excel Formula:
=SUMPRODUCT( (MONTH(Data!A2:A4624)=2) * (Data!G2:G4624="REPLEN") * (Data!I2:I4624="A") )
 
Upvote 0

Forum statistics

Threads
1,224,832
Messages
6,181,235
Members
453,026
Latest member
cknader

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