Function - Counting Years in range

V

VBA Noob

Hi,

I've got a list of around 300 dates Format e.g 01/07/2006 for differen
years. Also some entries have ' in front of them to make them text

I want to count the number of dates in say A2 to A300 (may have blanks
and then count the how many in current year 2006.

Would like it to return something like "There are 200 entries i
current year out of 299".

Thanks in advance

VBA Noo
 
B

Bondi

VBA said:
Hi,

I've got a list of around 300 dates Format e.g 01/07/2006 for different
years. Also some entries have ' in front of them to make them text

I want to count the number of dates in say A2 to A300 (may have blanks)
and then count the how many in current year 2006.

Would like it to return something like "There are 200 entries in
current year out of 299".

Thanks in advance

VBA Noob

Hi,

Maybe you can use something like:

="There are
"&SUMPRODUCT(--(RIGHT(TEXT(A2:A300,"dd/mm/yyyy"),4)="2006"))&" entries
in current year out of "&COUNTA(A2:A300)

Regards,
Bondi
 
V

VBA Noob

Thanks

Worked a treat.

I got the right function and count function part but it was how to sum
them that stump me was trying Countif

VBA Noob
 
D

Dave Peterson

Another alternative...
=SUMPRODUCT(--(TEXT(A2:A300,"yyyy")="2006"))
or
=SUMPRODUCT(--(year(A2:A300)=2006))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top