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)

70 comments

  1. 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)

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

  3. 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".

  4. 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.

  5. Very helpful. Just one question. I am working with a data set comprised of void transactions over a year. Each row is a specific void transaction, with columns for date, employee, reason for void, amount, etc. Every time I try to do the 'sumifs' for a date range I get 0. The big difference I noticed between the data in your examples and mine is that in yours every row (representing a transaction) is a different date. I have a lot of transactions on the same day. Just to see what would happen, I changed all the dates in my set to be different from one another. Then the formula works. I'm sure there has to be a work around or something. Thank you

  6. Sir,,

    Please help in suming up sales, within specific time in a day. Eg
    10 Jan 23
    Like
    10:00 AM 10 pieces
    10:50AM 50 pieces
    11: 45AM 20 pieces

    I need to count same way sum of sales between 10 AM to 11AM which should come 60 automatically

  7. Column A Buy Date | Column B Sell Date | Column C Profit
    31/3/2022 | 31/3/2022 | $100
    31/5/2022 | 31/5/2022 | $50
    31/3/2022 | 10/4/2022 | $20
    31/8/2022 | 31/8/2022 | $10
    11/4/2022 | 30/4/2022 | $100

    Any formula that can do a sum if of profit if Days held is
    0 ($160 in this case: row 1, 2, 5)
    0-7 days ($0 in this case)
    8-14 days ($20 in this case: row 3)

    Trying to do this without adding an extra column in that does Col B - Col A
    15-22 days ($100 in this case: row 5)

  8. duty shift& time name revenue
    Morning 08-02 A 200
    Morning 09-03 b
    Morning 10-04 A 152
    evening 08-02 b
    evening 09-03 A 100
    evening 10-04 b 3

    count formula to get no of staff worked day and night separately (blank cells not worked)

  9. Prev Year: SUMIFS(16:16,15:15,">="&"01/01/"&C7-1,15:15,"<="&"12/31/"&C7-1)

    1. Current Year: SUMIFS(16:16,15:15,">="&"01/01/"&C7,15:15,"<="&"12/31/"&C7)

      1. Next Year: SUMIFS(16:16,15:15,">="&"01/01/"&C7+1,15:15,"<="&"12/31/"&C7+1)

  10. I am trying to have my salary auto update on the last working day of every month any help would be appreciated

  11. I am trying to figure out a formula to count time in hours but the date and time are in the same category which makes it hard to
    do the calculation. I need this calculation to determine how long we have had trucks on our yard. Below is an example

    Arrived_in_Yard Hit_the_Dock
    9/5/2022 16:27 9/8/2022 8:50

    How could I calculate this time in hours?

  12. Hello!
    Use the MATCH function to find the position of the cell with the current date. Use the OFFSET function to create links to 2 cells. Use these cells to create a condition in the SUMPRODUCT formula.

    =SUMPRODUCT(A2:Z2,(A1:Z1=OFFSET($A$1,0,MATCH(TODAY(),$A$1:$Z$1,0)-2))+ (A1:Z1=OFFSET($A$1,0,MATCH(TODAY(),$A$1:$Z$1,0)-1)))

    Hope this is what you need.

    1. Thanks for your support. That helps. However we have another case, let says there are few items in the table are duplicated, e.g 2 item A, 4 item B, 5 item C, each of them in a row. So which function need to use to sum up quantity of those items which have been produced yesterday and today?

      1. Hi!
        Add a row to your spreadsheet that will calculate the sum for each column. Use the formula I gave you with this total row.

  13. Hi guys,

    I am trying to do a =SUMIFS with a DATE RANGE and a wild card (notsure if thats the correct term)

    This is the formula that I am working with but it is either going "error" or just "zero".

    The date format from the data sheet is "10/16/2021 15:56:34"

    =SUMIFS('TDJ Sales Data'!$G$3:$G,'TDJ Sales Data'!$F$3:$F,">="&C1,'TDJ Sales Data'!$F$3:$F,"<="&C2"),'TDJ Sales Data'!$A$3:$A,"Armstrong"")

    1. Hi!
      I can't check the formula that contains unique references to your workbook worksheets.
      I didn't find a situation where A3:A works (in Excel functions).
      If you want to refer to a range starting from A3 to the max row you can use this formula

      OFFSET(A3, 0, 0, ROWS(A:A)-2)

      Read more here: OFFSET formula to define an Excel dynamic named range.

      For example,

      =SUMIFS(OFFSET(A3, 0, 0, ROWS(A:A)-2),OFFSET(A3, 0, 0, ROWS(A:A)-2)," > "&C1)

  14. I have a spreadsheet for payroll where I have people who worked multiple shifts and I would like a column with a total for both shifts if there are 2. This is my lay out:

    Employee name (which would have to match), Date worked(this will have to match as well), hours for that shift (this is what I want to combine if possible)

  15. Hi,

    I'm using this for a personal month budget and I noticed that when I put in a month's date range, and then enter the next month's entries, it adds it to the previous month.

    For instance, let's say I have $1000 of income from 6/1 to 6/30 but when I put in income for July, it adds it to June's total AND July. Is there a way to have it only calculate for the dates in the formula and in between? Here is what I'm using:

    =SUMIFS(Input!B:B,Input!A:A,">=6/1/2022",Input!B:B,"<=6/30/2022")

      1. That was it! Thank you so much for your response.

  16. I have a sheet with a big bill. Payments are being remitted weekly. My sheet has a date column for the payment date. Payment amount. Remaining balance as of that day.

    I'm trying to get a updated balance for this sheet in another sheet.

    How can I have the balance update only weekly in another sheet?

    1. Hello!
      You can use XLOOKUP function to find the last match for a given date. See an example here: XLOOKUP last match.
      I hope I answered your question. If something is still unclear, please feel free to ask.

  17. I am needing assistance on how to sum two dates to a count.
    For example in cell M16, I have a start date of 6/11/2021 and in cell N16, I have the end date of 6/30/2021 and now I need to count the amount of days from start to end in cell O16. Can someone assist with me the formula to be able to do that?

  18. Hi, I'm using a sumifs function for each month's totals with the year referenced in a separate sheet. It works great for every month except Feb/March. I used the range "="&DATE(DASHBOARD!$C$2,2,1),$B:$B,"<="&DATE(DASHBOARD!$C$2,2,29))

    1. Not sure why half my message is cut off. For Feb Entries I allowed "<=" 2-29 to allow for leap years but now entries for Mar 1 show up in BOTH Feb. and Mar. totals. How do I include all dates between the beginning and end of each month allowing for leap year without problems? Thanks.

      1. Hello!
        To determine the end date of the month, use the function EOMONTH :

        =EOMONTH(DATE(DASHBOARD!$C$2,2,1),0)

        Read more here.

  19. I have a cash flow on one sheet of an excel spreadsheet with a balance for each month of the year. each month aligns to UK tax year so April runs from the 6th of April to the 5th of May and so on. Using The TODAY() function I am trying to the show the current monthly balance from the cashflow on another sheet.

    Can you assist?

    1. Hello!
      If I understand your task correctly, the following formula should work for you:

      =SUMPRODUCT(D1:D15,--(C1:C15>=EOMONTH(TODAY(),-1)+6),--(C1:C15<=EOMONTH(TODAY(),0)+5))

      You can learn more about EOMONTH function in Excel in this article on our blog.

  20. Hi , I am getting wrong result in Sumif. Below is the data set

    B1:x1=Week 49 Week 50 Week 51 Week 52 Week 53 Week 1 Week 2 Week 3 Week 4 Week 5 Week 6 Week 7 Week 8 Week 9 Week 10 Week 11 Week 12

    Weekly jobs done B2:X2 =0 0 0 0 1 0 1 0 2 1 0 1 1 1 0 2 1

    Criteria= Week 4
    Formula used =SUM(B2:F2)+SUMIF(I1:X1,"<="&A3,I2:X2)
    Jobs done till Week 4= 7 result by formula
    result should be 4
    Thanks in advance
    priyank

    1. Hello!
      You can use this formula:

      =SUM(B2:F2)+SUMIF(G1:X1,"<="&A3,G2:X2)

      This formula gives the result 4

Post a comment



Thanks for your comment! Please note that all comments are pre-moderated, and off-topic ones may be deleted.
For faster help, please keep your question clear and concise. While we can't guarantee a reply to every question, we'll do our best to respond :)