To find if a date falls between two other dates in Excel, the most efficient method is using the AND function within an IF statement or using the COUNTIFS function. For example, if your date is in cell A2, your start date is in B2, and your end date is in C2, the formula =AND(A2>=B2, A2<=C2) will return TRUE if the date is within the range and FALSE if it is not. This logic allows you to filter, sum, or highlight data based on specific timeframes, which is essential for financial reporting, project tracking, and attendance logs.
What You'll Need
- A version of Microsoft Excel (Excel 365, 2021, 2019, or earlier).
- A dataset containing dates formatted as "Date" cells rather than "Text".
- Two defined boundary dates (a start date and an end date).
- Basic familiarity with cell referencing (e.g., knowing that A2 refers to column A, row 2).
Step-by-Step
Depending on your goal—whether you want to label a row, count occurrences, or highlight cells—you will use a different approach. Below are the three most common methods.
Method 1: Labeling Dates Using the IF and AND Functions
Use this method when you want a new column to tell you "Yes" or "No" if a date falls within your range.
- Enter your start date in one cell (e.g., E1) and your end date in another (e.g., E2). This makes it easier to change the range later without editing every formula.
- Click on the cell where you want the result to appear (e.g., B2, next to your first date in A2).
- Type the following formula:
=IF(AND(A2>=$E$1, A2<=$E$2), "Yes", "No"). - Breakdown of this formula: The
ANDfunction checks two conditions. First, is A2 greater than or equal to the start date? Second, is A2 less than or equal to the end date? If both are true, theIFfunction returns "Yes". - The dollar signs (
$E$1) are absolute references. They ensure that when you drag the formula down, Excel always looks at the start and end date cells instead of shifting the reference downward. - Press Enter and click-and-drag the fill handle (the small square at the bottom-right of the cell) down to apply the formula to the rest of your list.
Method 2: Counting Dates Between Two Dates Using COUNTIFS
Use this method when you don't need to label individual rows but simply want to know how many events happened between two dates.
- Identify the range containing your dates (e.g., A2:A100).
- Select an empty cell for your total count.
- Type the formula:
=COUNTIFS(A2:A100, ">="&E1, A2:A100, "<="&E2). - In this formula,
A2:A100is the criteria range. The">="&E1part tells Excel to look for dates greater than or equal to the value in cell E1. - The second part of the formula
A2:A100, "<="&E2tells Excel to further filter that list for dates less than or equal to the value in E2. - Press Enter. Excel will return a single number representing the total count of dates that fit both criteria.
Method 3: Highlighting Dates Using Conditional Formatting
Use this method to visually flag dates that fall within a specific window without adding new columns.
- Select the range of cells containing your dates (e.g., A2:A100).
- Go to the Home tab on the ribbon.
- Click on Conditional Formatting > New Rule.
- Select Use a formula to determine which cells to format.
- In the formula box, enter:
=AND(A2>=$E$1, A2<=$E$2). Note: Use the cell reference of the first cell in your selected range (A2). - Click the Format button.
- Go to the Fill tab and choose a highlight color (e.g., yellow or light green), then click OK.
- Click OK again to apply the rule. Now, any date that falls between the values in E1 and E2 will automatically change color.
Common Mistakes
- Incorrect Date Formatting: The most frequent error is having dates stored as text. If a date is left-aligned in a cell by default, Excel may see it as text, and the
>=or<=operators will not work. To fix this, select the column and change the format to "Short Date" in the Home tab. - Forgetting Absolute References: When using a formula like
=IF(AND(A2>>=E1, A2<=E2), "Yes", "No")and dragging it down, Excel changes E1 to E2, E3, and so on. This causes the formula to fail. Always use$E$1and$E$2to lock those cells. - Wrong Operator Order: Users sometimes accidentally use
<(less than) where they mean>(greater than). Remember: Start Date is the smaller number, so your target date must be greater than the start date. - Hard-coding Dates into Formulas: Typing
"1/1/2023"directly into a formula can lead to errors depending on the regional date settings of the computer (MM/DD vs DD/MM). It is always safer to put the date in a cell and reference that cell.
Tips
- Using TODAY(): If you want to find dates between a fixed start date and today's date, replace the end date reference with the
TODAY()function. For example:=AND(A2>=$E$1, A2<=TODAY()). This makes your spreadsheet dynamic. - SUMIFS for Totals: If you have a column of values (like sales amounts) and want to sum them for a specific date range, use
=SUMIFS(Sum_Range, Date_Range, ">="&Start_Date, Date_Range, "<="&End_Date). - Data Validation: To prevent users from entering dates outside of your allowed range, use Data > Data Validation and set the criteria to "Date" with a "between" restriction.
- Keyboard Shortcut: To quickly enter today's date into your start or end date cells, press
Ctrl + ;(semicolon).
Troubleshooting
If your formula returns an error or an unexpected result, follow these steps in order:
- Check for Text-Dates: Select your date column and look at the bottom right of the Excel window. If you select multiple dates and Excel only shows a "Count" but not an "Average" or "Sum", your dates are stored as text. Use the Text to Columns tool (Data tab > Text to Columns > Finish) to force Excel to re-evaluate the data as dates.
- Verify the Logic: Ensure your start date is actually earlier than your end date. If the start date is 12/31/2023 and the end date is 01/01/2023, no date can ever be both greater than the start and less than the end.
- Inspect Absolute References: Click on one of the cells where you dragged the formula down. Check the formula bar to see if the start/end date references shifted. If they did, add the
$symbols. - Check for Hidden Time Stamps: Some dates in Excel actually contain time data (e.g., 01/01/2023 14:30). If your end date is 01/01/2023, a cell with a time stamp might be considered "greater than" the end date. To fix this, use the
INT()function to strip the time:=AND(INT(A2)>=$E$1, INT(A2)<=$E$2).
Frequently Asked Questions
How do I find dates between two dates without using a helper column?
The best way to do this is through Conditional Formatting or by using a Filter. You can go to the Data tab, click Filter, click the dropdown on your date column, and select Date Filters > Between.... This allows you to enter the two dates manually in a pop-up box.
Does the order of dates in the AND function matter?
The order within the AND function doesn't change the result, but the logic must be correct. You must check that the date is greater than or equal to the start and less than or equal to the end. If you flip these operators, the formula will always return FALSE.
Can I use this to find dates in a specific month?
Yes. You can set your start date to the first of the month (e.g., 01/01/2023) and your end date to the last day of the month (e.g., 01/31/2023). Alternatively, you can use the MONTH() function, but the AND method is more flexible for ranges that span across multiple months or years.
Why is my COUNTIFS formula returning 0 when I know there are dates in that range?
This usually happens because of a mismatch in date formats or hidden time stamps. Ensure your criteria cells (E1 and E2) are formatted as dates and not text. Also, check if your data contains time values; if it does, the date might be slightly beyond the end date boundary.
Can I use a date range to sum values in another column?
Yes, use the SUMIFS function. The syntax is =SUMIFS(sum_range, date_range, ">="&start_date, date_range, "<="&end_date). This will add up all numbers in the sum_range where the corresponding date falls between your two boundaries.