Count a specific value within a month with a formula in an excel report
A pivot table is more practical to count how many times a value appears within a month but sometimes, I need to know in a quick way so using a formula is much better. For instance, I want to know how many times chocolate appears only in February.
When I use the formula ?
To know quickly how many times a value appears in a month.
How to use the formula ?
The formula in this topic is with "," so depending of the operating system of your PC, the formula should have ";" instead of ",".
How is/are the formula(s) ?
=COUNTIFS()
=COUNTIFS(A:A,">="&H1,A:A,"<="&H2,B:B,"chocolate") or =COUNTIFS(A:A,">="&H1,A:A,"<="&H2,B:B,D1)
If I don’t want to use the cells of start/end month, I have to put the date into the formula, in this case, I have 2 options:
- First option:
=COUNTIFS(A:A,">=01.02.2019",A:A,"<=28.02.2019 23:59",B:B,"chocolate") or =COUNTIFS(A:A,">=01.02.2019",A:A,"<=28.02.2019 23:59",B:B,D1) - Second option:
=COUNTIFS(A:A,">="&DATE(YEAR(NOW()),MONTH(NOW())-1,1),A:A,"<"&DATE(YEAR(NOW()),MONTH(NOW()),1),B:B,"chocolate") or =COUNTIFS(A:A,">="&DATE(YEAR(NOW()),MONTH(NOW())-1,1),A:A,"<"&DATE(YEAR(NOW()),MONTH(NOW()),1),B:B,D1)
Interesting Topics
-
Be successfully certified ITIL 4 Managing Professional
Study, study and study, I couldn’t be successfully certified without studying it, if you are interested...
-
Be successfully certified ITIL 4 Strategic Leader
With my ITIL 4 Managing Professional certification (ITIL MP) in the pocket, it was time to go for the...
-
Hide visual and change background color based on selection
Some small tricks to customize the background colour of a text box...
-
Stacked and clustered column chart or double stacked column chart
In excel, I use a lot the combination of clustered and stacked chart...