ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   countif and date formats (https://www.excelbanter.com/excel-discussion-misc-queries/118200-countif-date-formats.html)

shnim1

countif and date formats
 
Hi

I have a list of dates (in 12/12/2004 format) in a column. I need to seach how many dates are in the list with a year of 2004, regardless of day or month. I was using the countif function (=countif(a2:z2,"=2004") but it does not recognize any cells since there are months and days attached in the list. I also cannot change the list to show just years either....

I hope that this makes sense, and thanks for any help

Dave Peterson

countif and date formats
 
Column or Row?

=sumproduct(--(YEAR(A2:Z2)=2004))

Adjust the ranges to match--but you can't use whole columns.

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html

shnim1 wrote:

Hi

I have a list of dates (in 12/12/2004 format) in a column. I need to
seach how many dates are in the list with a year of 2004, regardless of
day or month. I was using the countif function (=countif(a2:z2,"=2004")
but it does not recognize any cells since there are months and days
attached in the list. I also cannot change the list to show just years
either....

I hope that this makes sense, and thanks for any help

--
shnim1


--

Dave Peterson


All times are GMT +1. The time now is 04:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com