I have a table with cells with date-format (d-mmm-yyyy).
I want to find the number of celles which refers to a specific year using formula COUNTIF.
Can somebody help me with the formula ?
I have a table with cells with date-format (d-mmm-yyyy).
I want to find the number of celles which refers to a specific year using formula COUNTIF.
Can somebody help me with the formula ?
Last edited by Saturn; 04-20-2011 at 12:25 AM.
If you have to use COUNTIF, then perhaps something like:
=COUNTIF(A:A,">="&DATE(2011,1,1))-COUNTIF(A:A,">"&DATE(2011,12,31))
or you can use Sumproduct:
=Sumproduct(--(Year(A1:A100)=2011))
Where there is a will there are many ways.
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
NBVC: great! Thank you, once again!
I have reopened this thread.
I have two questions:
1: what does the "--" in ..(--(YEAR.. stand for?
2: I want to add sum of kilometer for each year. Please see the attachment. I have tried SUMPRODUCT and SUMIFS without success.
Saturn
The -- is a double unary. It is used to coerce TRUE and FALSE results from the conditional checks to 1's and 0's, respectively, so that the match can be performed.
Try:
=SUMPRODUCT(--(YEAR($B$4:$B$16)=F4),$C$4:$C$16)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks