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 help you and filter dates between two specific dates in Excel easily.

Filter dates between two specific dates with Filter command

Filter dates between two specific dates with VBA code

Filter dates between two specific dates with Kutools for Excel

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:

doc-filter-dates-1-2doc-filter-dates-2

Recommended Productivity Software

Office Tab: Use tabbed interface in Office as the use of web browser Chrome, Firefox and Internet Explorer.
Kutools for Excel: Adds 120 powerful new features to Excel. Increase your productivity in 5 minutes. Save two hours every day!
Classic Menu for Office: Brings back your familiar menus to Office 2007, 2010 and 2013 (includes Office 365).

arrow blue right bubble Filter dates between two specific dates with Filter command

Hint


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:

doc-filter-dates-3

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:

doc-filter-dates-4

Step 3: In the Popping up Custom AutoFilter dialog box, specify the two dates that you will filter by. See the following steps:

doc-filter-dates-5

Step 4: Click OK. Now it filters the Date column between the two specific dates, and hides other records as the following screenshot shows:

doc-filter-dates-6


arrow blue right bubble Filter dates between two specific dates with VBA code

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.

doc-filter-dates-7

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

Note:

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


arrow blue right bubble Filter dates between two specific dates with Kutools for Excel

If you installed Kutools for Excel, its Select Specific Cells tool can help you select the specific records between two dates first, and then you can copy and paste them into other range.

Kutools for Excel includes more than 120 handy Excel tools. Free to try with no limitation in 30 days. Get it Now.

Step 1: Select the range that you will filter by two dates.

Step 2: Click the Kutools > Select Tools > Select Specific Cells

doc-filter-dates-8

Step 3: In the Select Specific Cells dialog box, specify the settings as the following screenshot shows:

doc-filter-dates-9

Step 4: Click OK or Apply, the entire rows which match the criterion have been selected.

doc-filter-dates-10

And then you can copy and paste the selected rows in a blank range. Then all records with date between 9/1/2012 and 11/30/2012 are copied and pasted in a blank range.

Click to know more about this Select Specific Cells feature.


Related articles:


Is your problem solved?

Recommended Productivity Tools

The following tools will greatly save your time and effort, which one do you prefer?
Office Tab: Using handy tabs in your Office, as the way of Chrome, Firefox and New Internet Explorer.
Kutools for Excel: 120 powerful new functions for Excel, Increase your productivity in 5 minutes. Save two hours every day!
Classic Menu for Office: Bring back familiar menus to Office 2007, 2010, 2013 and 365, as if it were Office 2000 and 2003.

Kutools for Excel

gold star1 Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1 More than 120 powerful advanced functions which designed for Excel:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

btn read more     btn download     btn purchase