Count the number of cells in a given year with data

remobec

New Member
Joined
May 31, 2017
Messages
12
Hello!

I asked a similar question here: https://www.mrexcel.com/forum/excel...ber-cells-number-corresponding-date-year.html

There, I was trying to count the days in a month that had data. Now I'm trying to count the months in a year that have data.

So, right now my data looks like this:

A B
1/1/1963
#N/A
2/1/1963#N/A
3/1/19630
4/1/19631.8
5/1/19635.07
6/1/1963#N/A
7/1/19630
8/1/19631.33
9/1/19630.36
10/1/1963#N/A
11/1/19634.83
12/1/1963#N/A
1/1/19642.5
2/1/19641.29
3/1/19642.05
4/1/19646.36
5/1/19640.74
6/1/19641.37
7/1/1964#N/A
8/1/19643.05
9/1/19647.81
10/1/19642
11/1/19642.84
12/1/19640.26



<colgroup><col style="mso-width-source:userset;mso-width-alt:2486;width:51pt" width="68"> <col style="width:48pt" width="64"> </colgroup><tbody>
</tbody>


I would like to count the months that have data (whether 0 o 2 or 3 or whatever) and exclude the ones that have #n/a.

So, for 1963, it should come up with 7 and for 1964 it should come up with 11.

I tried tweaking the formula that worked for counting the days in the month, but this is really beyond me. This is the similar formula that work for that (Thanks to Aladin Akyurek)

Control+shift+enter, not just enter:
=SUM(IF($E$2:$E$400-DAY($E$2:$E$400)+1=DATE(1900,1,1),IF(ISNUMBER($D$2:$D$400),1)))

Thank you!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Assuming your data in A2:B25 try


D
E
1
Year​
Formula​
2
1963​
7​
3
1964​
11​

<tbody>
</tbody>


Formula in E2 copied down
=SUMPRODUCT(--(YEAR(A$2:A$25)=D2),--ISNUMBER(B$2:B$25))

M.
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,539
Members
449,316
Latest member
sravya

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