COUNT IF FORMULA for month/year only

%3CLINGO-SUB%20id%3D%22lingo-sub-3072173%22%20slang%3D%22en-US%22%3ECOUNT%20IF%20FORMULA%20for%20month%2Fyear%20only%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3072173%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20guys%2C%20I%20want%20to%20count%20rows%20based%20on%20the%20month%20year.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20column%20I%20want%20to%20count%20is%20in%20this%20format%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CTABLE%20width%3D%22193%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%22193%22%3E27%2F07%2F2021%200%3A00%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ebut%20I%20want%20to%20count%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJul%202021%3C%2FP%3E%3CP%3EAug%202021%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eonwards.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20this%20formula%20that%20I%20want%20to%20use%20(COUNTIFS%20because%20I%20have%20a%20couple%20more%20criterias%20to%20add)%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3DCOUNTIFS(LI%3ALI%2C%20%22Jul%202021%22)%20or%2007%2F21%20or%20whatever%20works!!%3CBR%20%2F%3E%3CBR%20%2F%3EI've%20tried%20doing%20this%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3DCOUNTIFS(TEXT(LI%3ALI%2C%22mmm%20yyyy%22)%2C%20%22Jul%202021%22)%20but%20it%20doesn't%20work.%20Any%20help%20would%20be%20appreciated!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3072173%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%20for%20web%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New Contributor

Hi guys, I want to count rows based on the month year.

 

The column I want to count is in this format:

27/07/2021 0:00

 

but I want to count it by month/year only.  eg: 

  • Jul 2021
  • Aug 2021 

 

I have this formula that I want to use (COUNTIFS because I have a couple more criterias to add)


=COUNTIFS(LI:LI, "Jul 2021") or 07/21 or whatever works!!

I've tried doing this:

=COUNTIFS(TEXT(LI:LI,"mmm yyyy"), "Jul 2021") but it doesn't work. Any help would be appreciated!

 

12 Replies
if you convert the range to pivot table & put the dates in rows & put again dates in values (select count there), so it will count how many month year u have

@alexesprtu please have a look, your dates are in this format date & time, so first it should be changed to only date, then you can use either countifs or pivot table

This counts dates right? What if I want to get count all July dates?
I think for a pivot table you might add a column to your data and use Text(A1, "mmm yy") and accumulate on this column.

Or, if you want a formula, you could try:
=Sumproduct(--(TEXT(LI:LI,"mmm yyyy")="Jul 2021"))

To add more conditional tests:
=Sumproduct(--(TEXT(LI:LI,"mmm yyyy")="Jul 2021"), --(range <=> condition))
if all july without specifying year, then we need to slightly modify the formula
I think this works great but was wondering if you could help me with the syntax when referencing to another workbook?
I would let excel do the work, click in the formula bar to go into 'edit' mode, then use the mouse to select the range in your other workbook and excel should handle the syntax.

@alexesprtu As a variant to all previous answers:

If the date/time entries are real date/time values, i.e. not texts looking like date/time, you can use a pivot table as suggested earlier. But you don't need to have the first conversion step. Pivot tables handle real date/time values very well and allow you to group them by year and month, without the need for formulae.

 

In the attached file I created a list of date/time values covering 6 years and created a simple pivot table from it (the first one). Select one specific year to display the count for each month for that year or select "All" to display the count for all months for all years together. Then you can create other tables as well from the same data source as demonstrated in the file. Your imagination is the only limiting factor here.

@alexesprtu 

NowshadAhmed_2-1643178092745.png

The criteria is your input variables. You define the month and date you want to count.

The count row shows the count. Here are the formulas used:

COUNTIF(H8:H18,H4) in H5

COUNTIF(I8:I18,I4) in I5

COUNTIF(K8:K18,K4) in K5

COUNTIF(L8:L18,L4) in L5

 

Now for the columns 'Isolating Month' and 'Isolating Date':

MONTH(G8) for (H)

DAY(G8) for (I)

TEXT(DATE(,MONTH(G8),),"mmm") for (K)

(L) shares the same formula as (I)

To use year along with month, in (K) use:
TEXT(DATE(YEAR(G8),MONTH(G8),),"mmm"&" "&"yyyy")
Make sure to use 'Month 2021' in K5. Note Month should be 3 letters. make changes to the formulas if you want months to be shown differently.
hello
what about if i have in the same day 3 entries like 1-july 20 7:20
1-july-20 7:25
1-july-20 7:30
will it still work, as these are different dates for excel, it will show 3 items in the row label isnt?
Well, give it a try and see what happens.