How to filter dates between two specific dates in Excel?
Sometime you may only want to filter data or records between two specific dates in Excel. For example, you want to show the sales records between 9/1/2012 and 11/30/2012 together in Excel with hiding other records. This article focuses on ways to filter dates between two specific dates in Excel easily.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
Supposing you have following report, and now you want to filter the items between 9/1/2012 and 11/30/2012 so that you can quickly summarize some information. See screenshots:
Microsoft Excel's Filter command supports to filter all dates between two dates with following steps:
Step 1: Select the date column, Column C in the case. And click Data > Filter, see screenshot:
Step 2: Click the arrow button besides the title of Column C. And move mouse over the Date Filters, and select the Between item in the right list, see the following screenshot:
Step 3: In the Popping up Custom AutoFilter dialog box, specify the two dates that you will filter by. See the following steps:
Step 4: Click OK. Now it filters the Date column between the two specific dates, and hides other records as the following screenshot shows:
The following short VBA code also can help you to filter the dates between two specific dates, please do as this:
Step 1: Input the two specific dates in the blank cells. In this case, I enter start date 9/1/2012 in cell E1, and enter end date 11/30/2012 in cell E2.
Step 2: Then hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.
Step 3: Click Insert > Module, and paste the following code in the Module Window.
Public Sub MyFilter() Dim lngStart As Long, lngEnd As Long lngStart = Range("E1").Value 'assume this is the start date lngEnd = Range("E2").Value 'assume this is the end date Range("C1:C13").AutoFilter field:=1, _ Criteria1:=">=" & lngStart, _ Operator:=xlAnd, _ Criteria2:="<=" & lngEnd End Sub
- In the above code, lngStart = Range("E1"), E1 is the start date in your worksheet, and lngEnd = Range("E2"), E2 is the end date that you have specified.
- Range("C1:C13"), the range C1:C13 is the date column that you want to filter.
- All above codes are variables, you can change them as your need.
Step 4: Then press F5 key to run this code, and the records between 9/1/2012 and 11/30/2012 have been filtered.
In this section, we recommend you the Select Specific Cells utility of Kutools for Excel. With this utility, you can easily select all rows between two specific dates in a certain range, and then move or copy these rows to another place in your workbook.
1: Select the range that you will filter by two dates, and then click Kutools > Select > Select Specific Cells…
2: In the Select Specific Cells dialog box, specify the settings as below
1). Select Entire row option in the Selection type section.
2). In the Specific type section, please successively select Greater than or equal to and Less than or equal to in the two drop-down lists. Then enter the start date and end date into the following textboxes.
3). Click the OK button. See screenshot:
Now all rows which match the criterion have been selected. And then you can copy and paste the selected rows to a needed range as you need.
Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 60 days. Download the free trial now!
- Select cells based on certain criteria
- Select cells with specific text
- Remove rows based on cell value
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.· 2 years agoHello, Is it possible to get the results to filter to another tab in the worksheet?
To post as a guest, your comment is unpublished.· 3 years agoHi guys,
is it possible to creat a loop for the sample "Filter dates between two specific dates with VBA code"? Because i have a lot of dates and not just one as shown here.
To post as a guest, your comment is unpublished.· 3 years agoexcellent, thank you so much
To post as a guest, your comment is unpublished.· 4 years agoYOU SHOULD FIRST OF ALL CHANGE THE DATE COLUMN TO DATE DATATYPE.
To post as a guest, your comment is unpublished.· 5 years agothank you this comment is very useful :D
To post as a guest, your comment is unpublished.· 5 years agoHi
For Step 2 Instead of the "Date Filter" I see "Text Filter"
All of the cells in the column are dates and they are formatted as MM/DD/YYYY
I am not sure how to format the Text Filter to be a Date Filter
To post as a guest, your comment is unpublished.