+ Reply to Thread
Results 1 to 31 of 31

Help with sumif to count based on date

  1. #1
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Help with sumif to count based on date

    I'm trying to count by product type to todays day / month, ie 15 Jan ignoring the year.

    I have the formula below that counts by type but to 15 jan 2016 which is not what I need. It just needs to read todays date minus the year and apply it to the count.

    Sorry, posted wrong formula before, this is the one I'm currently using

    =SUMPRODUCT(('QOrders'!$F$9:$F12)*('QOrders'!$E$9:$E12<=TODAY())*('QOrders'!$J$9:$J12="SQ"))

    Many thanks
    Last edited by sipa; 01-15-2016 at 07:27 AM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Help with sumif to count based on date

    It would be easier to follow with a sample sheet. can you attach one?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Help with sumif to count based on date

    @ sipa ,may be
    =SUMPRODUCT((TEXT(A1:E1,"DD")=TEXT(TODAY(),"DD"))*A2:E2) for only day match


    =SUMPRODUCT((TEXT(A1:E1,"DDMM")=TEXT(TODAY(),"DDMM"))*A2:E2) for day and month match
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  4. #4
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: Help with sumif to count based on date

    Hi sipa,

    Can you give it a try:
    =SUMPRODUCT((TEXT(A1:E1,"dd-mm")<=TEXT(TODAY(),"dd-mm"))*(A2:E2))

    Regards,

  5. #5
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: Help with sumif to count based on date

    Oops, same already shared by hemesh.

  6. #6
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Help with sumif to count based on date

    use below
    =SUMPRODUCT(('QOrders'!$F$9:$F12)*(TEXT(QOrders!$E$9:$E12,"DDMM")=TEXT(TODAY(),"DDMM"))*('QOrders'!$J$9:$J12="SQ"))

  7. #7
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Re: Help with sumif to count based on date

    Thanks for the reply's

    The formula I originally posted was wrong, sorry. Please see the corrected one above.

  8. #8
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Help with sumif to count based on date

    try the last one in case that does not solve your issue then upload a sample book

  9. #9
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Re: Help with sumif to count based on date

    Hi Hemesh
    Thanks for the revised formula.
    I can see that it should work, but unfortunately it's not returning the correct value of 3, just a zero. any ideas ?

    regards

  10. #10
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Help with sumif to count based on date

    below will check month and days
    =SUMPRODUCT(('QOrders'!$F$9:$F12)*(TEXT(QOrders!$E$9:$E12,"DDMM")=TEXT(TODAY(),"DDMM"))*('QOrders'!$J$9:$J12="SQ"))

    below will check days only
    =SUMPRODUCT(('QOrders'!$F$9:$F12)*(TEXT(QOrders!$E$9:$E12,"DD")=TEXT(TODAY(),"DD"))*('QOrders'!$J$9:$J12="SQ"))

  11. #11
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Re: Help with sumif to count based on date

    As requested I've uploaded a sample workbook.

    contains data sample and required output.

    thanks
    Attached Files Attached Files

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Help with sumif to count based on date

    Are you aware that you have 2016 dates in the columns headed 2013/2014 and 2014/2015??? Is that intentional?

  13. #13
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Re: Help with sumif to count based on date

    No, my mistake. I just quickly cobbled something together to show what I'm looking for.

    The dates should be as per the header.

  14. #14
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Help with sumif to count based on date

    results you are expecting is correct?

  15. #15
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Re: Help with sumif to count based on date

    Yes, the output in the sample is correct, count for each type until & including todays date, jan 15

    count from beginning date shown

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Help with sumif to count based on date

    OK. I have changed all the incorrect dates to (what I believe to be) corrrect dates. I also rearranged your anticpated results a little, to make it easier for you to maintain the formulae in the future. this was th ebasic formula that I sed:
    =SUMPRODUCT((Data!$C$3:$K$21=$C$4)*(Data!$A$3:$I$21>=Count!B6)*(Data!$A$3:$I$21<=TODAY()))

    See it in context in the sheet.
    Attached Files Attached Files

  17. #17
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Help with sumif to count based on date

    Quote Originally Posted by sipa View Post
    Yes, the output in the sample is correct, count for each type until & including todays date, jan 15

    count from beginning date shown
    Really??? How on earth do you get those values??? back to the drawing board!!!

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Help with sumif to count based on date

    How on earth do you get 12 "ow"s in 2016 to date?

  19. #19
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Help with sumif to count based on date

    still not getting the same can you please upload a correct sample file.

  20. #20
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Re: Help with sumif to count based on date

    Ok, Here is another sample file with corrected dates and some notation to show how I'm getting my counts.
    Hope this helps and I appreciate your persistence.

    Regards
    Attached Files Attached Files

  21. #21
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Help with sumif to count based on date

    in data sheet D24 try below
    =SUMIFS(B3:B21,A3:A21,"<="&DATEVALUE(TEXT(TODAY(),"DD-mm-")&"2014"),C3:C21,C24)
    change the references

    going out,in an hour i will be back and give complete soltion

  22. #22
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Help with sumif to count based on date

    hello try on C15 where you are expecting results
    =SUMIFS(Data!$B$3:$B$21,Data!$A$3:$A$21,"<="&DATEVALUE(TEXT(TODAY(),"DD-MM-")&RIGHT(Count!A15,2)),Data!$C$3:$C$21,Count!C$13) and drag to right

    change the references to make it work with 2014/15 and 2015/16

  23. #23
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Help with sumif to count based on date

    Using your last upload and assuming that the < signs indicate what you want summed, this will sum the values for OW for the months October and November 2013/2014
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This will sum SQ for the months September, October, November, January.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Here is your workbook with the formulae filled in where you indicate
    Attached Files Attached Files
    Last edited by newdoverman; 01-15-2016 at 12:34 PM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  24. #24
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Re: Help with sumif to count based on date

    Hemesh, your solution =SUMIFS(B3:B21,A3:A21,"<="&DATEVALUE(TEXT(TODAY(),"DD-mm-")&"2014"),C3:C21,C24) Seems to be giving me the correct solution, thank you.

    Glen, thanks for your input, if you have an alternative solution I'd like to see it if possible.

    Newdoverman, thanks for your contribution, although it's not as fully automated as that by Hemesh.

    Best Regards

  25. #25
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Help with sumif to count based on date

    @ sipa, you are welcome and thanks for your kind words.
    If solutions provided here have helped you then you can mark the thread as solved.

  26. #26
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Re: Help with sumif to count based on date

    I have run into a slight issue with this solution =SUMIFS(B3:B21,A3:A21,"<="&DATEVALUE(TEXT(TODAY(),"DD-mm-")&"2014"),C3:C21,C24)

    I'm using this type of formula against data in another closed workbook, this is returning #value! , whereas it returns the correct result if the source workbook is open.
    I have read that a formula using sumproduct using the full path to the closed workbook instead of sumifs can access a closed workbook successfully. Could anyone recode the above formula using sumproduct for me please ?
    Last edited by sipa; 01-16-2016 at 04:36 PM.

  27. #27
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Help with sumif to count based on date

    The solution that I gave you in msg#23 uses SUMPRODUCT. Try adapting that to your actual situation.

    SUMIFS, I think requires open workbooks. SUMIF in all versions of Excel has this problem so I think that SUMIFS probably does too.

  28. #28
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Help with sumif to count based on date

    in case of sumproduct you can use below in sheet 2 c15
    =SUMPRODUCT((Data!$B$3:$B$21)*(Data!$A$3:$A$21<=DATEVALUE(TEXT(TODAY(),"dd-mm-")&RIGHT($A15,2))*(Data!$C$3:$C$21=C$13)))

  29. #29
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Help with sumif to count based on date

    OK. I think that this is it. One formula for the lot. I needed to remove a space in 2013 /2014 to give 2013/14 in "Count": to match the column headers in "Data" and the blank rows in your desired result.

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


    Thanks to Hemesh for making me realise that if it could work for one dataset, it could be made to work for them all
    Attached Files Attached Files

  30. #30
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Re: Help with sumif to count based on date

    Hemesh, thanks for your updated formula which is working just fine.
    Using Sumproduct with the full path to the closed workbook does indeed work, avoiding the nasty #Value! error.

    Glen, thanks also for your solution, I'm going to test them both and see which I prefer. I will update here to give further feedback.

    thanks again to everybody who helped.
    Last edited by sipa; 01-18-2016 at 08:23 AM.

  31. #31
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Help with sumif to count based on date

    @ Sipa ! You are welcome, Thanks for feedback and I Think Glenn Have given you something more powerful to work

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sumif to count up specific date
    By sipa in forum Excel General
    Replies: 2
    Last Post: 01-16-2016, 05:46 PM
  2. Replies: 3
    Last Post: 08-04-2015, 08:03 AM
  3. [SOLVED] SUMIF array formula to count unique values after a certain date
    By CakeMish in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-13-2015, 09:24 AM
  4. [SOLVED] Sumif based on date
    By andresndor in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-24-2013, 12:14 PM
  5. SUMIF Based on a date range
    By pstewart in forum Excel General
    Replies: 5
    Last Post: 08-13-2012, 02:24 AM
  6. SUMIF Based on Date Range - Help Please :)
    By Kpauly in forum Excel General
    Replies: 3
    Last Post: 02-06-2012, 03:23 PM
  7. [SOLVED] sumif based on date
    By Todd in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-24-2006, 11:30 PM

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