How to Use Custom Date Filter in Excel (5 Easy Ways)

We will use a dataset that contains information about the Sales Amount on different dates for some salesmen. We will use the custom date filter in the dataset and show the sales amount for specific dates. The same dataset will be used throughout the whole article.


Method 1 – Use the Filter Command to Apply a Custom Date Filter in Excel

STEPS:

  • Select a cell in your dataset.
  • Go to the Data tab and select Filter.

Use Filter Command to Apply Custom Date Filter in Excel

  • A drop-down arrow will appear in the headers of the dataset.

Use Filter Command to Apply Custom Date Filter in Excel

  • Click on the drop-down arrow to open the Context Menu.
  • From the Context Menu, select Date Filters and then select Custom Filter.

Use Filter Command to Apply Custom Date Filter in Excel

  • The Custom AutoFilter window will appear.
  • Select ‘is after’ and type ‘1/1/2021’ in the first field.
  • In the second field, select ‘is before’ and type ‘12/31/2021’.

Use Filter Command to Apply Custom Date Filter in Excel

We want to filter the sales amount from 1/1/2021 to 12/31/2021. You can change this section according to your needs.

  • Click OK to see results like the picture below.

Use Filter Command to Apply Custom Date Filter in Excel

  • If you want to filter the sales amount after 1/1/2021, you can select ‘is after’ and type ‘1/1/2021’ in the first field only.
  • Click OK to proceed.

Use Filter Command to Apply Custom Date Filter in Excel

  • You will see this result.

Use Filter Command to Apply Custom Date Filter in Excel


Method 2 – Apply a Custom Date Filter Using Excel Conditional Formatting

STEPS:

  • Type the Starting Date and Ending Date outside of the main dataset. We want to filter the values from 1/1/2021 to 12/31/2021. We put 1/1/2021 and 12/31/2021 in cells C14 and D14, respectively.

Apply Custom Date Filter Using Excel Conditional Formatting

  • Select Cell F5 and insert this formula:
=AND(C5>=$C$14,C5<=$D$14)
  • Hit Enter to see the result.

Apply Custom Date Filter Using Excel Conditional Formatting

We have used the AND function. This formula checks if the value of Cell C5 is between 1/1/2021 and 12/31/2021. If it is between 1/1/2021 and 12/31/2021, then, it will show TRUE. Otherwise, it will display FALSE.

  • Drag the Fill Handle down.

Apply Custom Date Filter Using Excel Conditional Formatting

  • You can see the results in the picture below.

Apply Custom Date Filter Using Excel Conditional Formatting

  • Select Cell C4 and press Ctrl + Shift + L to apply a Filter in the dataset. You can also do this from the Data tab like Method 1.

Apply Custom Date Filter Using Excel Conditional Formatting

  • Select Column C.

Apply Custom Date Filter Using Excel Conditional Formatting

  • Go to the Home tab and select Conditional Formatting.
  • Select New Rule to open the New Formatting Rule window.

Apply Custom Date Filter Using Excel Conditional Formatting

  • Select ‘Use a formula to determine which cells to format’.
  • Insert the formula:
=AND(C5>=$C$14,C5<=$D$14)
  • Select Format.

Apply Custom Date Filter Using Excel Conditional Formatting

  • Change the Font Color to Red and click OK to proceed.

Apply Custom Date Filter Using Excel Conditional Formatting

  • Click on the drop-down arrow in the Date column.
  • Select Filter by Color and then select the Red color.

Apply Custom Date Filter Using Excel Conditional Formatting

  • You will see results like the picture below.

Apply Custom Date Filter Using Excel Conditional Formatting


Method 3 – Use a Custom Date Filter with a Pivot Table

STEPS:

  • Select a cell in the dataset.
  • Navigate to the Insert tab and select the PivotTable icon.

Use Custom Date Filter with Excel Pivot Table

  • A message will pop up.
  • Click OK to proceed.

Use Custom Date Filter with Excel Pivot Table

  • A new sheet will open with the PivotTable Fields on the right panel.

Use Custom Date Filter with Excel Pivot Table

  • Drag Salesmen, Date, and Sales Amount in the respective PivotTable Fields section.

Use Custom Date Filter with Excel Pivot Table

  • Click on the drop-down arrow of the Column Labels column.

Use Custom Date Filter with Excel Pivot Table

  • From the drop-down menu, select Date Filters and then select Custom Filter. It will open the Date Filter (Date) window.

Use Custom Date Filter with Excel Pivot Table

  • Select ‘is after’ and type 01/01/2021. It denotes that the pivot table will contain values from the date 01/01/2021.

Use Custom Date Filter with Excel Pivot Table

  • You will see the filtered results like the picture below.

Use Custom Date Filter with Excel Pivot Table


Method 4 – Insert a Formula to Use a Custom Date Filter in Excel

We will use a formula to filter the Sales Amount for August. The formula will look for the sales for August irrespective of the year. We have added a section for the Month and the Sales amount.

Insert Formula to Use Custom Date Filter in Excel

STEPS:

  • Select Cell D14.
  • Insert the formula below:
=FILTER(D5:D11,MONTH(C5:C11)=8,"Empty")
  • Press Enter to see the results.

  • The first argument (D5:D11) is the array where it looks for the Sales Amount.
  • The second argument MONTH(C5:C11)=8 denotes that the month is August.
  • If it finds no value of August, then it prints Empty.

Method 5 – Use Excel Macro Record to Apply a Custom Date Filter

STEPS:

  • Select a cell in the dataset and press Ctrl + Shift + L to apply a Filter.

  • Go to the Developer tab and select Record Macro. It will open the Record Macro window.

  • In the Record Macro window, type a name for the macro and click OK to proceed. We have named it CustomDateFilter.

  • Click on the drop-down arrow in the Date column.
  • Select Date Filters and then select Custom Filter. It will open the Custom AutoFilter window.

  • In the Custom AutoFilter window, select ‘is after’ and type ‘1/1/2021’ in the first field.
  • In the second field, select ‘is before’ and type ‘12/31/2021’.

  • Click OK to proceed.

  • Navigate to the Developer tab and select Stop Recording.

  • Open a similar sheet where you have the same dataset.
  • Go to the Developer tab and select Macros from there.

  • Click on Run in the Macro window.

  • You will get the results like the picture below.


Download the Practice Book


<< Go Back to Date Filter | Filter in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mursalin Ibne Salehin
Mursalin Ibne Salehin

Mursalin Ibne Salehin holds a BSc in Electrical and Electronics Engineering from Bangladesh University of Engineering and Technology. Over the past 2 years, he has actively contributed to the ExcelDemy project, where he authored over 150 articles. He has also led a team with content development works. Currently, he is working as a Reviewer in the ExcelDemy Project. He likes using and learning about Microsoft Office, especially Excel. He is interested in data analysis with Excel, machine learning,... Read Full Bio

2 Comments
  1. Hi! can you filter dates older than a set number of days from today? I tried the is before Today-35 bit that didn’t work

    • Hi SEM,
      Thanks for your comment. I am replying to you on behalf of ExcelDemy. If you want to filter dates older than a number of days from today, you can follow the steps from Method-2. But, instead of the formula used here, write the following formula.
      =C5<(TODAY()-30)

      Here, I wrote the formula for dates older than 30 days from today. You can change the formula according to your preference.
      I hope this will help you to solve your problem. Please let me know if you have other queries.
      Regards
      Mashhura
      ExcelDemy

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo