Excel AVERAGEIF Between Dates: Step-by-Step Guide
In this article
To average values that fall between two dates in Excel, use the AVERAGEIFS function with two date criteria — one for the start date and one for the end date. AVERAGEIFS is the right tool here because it accepts multiple criteria ranges, while the older AVERAGEIF only handles one condition. The formula pattern is =AVERAGEIFS(average_range, date_range, ">="&start_date, date_range, "<="&end_date). That single line returns the mean of every value whose date sits inside your window, and it updates automatically when your data changes.
What You'll Need
- Excel 2007 or later on Windows, or Excel for Mac 2011 or later — AVERAGEIFS is not available in older versions.
- A table with at least two columns: one holding real Excel dates and one holding the numbers you want to average.
- Two cells (or hard-coded dates) that define the start and end of your range.
- Dates that Excel actually recognises as dates, not text that merely looks like a date. This is the single most common reason the formula returns an error or a wrong result.
Step-by-Step
- Confirm your dates are real dates. Click a cell in your date column. If Excel treats it as a date, it will be right-aligned by default and the formula bar will show something like
1/15/2024or2024-01-15depending on your regional settings. If the value is left-aligned, it is probably text. Fix it by selecting the column, going to Data > Text to Columns, clicking Finish, and then formatting the column as a date with Ctrl+1 (Cmd+1 on Mac) > Date. - Set up your start and end dates in separate cells. Put the first day of the period in, say, F1 and the last day in F2. Using cells rather than typing dates into the formula makes it easy to change the window later. Format both as dates so you can see exactly what is being used.
- Click the cell where the average should appear and type
=AVERAGEIFS(. - Select the average range first. This is the column of numbers you want to average — for example
C2:C200. Drag over it or type the reference, then type a comma. - Select the criteria range. This is the date column, for example
A2:A200. It must be the same height as the average range, or Excel returns a #VALUE! error. Type a comma. - Enter the first criterion as a text string with an operator. Type
">="&F1. The quotation marks around the operator and the ampersand joining it to the cell reference are both required. This tells Excel "greater than or equal to the date in F1". Type a comma. - Repeat the criteria range —
A2:A200again — and a comma. - Enter the second criterion as
"<="&F2, then close the bracket. The finished formula looks like:=AVERAGEIFS(C2:C200,A2:A200,">="&F1,A2:A200,"<="&F2) - Press Enter and check the result. Sanity-check it by filtering the date column to the same window and reading the average from the status bar at the bottom of the screen. If the two numbers match, your formula is correct.
- Lock the ranges if you plan to copy the formula down. Convert the references to absolute form with F4 (Fn+F4 on many Macs) so they become
$C$2:$C$200and$A$2:$A$200, while leaving F1 and F2 relative or locked as needed.
Note that menu labels and date formats vary slightly by Excel version, operating system and regional settings. The function names and syntax, however, are identical across Windows, Mac and Excel for the web.
Common Mistakes
- Using AVERAGEIF instead of AVERAGEIFS. AVERAGEIF accepts only one criteria range, so it cannot test both a start and an end date. If you try, you will get either an error or an average that ignores one boundary.
- Leaving out the ampersand. Writing
">=F1"inside quotes makes Excel compare the dates to the literal text "F1", which matches nothing. The operator must be quoted and concatenated:">="&F1. - Mismatched range sizes. The average range and every criteria range must cover the same number of rows. A one-row difference produces #VALUE!.
- Text dates. If the date column contains text, comparisons behave alphabetically rather than chronologically, and the result is silently wrong rather than an obvious error.
- Time components. A date like 15 January 2024 14:30 is stored as a number slightly larger than 15 January 2024. If your end date is plain 15 January, records timestamped later that day are excluded. Use
"<"&(F2+1)to include the whole final day. - Blank cells in the average range. AVERAGEIFS ignores blanks and text in the average range, which is usually what you want, but it means the divisor is the count of matching numeric cells, not the count of matching rows.
Tips
- Use
TODAY()in place of a fixed end date to average a rolling window, for example the last 30 days:">="&(TODAY()-30). - Name your ranges (Formulas > Define Name) so the formula reads as
=AVERAGEIFS(Amount,OrderDate,">="&Start,OrderDate,"<="&End). It is far easier to audit later. - If you need the count as well as the average, pair the formula with COUNTIFS using the same criteria — useful for spotting an average based on only one or two records.
- Wrap the formula in IFERROR to show a friendly message when no dates match:
=IFERROR(AVERAGEIFS(...),"No data"). - For very large tables, or when you want the result to survive column insertions, convert the source data to an Excel Table (Ctrl+T) and reference the structured names instead of cell ranges.
Troubleshooting
The formula returns #DIV/0!. No rows matched both criteria, so there is nothing to average. Check that the start date is earlier than the end date, that the date column really holds dates, and that the criteria cells are not text. Temporarily widen the window to a decade to confirm the formula works at all.
The formula returns #VALUE!. Almost always a range-size mismatch or a malformed criterion string. Re-select each range and confirm they all start and end on the same rows.
The result looks too low or too high. Filter the date column manually to your window and compare counts. A mismatch usually means time stamps or text dates are being handled unexpectedly. Also check for hidden rows — AVERAGEIFS includes them, unlike SUBTOTAL.
Nothing happens when you press Enter. The cell may be formatted as Text. Change it to General or Number with Ctrl+1, then re-enter the formula.
If that did not work, rebuild the formula from scratch in a blank cell using hard-coded dates first, such as ">="&DATE(2024,1,1). If the hard-coded version works, the problem is in your criteria cells, not the function.
Frequently Asked Questions
Can I use AVERAGEIF with two dates?
No. AVERAGEIF supports a single criteria range and condition. Use AVERAGEIFS, which accepts pairs of criteria ranges and criteria and has no practical limit on how many you add.
Does AVERAGEIFS include the start and end dates?
It does if you use >= and <=. Switch to > and < if you want an exclusive window that skips the boundary days.
Why does my formula ignore records on the last day?
Those records almost certainly carry a time stamp. Use "<"&(end_date+1) so the whole final day is included.
Can the dates be in a different sheet or workbook?
Yes. Reference them with the sheet name, for example Settings!$F$1. Cross-workbook references work but are fragile if the other file is closed or moved, so keep the criteria in the same workbook where possible.
What happens to blank or text cells in the average range?
They are skipped entirely. Only numeric cells whose date matches the window contribute to the average, and the count used as the divisor reflects that.
Can I average between dates on Excel for the web or Mac?
Yes. AVERAGEIFS is supported in Excel for the web and in current Excel for Mac versions. Only very old releases lack it.