Sum if between two dates in Excel: SUMIFS with date range as criteria

Working on a report, investment plan or any other dataset with dates, you may often need to sum numbers within a specific period. This tutorial will teach you a quick and easy solution - SUMIFS formula with date range as criteria.

On our blog and other Excel forums, people often ask how to use SUMIF for date range. The point is that to sum between two dates, you need to define both dates while the Excel SUMIF function only allows one condition. Luckily, we also have the SUMIFS function that supports multiple criteria.

How to sum if between two dates in Excel

To sum values within a certain date range, use a SUMIFS formula with start and end dates as criteria. The syntax of the SUMIFS function requires that you first specify the values to add up (sum_range), and then provide range/criteria pairs. In our case, the range (a list of dates) will be the same for both criteria.

Considering the above, the generic formulas to sum values between two dates take this form:

Including the threshold dates:

SUMIFS(sum_range, dates,">=start_date", dates, "<=end_date")

Excluding the threshold dates:

SUMIFS(sum_range, dates,">start_date", dates, "<end_date")

As you can see, the difference is only in the logical operators. In the first formula, we use greater than or equal to (>=) and less than or equal to (<=) to include the threshold dates in the result. The second formula checks if a date is greater than (>) or less than (<), leaving out the start and end dates.

In the table below, suppose you want to sum projects that are due in a particular date range, inclusive. To have it done, use this formula:

=SUMIFS(B2:B10, C2:C10, ">=9/10/2020", C2:C10, "<=9/20/2020")

If you'd rather not hardcode a date range in the formula, then you can type the start date in F1, the end date in G1, concatenate the logical operators and cell references and enclose the whole criteria in quotation marks like this:

=SUMIFS(B2:B10, C2:C10, ">="&F1, C2:C10, "<="&G1)
Formula to sum data between 2 dates

To avoid possible mistakes, you can supply dates with the help of the DATE function:

=SUMIFS(B2:B10, C2:C10, ">="&DATE(2020,9,10), C2:C10, "<="&DATE(2020,9,20))

Sum within a dynamic range based on today's date

In situation when you need to sum data within a dynamic date range (X days back from today or Y days forward), construct the criteria by using the TODAY function, which will get the current date and update it automatically.

For example, to sum budgets that are due in the last 7 days including todays' date, the formula is:

=SUMIFS(B2:B10, C2:C10, "<="&TODAY(), C2:C10, ">"&TODAY()-7)

If you'd rather not include the current date in the final result, use the less than operator (<) for the first criteria to exclude today's date and greater than or equal to (>=) for the second criteria to include the date which is 7 days before today:

=SUMIFS(B2:B10, C2:C10, "<"&TODAY(), C2:C10, ">="&TODAY()-7)
Sum values within a range based on today's date

In a similar manner, you can sum values if a date is a given number of days forward.

For example, to get a total of budgets that are due in the next 3 days, use one of the following formulas:

Today's date is included in the result:

=SUMIFS(B2:B10, C2:C10, ">="&TODAY(), C2:C10, "<"&TODAY()+3)

Today's date is not included in the result:

=SUMIFS(B2:B10, C2:C10, ">"&TODAY(), C2:C10, "<="&TODAY()+3)
Sum values for a given number of days forward from today

Sum if between two dates and another criteria

To sum values within a date range that meet some other condition in a different column, simply add one more range/criteria pair to your SUMIFS formula.

For example, to sum budgets within a certain date range for all the projects that contain "tip" in their names, extend the formula with a wildcard criteria:

=SUMIFS(B2:B10, C2:C10, ">="&F1, C2:C10, "<="&G1, A2:A10, "tip*")

Where A2:A10 are the project names, B2:B10 are the numbers to sum, C2:C10 are the dates to check, F1 is the start date and G1 is the end date.

Of course, nothing prevents you from entering the third criteria in a separate cell too, and referencing that cell like shown in the screenshot:
Formula to sum if between two dates and another criteria

SUMIFS date criteria syntax

When it comes to using dates as criteria for Excel SUMIF and SUMIFS functions, you wouldn't be the first person to get confused :)

Upon a closer look, however, all the variety of use cases boils down to a few simple rules:

If you put dates directly in the criteria arguments, then type a logical operator (>, <, =, <>) right before the date and enclose the whole criteria in quotes. For example:

=SUMIFS(B2:B10, C2:C10, ">=9/10/2020", C2:C10, "<=9/20/2020")

When a date is input in a predefined cell, provide criteria in the form of a text string: enclose a logical operator in quotation marks to start a string and use an ampersand (&) to concatenate and finish the string off. For instance:

=SUMIFS(B2:B10, C2:C10, ">="&F1, C2:C10, "<="&G1)

When a date is driven by another function such as DATE or TODAY(), concatenate a comparison operator and a function. For example:

=SUMIFS(B2:B10, C2:C10, ">="&DATE(2020,9,10), C2:C10, "<="&TODAY())

Excel SUMIFS between dates not working

In case your formula is not working or producing wrong results, the following troubleshooting tips may shed light on why it fails and help you fix the issue.

Check the format of dates and numbers

If a seemingly correct SUMIFS formula returns nothing but zero, the first thing to check is that your dates are really dates, and not text strings that only look like dates. Next, make certain you are summing numbers, and not numbers stored as text. The following tutorials will help you spot and fix these issues.

Use the correct syntax for criteria

When checking dates using SUMIFS, a date should be put inside the quotation marks like ">=9/10/2020"; cell references and functions should be placed outside the quotes like "<="&G1 or "<="&TODAY(). For full details, please see date criteria syntax.

Verify the formula's logic

A small typo in a budget could cost millions. A little mistake in a formula might cost hours of debugging time. So, when summing between 2 dates, check if the start date is preceded by the greater than (>) or greater than or equal to (>=) operator and the end date is prefixed by less than (<) or less than or equal to (<=).

Make sure all ranges are the same size

For the SUMIFS function to work correctly, the sum range and criteria ranges should be equally sized, otherwise a #VALUE! error occurs. To fix it, ensure that all criteria_range arguments have the same number of rows and columns as sum_range.

That's how to use the Excel SUMIFS function to sum data in a date range. If you have some other interesting solutions in mind, I'll be really grateful if you share in comments. Thank you for reading and hope to see you on our blog next week!

Practice workbook for download

SUMIFS date range examples (.xlsx file)

210 comments

  1. Thanks for the help.

  2. With much help from this board - i was finally able to sum all amounts related to a specific category
    Amazon =SUMIF($C$18:$D$1516,G18,$D$18:$D$1516) $481.38
    APPLE =SUMIF($C$18:$D$1516,G19,$D$18:$D$1516) 56.38
    AUTO GAS =SUMIF($C$18:$D$1516,G20,$D$18:$D$1516) 1662.59
    ETC
    But now I want to ALSO sum WITHIN a date range....ie all Amazon purchases for 2022.. I input :
    =SUMIF(H19,">=01/01/2022"&""<=12/31/2022)
    I initially only had one " after the & sign but a window popped up saying (we found a typo in your formula and tried to correct it - do you want to accept this correction..I said yes)...but I still got a -0- result.
    What am I doing wrong - what SHOULD the formula be?

  3. Hi,

    I have an excel with two tabs, one has the daily report on it with numbers and the 2nd tab needs to capture data weekly, if the month is ending 2 days in a week it has to be 2 days data, if it is 5 days a week then it has to be 5 days a week. Currently i am manually going back and forth to each tab and linking the file. is there any formula to auto sum weekly data from daily tab. please let me knoe

    1. Hi! You can sum data by the number of the month and the number of the week. If the month and week numbers are written to additional columns using the MONTH and WEEKNUM functions, you can use the SUMIFS function. The formula might look like this:

      =SUMIFS(B1:B20,E1:E20,18,F1:F20,5)

  4. The best and easiest to follow explanation of using sumif between two dates and another criteria. Thank you, thanks you, thank you :D I've now got a sheet that does exactly what I want it to do.

  5. Thanks

  6. Would appreciate someone's help...

    These two SumIf formulas in the same spreadsheet produce different results:

    =SUMIFS($AC2:$AC4655,$D2:$D4655,">=06/01/2023 ??:??",$D2:$D4655,"=06/01/2023 ??:??",$D2:$D4655,"<=06/31/2023 ??:??") yields $21,344.95

    My question is, since I am not inputting a 6/31 date, why should the sums be different?

    Cheers!
    Tom

    1. Hi! I can't check your formula because I don't have your data. Remove the ??:??
      Also keep in mind that date 06/01/2023 means 06/01/2023 00:00:00.
      All the necessary information is in the article above.

      1. The data in column AC are $ amounts in currency format. The data in column D are dates in text format: 06/01/2023 14:15.

        1. Appreciate your considering the issue!

          1. Looking at my original post I se only one formula managed to get pasted in. Weird. The formula I thought would be proper is:

            =SUMIFS($AC2:$AC4655,$D2:$D4655,">=06/01/2023 ??:??",$D2:$D4655,"=06/01/2023 ??:??",$D2:$D4655,"<=06/31/2023 ??:??") yields $21,344.95

            Many thanks!
            Tom

            1. So I'll try this. The first formula, the one I believed would be correct is:

              =SUMIFS($AC2:$AC4655,$D2:$D4655,">=06/01/2023 ??:??",$D2:$D4655,"<=06/30/2023 ??:??"

              This yields $20,414.95

              1. Ok, since that posted correctly, here's the second formula, where only end date has changed:

                =SUMIFS($AC2:$AC4655,$D2:$D4655,">=06/01/2023 ??:??",$D2:$D4655,"<=06/31/2023 ??:??")

                This yields $21,344.95

                But I do not have any 06/31/2023 entries in my D column data

    2. Don't know what happened there. The two formulas should be...

      Would appreciate someone's help...

      These two SumIf formulas produce different results:

      =SUMIFS($AC2:$AC4655,$D2:$D4655,">=06/01/2023 ??:??",$D2:$D4655,"=06/01/2023 ??:??",$D2:$D4655,"<=06/31/2023 ??:??") yields $21,344.95

      My question is, since I am not inputting a 6/31 date, why should the sums be different?

      1. It's still screwed up. Not what I am inputting to this replay box.

  7. How do I sum based on a dynamic date range? I'm trying to build a mortgage calculator where the mortgage will commence on a certain day (say today) but clients keep asking me how much will they pay in principal and interest within that calendar year (i.e. Dec-31 20xx). How would I program the SUMIF so that I can get interest and principal outputs for that calendar year (i.e. mortgage starts in any month).

    Keep in mind the excel sheet has a row for each month already so I know the IPMT and PPMT for each month, but the summation is where its tricky for me. I'd like to program it so that whichever calendar year we're in (i.e. 2023, 2024, 2025), the SUMIF function would output the summation of the interest paid for that calendar year only

    1. I'm trying to avoid hard coding dates or use the (=SUMIFS(B2:B10, C2:C10, ">="&F1, C2:C10, "<="&G1, A2:A10, "tip*") example above as that would require some manual inputting of dates. It'd be ideal if Excel could pick up the first month (e.g. March, or whichever month the property is closing in) and calculate the interest automatically up until December, and the same thing for the next calendar year, and keep continuing and providing 30 outputs for the 30-year amortization period (the last year will be January to February based on the example above).

      1. Hi! If I understand your task correctly, to automatically get the date of the last day of the current year in cell G1, use the DATE function.

        =DATE(YEAR(TODAY()),12,31)

        Hope this is what you need.

        1. Hi Alex, thanks for looking into this. Unfortunately, it doesn't answer my question. I'm not trying to output a date but rather a summation of a column based on a dynamic date.

          The date range will be dynamic but how do I loop this into the summation formula??

          - Basically if the mortgage starts in May 2023 then I'd like to do a summation of my interest and principal columns up until December 2023 (i.e. the first year).

          - Then I would like to do a straightforward calculation January to December (for the next 28 years, i.e. 2024 to 2052).

          - The last year's calculation would be dynamic once again as it will only be from January to April only (the 30th year i.e. 2053)

          I hope the above provides better clarification

  8. How to sum product wise 250+ sheets Day wise. Indirect Sumifs within a dynamic range based on today's date

  9. Indirect Sumifs within a dynamic range based on today's date

  10. Good afternoon!
    I'm having trouble with some pre-existing spreadsheets I have to work with. I copied over some dates from another spreadsheet that were in a different format (01-oct) to a sheet where they want it written like Sunday 01 October.
    I copied the data over in the original format and then formatted the whole column to be dddd dd mmmm to show it like above. However that has now thrown my formula out on the second page. I have page that is set to count figures for "October" but it doesn't see the ones I've reformatted now.

    Any help?!

    1. Hi! The date format cannot change the date value. Check what values you copied. Perhaps the second table had a different date format and when copying the date October 1 turned into January 10.

      1. The dates are being copied over correctly and when I format it's showing the date written out fully as intended - Wednesday 11 October but when you click in the formula bar it shows the date as 11/10/23. Due to this my other formulas won't count this box as it doesn't see it as showing "October".

  11. Hello, I'm having my laptop date as UK and my friend's laptop date is in USA. Anytime we exchange report. The whole formula get disjointed. Any help please

  12. Hi sir i need help how do i sum amount of sales based on specify date and account such as total of cash sales, debit card sales from 1/09/2023 to 6/09/2023.I have two different sheets for sales sheet and the summary sheet which i want to summarize based on date that i key in the sales sheet...would really appreciate any help from you sir.

  13. Thanks for this, it works well in the desktop version, but apparently not in the web version!

  14. Hi
    I'm facing an issue and would like to know your suggestions.
    So I have two sheets, one has names of accounts and their contract dates, the second sheet is a pivot table that has the names of the accounts (rows) and the month-year (columns) as well as their sales in 3 branches (columns).

    I want to get the sales sum for each branch starting from the contact date for all accounts in the first sheet, would it be possible?

    1. Hi! I can't offer you the formula because I don't have your data. To find the sum over multiple criteria, you can use the SUMIFS function and the guidelines in the article above. You can also use the SUMPRODUCT function and this guide: Excel SUMPRODUCT function with multiple criteria.
      I hope it’ll be helpful. If something is still unclear, please feel free to ask.

  15. Hi,
    I am trying to create a monthly calendar for equipment onsite, I have the list of equipment required, a date range, days onsite, quantity of each equipment required. I have tried sumif, sumifs, vlookup, xlookup. I want my sheet to revert back to the data table, then populate each cell with a count of the total amount of that equipment onsite for that month.

    On my monthly table of equipment in column A I have the list of equipment, then row 2 mm-yy for each column. On my data table I have a list of areas, then equipment list for each area, a mobilise and demobilise column for dates mm-yy format, days onsite column, qty of each piece of equipment in each area.

  16. hi, i am trying to add up the hours worked by a person. this is the formula i am using
    =SUMIFS('timesheets data dump'!H:H,user,review!K1,date,">="&review!M1,date,"<="&review!O1)
    user is named range with their clock in id
    date is a named range of the date of the clock in entry
    timesheets data dump'!H:H is number of hours that entry
    review!K1 is the from date
    review!O1 is the to date
    the number of hours is set as a number format
    all date cells are formatted as date in the same date format

    however if i put from:20/06/23 to:20/06/23 it calculates as 0 even though there is an entry for that day
    also if i put from:20/06/23 to:21/06/23 it only adds the hours for the 20/06/23 and does not include the 21st even though i have said less than or equal to.

    i would really appreciate if someone can see where i have gone wrong

    1. Hi! I've answered many times on the blog that a date without a time means 00:00:00. So 20/06/23 to: 21/06/23 means 20/06/23 00:00:00 to: 21/06/23 00:00:00. The date 21/06/23 is not in your date range.

      1. Thank you, adding +time(23,59,59) on the end date fixed it and it now works perfectly. i apologize that i didn't see your previous ones about the time default.

  17. Sorry if this is covered somewhere and I've just not seen it after crawling through comments on six articles.
    We are trying to generate a 'days in production' field using dates which are input into column A (start) and D (finish).
    We need this number to give us the number of days something has been in production while it's still being produced (so days up to today) for jobs that haven't got a finish date (so the cell is blank). We're not bothered about counting only workdays or anything fancy - just purely want to know how many days it's been since the job started, whether it's finished or not.
    Can this actually happen or do we need to be inputting today's date through the D column automatically (and constantly) until jobs are completed to get the number in question?
    Thanks for your help.

    1. Hi! If I understand your task correctly, try the following formula:

      =IF(ISBLANK(D1),TODAY()-A1,D1-A1)

      I hope I answered your question. If something is still unclear, please feel free to ask.

      1. Thank you SO MUCH.

  18. With the following formula, I use in a budget form to pull data from another sheet that is my check register. The formula works but for date on the transaction, I have to put 1/1/23 for every entry for January. How would I need to change the formula to include to find a transaction by date range?

    The ,$H$2 is where I would like to get the date range. The checking!$h$:$h$ is where sumifs criteria for the amount, checking!$C$C$ criteria for the date, and checking!$E$E$ is the criteria for the category. I would like to be able to enter a transaction in the check register for the month of January for the day of the transaction instead of just putting 1/1/23 for every transaction.

    =SUMIFS(Checking!$H:$H,Checking!$C:$C,$H$2,Checking!$E:$E,E23)

    1. Hi! If I understand your task correctly, pay attention to the following paragraph of the article above: Sum if between two dates and another criteria. It covers your case completely.

  19. Hi guys

    I have an issue that I can't seem to resolve regarding difference between dates:

    Works fine:
    =SUMIFS(NetValue, ProjectNo, "Proj101", DueDate, A1)
    =SUMIFS(NetValue, ProjectNo, "Proj101", DueDate, "="&A1)

    Does NOT work (returns 0):
    =SUMIFS(NetValue, ProjectNo, "Proj101", DueDate, ">="&A1)

    Seems like these is some sort of issues with the ">=" formatting in the above, so I'd really appreciate your assistance.

    Thanks

    1. Hi! I don't have your data, so I can't check this formula. But I don't see any errors in the formula. Check your data and cell A1.

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)