# how to sum values by year

1. ## how to sum values by year

Hi,

Does somebody knows a formula for this?

year sold price
2004 305 11.56
2006 75 9.8
2007 98 10.9
2004 197 4.5
2005 256 15
2006 48 7.6
2004 310 18.9

Now I need the total amount for 2004 in one cell eg (305*11.56+197*4.5+310*18.9) so which formula can I use for this?

2. ## Re: how to sum values by year

You need SUMPRODUCT

=SUMPRODUCT(--(year range=2004),--(sold range),--(price range))

Regards, TMS

3. ## Re: how to sum values by year

See the attached file.

(with pivot table)

4. ## Re: how to sum values by year

Hi there and welcome to the forum.

I have changed you're thread title so something that explains you're requirements better.

thanks

try the following...
=SUMPRODUCT(--(\$A\$2:\$A\$8=2004),--(B2:B8),--(C2:C8))

5. ## Re: how to sum values by year

Thanks all for the quick response.

=SUMPRODUCT(--(\$A\$2:\$A\$8=2004),--(B2:B8),--(C2:C8))
this works like a charm

But I want to understand how it works can someone explain it to me?
Especially what this (--) means.

6. ## Re: how to sum values by year

New quick method:

Or you can use this way:

How to mark a thread Solved
Go to the first post
Click edit
Just below the word Title you will see a dropdown with the word No prefix.
Change to Solved
Click Save

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1