Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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.

Filter dates between two specific dates with Filter command

Filter dates between two specific dates with VBA code

Filter all dates between two specific dates with Kutools for Excel


Combine multiple worksheets/workbooks into one worksheet / workbook:

Combine multiple worksheets or workbooks into one single worksheet or workbook may be a huge task in your daily work. But, if you have Kutools for Excel, its powerful utility – Combine can help you quickly combine multiple worksheets, workbooks into one worksheet or workbook.

Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 60 days. Read More      Download the free trial now


Filter dates between two specific dates with Filter command


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 -2 doc-filter-dates-2

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


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.


Filter all dates between two specific dates with Kutools for Excel

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.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.

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:

doc-filter-dates-9

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.

Tip.If you want to have a free trial of this utility, please go to download the software freely first, and then go to apply the operation according above steps.


Filter all dates between two specific dates with Kutools for Excel

Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 60 days. Download the free trial now!


Related articles:


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Bethany · 1 years ago
    Hello, Is it possible to get the results to filter to another tab in the worksheet?
  • To post as a guest, your comment is unpublished.
    domy · 2 years ago
    Hi 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.
    Thank you!
  • To post as a guest, your comment is unpublished.
    mahdi · 3 years ago
    excellent, thank you so much
  • To post as a guest, your comment is unpublished.
    Mc NWOGU · 3 years ago
    YOU SHOULD FIRST OF ALL CHANGE THE DATE COLUMN TO DATE DATATYPE.
  • To post as a guest, your comment is unpublished.
    karthi · 5 years ago
    thank you this comment is very useful :D