+ Reply to Thread
Results 1 to 6 of 6

how to sum values by year

  1. #1
    Registered User
    Join Date
    11-29-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2010
    Posts
    2

    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?

    Thanks in advantage.
    Last edited by FDibbins; 11-29-2012 at 04:06 PM. Reason: poor thread title

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2003,2007,2010
    Posts
    32,557

    Re: how to sum values by year

    You need SUMPRODUCT

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


    Regards, TMS
    Trevor Shuttleworth - Excel Aid

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    13,764

    Re: how to sum values by year

    See the attached file.

    (with pivot table)
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 2000/3/7/10/13/16
    Posts
    50,926

    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))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    11-29-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2010
    Posts
    2

    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. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2003,2007,2010
    Posts
    32,557

    Re: how to sum values by year

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

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

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Bookmarks

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