View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Fred Smith[_4_] Fred Smith[_4_] is offline
external usenet poster
 
Posts: 2,389
Default count occurences meeting criteria

What's wrong with using the formula that Rick gave you?

Unless you have XL2007, you cannot use an entire row as a range for
Sumproduct. You must use a specific range. So if your paste somehow "gets
rid of the A1 and IV1", then put it back. If your range ends at DD1, then
use:

=Sumproduct(--(Year(a1:dd1)=Year(Now())))

Regards.
Fred

"geebee" (noSPAMs) wrote in message
...
here is what i have now in cell IV1:

=SUMPRODUCT(--(RIGHT(YEAR(1:1),2)=RIGHT(YEAR(NOW()),2)))

now i am getting a #value error. i noticed that when i paste your formula
in as is, it gets rid of the A1 and IV1 and just puts 1:1 in there.



"Rick Rothstein (MVP - VB)" wrote:

Are your "dates" (the Jan-07 for example) text or real Excel dates? If
they
are real dates, you could use this...

=SUMPRODUCT(--(YEAR(A1:IV1)=YEAR(NOW())))

If you have a maximum column that your data goes to, use that column
designation in place of the IV column designation that I used.

Rick


"geebee" (noSPAMs) wrote in message
...
hi,

i have a row 1, and values across the columns in row 1 like "Jan-07"
...
dates randing from "Jan-06" through the present month. I am trying to
put
a
formula somewhere in the worksheet that counts the number of cells in
the
forst row that have a year equal to the current year. Here is what I
have,
as an array formula:

=COUNT((RIGHT(YEAR(A1:DD1),2)))=RIGHT((YEAR(TODAY( ))),2)

but it is returning FALSE

what am i doing wrong? if possible i would like to use a countif or
something else besides an array formula.

thanks in advance,
geebee