+ Reply to Thread
Results 1 to 3 of 3

Using SUMIF with YEAR function in Criteria

  1. #1
    Forum Contributor
    Join Date
    10-25-2010
    Location
    Phoenix, Arizona, USA
    MS-Off Ver
    O365
    Posts
    201

    Question Using SUMIF with YEAR function in Criteria

    I have a worksheet that contains gas usage for my vehicle.

    Column A = Date
    Column B = Odometer
    Column C = Cost
    Rows 2 thru 250 are used.

    I would like to summarize the Cost data for each year, 2006 thru 2011.

    How do I utilize the YEAR() function in the criteria to limit the data summed to a specific year?

    Thank you!

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Using SUMIF with YEAR function in Criteria

    If you want to use SUMIF, try adding first a helper column that extracts the YEAR.

    e.g.

    =YEAR(A2) copied down, where A2 contains date

    Then SUMIF on that new column...

    otherwise you can use SUMPRODUCT() if your ranges aren't too large....
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Using SUMIF with YEAR function in Criteria

    If you put the years in E2:E7, e.g. just numbers 2006, 2007 etc. then you can use a formula like this in F2 copied down

    =SUMPRODUCT(C$2:C$1000,(YEAR(A$2:A$1000)=E2)+0)

    or SUMIFS

    =SUMIFS(C:C,A:A,">="&DATE(E2,1,1),A:A,"<"&DATE(E2+1,1,1))

    You can use SUMPRODUCT with the whole column too....but it isn't recommended
    Audere est facere

+ 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