+ Reply to Thread
Results 1 to 4 of 4

sumif where criteria range is an array of dates and condition is a year

  1. #1
    Registered User
    Join Date
    12-22-2003
    Location
    Texas
    Posts
    90

    sumif where criteria range is an array of dates and condition is a year

    =SUMIF(--(year($C$1:$C$500)),$F1,D$1:D$500) - does not work

    I have figured out how to make a sumproduct work where the conditional data is an array of dates and I want to isolate the adjacent data to the dates that are in a certain year. like below.

    =SUMPRODUCT(--(YEAR($B$30:$B$113)=$B51),$C$30:$C$113) - works

    can someone please let me know how to make the above sumif work?
    Barrfly

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: sumif where criteria range is an array of dates and condition is a year

    You can't amend the source values in the SUMIF I'm afraid - as you can with SUMPRODUCT.

    For a SUMIF approach you would need to combine two:

    =SUMIF($C$1:$C$500,">="&DATE($F1,1,1),D$1:D$500)-SUMIF($C$1:$C$500,">="&DATE($F1+1,1,1),D$1:D$500)
    (assumes F1 is an integer)

    If you're using XL2007 you could use SUMIFS of course

    =SUMIFS(D$1:D$500,$C$1:$C$500,">="&DATE($F1,1,1),$C$1:$C$500,"<"&DATE($F1+1,1,1))

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

    Re: sumif where criteria range is an array of dates and condition is a year

    The first range cannot be a calculated array in the SUMIF function.

    You can add a helper column =YEAR(A1) copied down and SUMIF on that...
    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.

  4. #4
    Registered User
    Join Date
    12-22-2003
    Location
    Texas
    Posts
    90

    Re: sumif where criteria range is an array of dates and condition is a year

    thanks for the responses. I have been trying to avoid adding the superfluous helper columns, but ended up doing it to save some time. I will inject Donkey's solution shortly. Thanks again.

+ 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