+ Reply to Thread
Results 1 to 14 of 14

sumif formula for date and month with match criteria

  1. #1
    Registered User
    Join Date
    05-27-2012
    Location
    langkawi
    MS-Off Ver
    2007
    Posts
    46

    sumif formula for date and month with match criteria

    Hi
    I know that in this forum, many example for sumif for date,
    I try to search for sumif for date and month if it refer to column i put the criteria.

    for example, if i insert jan for item A1, it will total jan result and so on,

    and also i want to sum for specific date from to date to for item A1
    example 01/01/2012 to 02/02/2012 (date/month/year)

    attach is my sample

    thanks

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: sumif formula for date and month with match criteria

    Hi

    1) =SUMPRODUCT((MONTH(A2:A32)=F4)*(B2:B32))

    2) =SUMPRODUCT((A2:A32>=F12)*(A2:A32<=G12)*(B2:B32))
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Valued Forum Contributor
    Join Date
    12-05-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010 & 2013
    Posts
    308

    Re: sumif formula for date and month with match criteria

    Hi

    In your example spreadsheet, Cell G4 to use the month number (e.g. 1 for January):
    Please Login or Register  to view this content.
    Cell G4, to use the three letter month (e.g. Jan for January)
    Please Login or Register  to view this content.
    Cell H12:
    Please Login or Register  to view this content.
    Hope this helps.

    Best regards, Rob.

    ---------- Post added at 06:01 PM ---------- Previous post was at 06:00 PM ----------

    Damn. Fotis beat me on the draw! :D

  4. #4
    Registered User
    Join Date
    05-27-2012
    Location
    langkawi
    MS-Off Ver
    2007
    Posts
    46

    Re: sumif formula for date and month with match criteria

    thanks guys, that is the range for row i have to put right? and both using sumproduct

    how about i want to use range for A:A and B:B that meet the item i want to search, if u can see that is item A1 and A2
    so if i select item A1 for selected month, it will sum for item A1 for that month

    or for this sumif with dynamic range (a:a) is not suitable to use?

    note A1 is not column A1, it is item, see i put A1 and A2 for column under item

    thanks

    abu
    Last edited by alimamak; 08-07-2012 at 04:25 AM.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: sumif formula for date and month with match criteria

    See this workbook, select from the drop-down in F4
    Note the formula in C2 down
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: sumif formula for date and month with match criteria

    @ rscsmith Just 1 minute!

    @ alimamak

    I am not able to follow you. What is this item A1?

    In SUMPRODUCT, YOU HAVE TO USE SPECIAL RANGE, LIKE a1:a32. So you can use something like this.

    =SUMPRODUCT((MONTH(A2:A150000)=F4)*(B2:B150000))

    =SUMPRODUCT((A2:A150000>=F12)*(A2:A150000<=G12)*(B2:B150000))

  7. #7
    Registered User
    Join Date
    05-27-2012
    Location
    langkawi
    MS-Off Ver
    2007
    Posts
    46

    Re: sumif formula for date and month with match criteria

    thanks marcol, for ur file i see that i must put the range for row i want to search
    i wonder why it cannot use A:A?

    thanks

  8. #8
    Registered User
    Join Date
    05-27-2012
    Location
    langkawi
    MS-Off Ver
    2007
    Posts
    46

    Re: sumif formula for date and month with match criteria

    sorry fotis, my mistake, here it the file that got other column for item

    sorry again

  9. #9
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: sumif formula for date and month with match criteria

    Still don't understand..

    You formulae, inclunding Items in Column A, work OK! So where is the problem?

    =SUMPRODUCT((A2:A32=F3)*(MONTH(B2:B32)=G4)*(C2:C32))

    =SUMPRODUCT((A2:A32=F11)*(B2:B32>=G12)*(B2:B32<=H12)*(C2:C32))

  10. #10
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: sumif formula for date and month with match criteria

    Try this workbook

    I only have 2003 and SUMPRODUCT() doesn't work for a whole column, it does for 2007 and above, but it is not a good idea to refer to whole columns when using SUMPRODUCT().
    Attached Files Attached Files

  11. #11
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: sumif formula for date and month with match criteria

    How about:

    In G4: =SUMIFS(B:B,A:A,">="&DATE(YEAR(A2),F4,1),A:A,"<="&EOMONTH(DATE(YEAR(A2),F4,1),0))
    or: =SUMIFS(B:B,A:A,">="&DATE(YEAR(A2),F4,1),A:A,"<"&DATE(YEAR(A2),F4+1,1))

    In H12: =SUMIFS(B:B,A:A,">="&F12,A:A,"<="&G12)

  12. #12
    Registered User
    Join Date
    05-27-2012
    Location
    langkawi
    MS-Off Ver
    2007
    Posts
    46

    Re: sumif formula for date and month with match criteria

    Quote Originally Posted by Marcol View Post
    Try this workbook

    I only have 2003 and SUMPRODUCT() doesn't work for a whole column, it does for 2007 and above, but it is not a good idea to refer to whole columns when using SUMPRODUCT().
    thanks marcol, it work and thanks for ur tips that sumproduct cannot be use for whole column and i try with sumproduct for whole column for 2010 and yet it fails, but it not matter.

    i try to make drop down list for my date from and date to but it now get the result.
    i already highlight the the row i make it drop down list in orange colour and change it format to date

    attach is the sample which i use ur sample and play with it

    thanks

  13. #13
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: sumif formula for date and month with match criteria

    Okay, perhaps it is now time to introduce you to Dynamic Named Ranges.
    Check out the Names Manager to see how this works.

    !/. You can now add more data to your table and the formula and drop-downs will adjust to suit.

    2/. If you add a new item to Column A this will be detected in the Column "Unique Items" and the drop-downs will adjust to suit.
    Keep your Items as text strings, if you use a numeric value this will fail and require a slightly different formula.
    Don't leave blanks in Column A

    3/. Try selecting a Date in the "Date To" cells that is before the "Date From" cells.
    Check out the Conditional Formatting to see how this works.

    4/. Now that we are using the exact range sizes with the names SUMPRODUCT() should be every bit as efficient as SUMIFS(), but I don't have access to 2007 at present so I can't check this out.

    Perhaps Cutter will help you out there?
    Last edited by Marcol; 08-08-2012 at 07:02 AM.

  14. #14
    Registered User
    Join Date
    05-27-2012
    Location
    langkawi
    MS-Off Ver
    2007
    Posts
    46

    Re: sumif formula for date and month with match criteria

    Quote Originally Posted by Marcol View Post
    Okay, perhaps it is now time to introduce you to Dynamic Named Ranges.
    Check out the Names Manager to see how this works.

    !/. You can now add more data to your table and the formula and drop-downs will adjust to suit.

    2/. If you add a new item to Column A this will be detected in the Column "Unique Items" and the drop-downs will adjust to suit.
    Keep your Items as text strings, if you use a numeric value this will fail and require a slightly different formula.
    Don't leave blanks in Column A

    3/. Try selecting a Date in the "Date To" cells that is before the "Date From" cells.
    Check out the Conditional Formatting to see how this works.

    4/. Now that we are using the exact range sizes with the names SUMPRODUCT() should be every bit as efficient as SUMIFS(), but I don't have access to 2007 at present so I can't check this out.

    Perhaps Cutter will help you out there?
    thanks marcol, i get it what u try to say.. for item it be wise to make it unique 1st. and for date from and to, it be wise to make name range so it will be easy to manage and to add at data validation

    i think cutter busy with other matter, i will try to play with ur example

    actually i like more sumif rather than sumproduct as the syntac for sumif look short than sumproduct as for vlookup replacement. and for date i still new on using sumif and sumproduct and i see for sumif can use whole column range that would be usefull and do not need to make modification to it column range

    thanks again marcol
    Last edited by alimamak; 08-08-2012 at 08:34 PM.

+ 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