SUMIF() confusion (Excel 2003)

A

Ann Scharpf

I have a table with named ranges:

A = Date
F = LWOP

I am trying to calculate the LWOP taken in the CURRENT calendar year. My
formula is yielding a result of 0, even though there are 8 hours of LWOP with
a date of 2010.

These are the formulas I have tried:

=SUMIF(Date,"YEAR(Date)=YEAR(TODAY())",LWOP)
=SUMIF(Date,IF("Year(Date)=2010",TRUE),LWOP)

(I also tried both of those without the quotation marks.)

Looking at the posts here, I saw one that seemed similar from last September
and I tried this:

=SUMIF(Date,YEAR(Date) "=" & YEAR(TODAY()),LWOP)

Excel tells me I have an error with that one and won't even let me save the
formula.

I'm really perplexed. Can anyone advise me how to fix this? (I know I'm
going to smack myself in the head when someone tells me what I'm doing wrong.)

As always, thanks so much for your help.
 
G

Glenn

Ann said:
I have a table with named ranges:

A = Date
F = LWOP

I am trying to calculate the LWOP taken in the CURRENT calendar year. My
formula is yielding a result of 0, even though there are 8 hours of LWOP with
a date of 2010.

These are the formulas I have tried:

=SUMIF(Date,"YEAR(Date)=YEAR(TODAY())",LWOP)
=SUMIF(Date,IF("Year(Date)=2010",TRUE),LWOP)

(I also tried both of those without the quotation marks.)

Looking at the posts here, I saw one that seemed similar from last September
and I tried this:

=SUMIF(Date,YEAR(Date) "=" & YEAR(TODAY()),LWOP)

Excel tells me I have an error with that one and won't even let me save the
formula.

I'm really perplexed. Can anyone advise me how to fix this? (I know I'm
going to smack myself in the head when someone tells me what I'm doing wrong.)

As always, thanks so much for your help.


Try this:

=SUMPRODUCT(--(YEAR(Date)=YEAR(TODAY())),LWOP)

Also, I suggest NOT using a defined name that is the same as a function name.
 
A

Ann Scharpf

Thanks to both of you for posting about the SUMPRODUCT(). I thought I only
needed to use that function if I was looking at two or more conditions.

I've also never used the DATE() function. Didn't realize it was a function.
I'll rename my range.
 

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