Countif date contains year

Fegal

Board Regular
Joined
Feb 2, 2013
Messages
101
Office Version
  1. 365
Platform
  1. Windows
Hello,
I have a qty of data containing dates ranging from 2010 to 2023. eg, 1-1-2010 upto 1-12-2023
How can I count the number of entries in each year... ?

thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Is this the sort of thing you mean?

23 12 03.xlsm
ABCD
1DateYearCount
229/01/201520103
322/01/201520112
418/06/201120120
520/09/201720132
615/06/201020141
722/12/201820153
87/05/201420162
920/01/202020171
109/09/201320183
116/12/201820191
1210/03/201620201
1319/09/201520210
1414/03/201820221
1526/05/202220230
1622/07/2011
1721/08/2019
187/01/2010
1920/12/2010
2010/08/2016
2113/03/2013
Count Dates in Year
Cell Formulas
RangeFormula
D2:D15D2=SUMPRODUCT(--(YEAR(A$2:A$21)=C2))


Another alternative would be to use a pivot Table

23 12 03.xlsm
ABEFG
1DateRow LabelsCount of Date
229/01/201520103
322/01/201520112
418/06/201120132
520/09/201720141
615/06/201020153
722/12/201820162
87/05/201420171
920/01/202020183
109/09/201320191
116/12/201820201
1210/03/201620221
1319/09/2015Grand Total20
1414/03/2018
1526/05/2022
1622/07/2011
1721/08/2019
187/01/2010
1920/12/2010
2010/08/2016
2113/03/2013
22
Count Dates in Year
 
Upvote 0
Hey!
Sorry for the slow reply. Its a little more tricky for me.
I have other stuff in the range going on.

National Training record 1.xlsx
JKLMN
2414/09/2025AchievedAchievedAchieved
251/03/20151/05/20151/07/2018
2617/12/2024AchievedAchievedAchieved
277/07/201210/09/2018
2814/09/2025AchievedAchievedAchieved
297/07/201219/9/20107/08/2018
National Training
Cell Formulas
RangeFormula
J24,J26,J28J24=IF($H25="","",H25+820)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I114:I116,J98:J112,J96,J82:J86,J142,J24:J36,J88:J92,J94,I118,J38:J80Expression=AND(I25<>"",I25-TODAY()>365)textNO
J102:J113,J82:J89,J142:J143,J92:J99,J24:J77Expression=J24-TODAY()<=0textNO
J102:J113,J82:J89,J142:J143,J92:J99,J24:J77Expression=AND(J24<>"",J24-TODAY()>0,J24-TODAY()<=90)textNO
J102:J113,J82:J89,J142:J143,J92:J99,J24:J77Expression=AND(J24<>"",J24-TODAY()>90,J24-TODAY()<=180)textNO
J102:J113,J82:J89,J142:J143,J92:J99,J24:J77Expression=AND(J24<>"",J24-TODAY()>90,J24-TODAY()<=180)textNO
J102:J113,J66:J77,J24:K25,J27:K27,J29:K29,J31:K31,J33:K33,J35:K35,J37:K37,J41:K41,J43:K43,J45:K45,J47:K47,J49:K49,J51:K51,J53:K53,J55:K55,J57:K57,J59:K59,J61:K61,J63:K63,J65:K65,I26:K26,I28:K28,I30:K30,I32:K32,I34:K34,I36:K36,I40:K40,I42:K42,I44:K44,I46:K46Cell Value=$D$5textNO
Cells with Data Validation
CellAllowCriteria
L24:N24List=$D$1:$D$8
L28:N28List=$D$1:$D$8
L26:N26List=$D$1:$D$8
 
Upvote 0
So, what are the expected results for that sample data and how would those results be laid out?
Also, please explain in words how you would get those results manually.
 
Upvote 0
I would like to have years listed in a column, 2010 onwards with a number next to it for however many times that year appears in the range.
So 2010 might appear 15 times.
Manually i would go through the cells G24:AT113 and count the number of times the year appears.
I can do this with the sumproduct, but because they range contains a mixture of text, dates and merged cells i get errors.
 
Upvote 0
Like this then?

23 12 12.xlsm
ABCGHIJKLMN
242010114/09/2025AchievedAchievedAchieved
25201101/03/20151/05/20151/07/2018
262012217/12/2024AchievedAchievedAchieved
27201307/07/201210/09/2018
282014014/09/2025AchievedAchievedAchieved
29201527/07/201219/09/20107/08/2018
3020160
3120170
3220183
3320190
3420200
3520210
3620220
3720230
3820241
3920252
Count Years
Cell Formulas
RangeFormula
B24:B39B24=SUMPRODUCT(--(IFERROR(YEAR(G$24:AT$113),0)=A24))
 
Upvote 0
Sorry to pest.
i changed it to ignore 2 columns which contain future dates which i dont want counted, =SUMPRODUCT(--(IFERROR(YEAR(H$24:I$113,l$24:AT113),0)=B148))

i broke it...
 
Upvote 0
that works perfectly. thank you!
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.


i changed it to ignore 2 columns which contain future dates which i dont want counted, =SUMPRODUCT(--(IFERROR(YEAR(H$24:I$113,l$24:AT113),0)=B148))

i broke it...
Excel Formula:
=SUMPRODUCT(--(IFERROR(YEAR(H$24:I$113),0)=B148))+SUMPRODUCT(--(IFERROR(YEAR(L$24:AT$113),0)=B148))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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