+ Reply to Thread
Results 1 to 14 of 14

sumifs not working quite right

  1. #1
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    sumifs not working quite right

    Sumifs of dates.xlsx

    Just need to sum the data by the month and year input. Only seems to be taking the first date from the month rather than all the dates from the month?

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

    Re: sumifs not working quite right

    One option

    Put the number of the month in cell E1, rather than the text, and use:

    =SUMIFS(B2:B7,A2:A7,">="&DATEVALUE("01/"&E1&"/"&E2),A2:A7,"<"&DATEVALUE("01/"&E1+1&"/"&E2))


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    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
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: sumifs not working quite right

    Hi try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    but in E1 type 12-01-01 with such format "mmm"
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  4. #4
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    Re: sumifs not working quite right

    @tom1977

    Doesn't take into account the year. Have tried this, but just returns 0, confused :S

    Please Login or Register  to view this content.
    Last edited by Cutter; 09-19-2012 at 12:25 PM. Reason: Removed whole post quote

  5. #5
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    Re: sumifs not working quite right

    @TMShucks

    Bit messy but works, thanks
    Last edited by Cutter; 09-19-2012 at 12:25 PM. Reason: Removed whole post quote

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: sumifs not working quite right

    How is it messy? You've split the date parameters across two cells. You could just put the date in cell E1 as 01/01/2012 and format as "mmm". And in cell E2, if you wanted, you could put =E1 and format as "yyyy". So then you'd see "Jan 2012"

    Then you could use the SUMPRODUCT with MONTH and YEAR just referring to cell E1.

    I suspect that SUMIFS would be better but you'd need to adjust the formula I provided ... references to E1 would become MONTH(E1) and E2 would be YEAR(E1)

    Regards, TMS

  7. #7
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    Re: sumifs not working quite right

    Not messy as such, just a bit long winded, was hoping for a short formula so that the less excel minded can understand in the office.

    I've adapted it to this Sumifs of dates.xlsx like you suggested.
    Last edited by Cutter; 09-19-2012 at 12:26 PM. Reason: Removed whole post quote

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: sumifs not working quite right

    =SUMPRODUCT((MONTH($A$2:$A$7)=MONTH($E$3))*(YEAR($A$2:$A$7)=YEAR($E$3))*($B2:$B$7))

    Please don't quote whole posts as it just makes the thread untidy and long winded.

    Regards, TMS

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: sumifs not working quite right

    the correct sumproduct version is
    =SUMPRODUCT((MONTH($A$2:$A$7)=MONTH($E$3))*(YEAR($A$2:$A$7)=YEAR($E$3)),$B$2:$B$7)
    or
    =SUMPRODUCT(--(TEXT($A$2:$A$7,"yyyymm")=TEXT($E$3,"yyyymm")),$B$2:$B$7)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

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

    Re: sumifs not working quite right

    Here is another option:

    =SUMIFS(B2:B7,A2:A7,">="&EOMONTH(E7,-1)+1,A2:A7,"<"&EOMONTH(E7,0))
    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.

  11. #11
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    Re: sumifs not working quite right

    Quote Originally Posted by TMShucks View Post
    Please don't quote whole posts as it just makes the thread untidy and long winded.
    I that sarcasm? Cheers for the help
    Last edited by Cutter; 09-19-2012 at 12:28 PM. Reason: Removed whole post quote

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: sumifs not working quite right

    I that sarcasm?
    No, it's not. It's actually rule 12:

    12. Don't quote whole posts -- it's just clutter. If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding.

    Sometimes a moderator will tidy up after you ... but they're not your mother, so you should do it yourself ... that's sarcasm.


    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

  13. #13
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    Re: sumifs not working quite right

    Quote Originally Posted by TMShucks View Post
    No, it's not. It's actually rule 12:
    Apologies, I haven't sat and read the rules.

    I quote it all because I find it easier to follow the thread. That is ofc my opinion. However whoever thought up that rule, their opinion is quoting properly clutters a thread. Each to their own. Maybe they should be more open minded, maybe I should.

    I shall follow the rules from now on.

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: sumifs not working quite right

    @benoj2005: no problem.

    @JosephP: thanks for the rep. And, of course, for your imaginative alternatives. It always impresses me that there are so many different approaches to problems

+ 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