how to automatically apply filters within a date range

bigdan

Well-known Member
Joined
Oct 5, 2009
Messages
840
Office Version
  1. 2013
Platform
  1. Windows
I have to keep changing my filters with various date ranges and it's a real pain having to keep checking 20 boxes out of a thousand every time I want to change the range.

Is there a way I can specify the dates I want to filter in, say, A1 and A2 (start and end range) and I see the new filtered list?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Assuming your date is in column E, you could add a new column that says
Code:
=IF(AND(E4>=$A$1, E4<= $A$2),1,0)
then just reapply the filter on that new column if you change the dates?

ABCDEF
11/1/2019
21/31/2019
3Fliter CheckZ 2Z 3Z 4Z 5Z 6
41FF2FF1/11/2019FF
51D3321/30/2019D
60CC4422/2/2019D
71vv77331/15/201944
80CC4423/2/2019D

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
A4
=IF(AND(E4>=$A$1, E4<= $A$2),1,0)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
This idea is sooo awesome!!!! Thank you so much :) :)
 
Upvote 0
I wonder if I can use this method for my more complicated filters?

I used the if statement above for dates, and I then modified it for both Date and Status and Weight. So for example if I want to see the data between Feb 15 and Feb 25 with a status of Shipped and weight of Bulk then I input that into the first two rows, and I see all the relevant data displayed below. So far that works great.

I'd like to add another wrinkle please. If in C2 (where it currently says Shipped) I delete that figure, at the moment that would give me an error with the filter. Instead, I'd like it to then display all that statuses (but still meeting the other criteria of start and end dates and the weight).

Is that possible?





Start DateEnd DateStatusWeight
2/152/25ShippedBulk
DatesStatusWeight
1/01ShippedBulk
2/02CancelledParcel
3/31CompletedBulk
4/05ShippedParcel

<tbody>
</tbody>
 
Upvote 0
Hi bigdan,

Yes, we just need to say:
If the rowdate is greater than or equal to the Start Date
AND
the row date is less than or equal to the End Date
AND
the row Status is empty OR equal to Status check
AND
the row Weight is empty OR equal to Weight check
THEN filter = 1
ELSE filter = 0

Code:
=IF(AND(A4 >= $A$2,A4 <= $B$2,OR($C$2="",B4=$C$2),OR($D$2="",C4=$D$2)),1,0)

ABCD
1Start DateEnd DateStatusWeight
22/15/20192/25/2019Parcel
3DatesStatusWeightFliter Check
41-JanShippedBulk0
515-FebCancelledParcel1
625-FebCompletedBulk0
75-AprShippedParcel0

<tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
D4
to
D last data row
=IF(AND(A4>=$A$2,A4<=$B$2,OR($C$2="",B4=$C$2),OR($D$2="",C4=$D$2)),1,0)

<tbody>
</tbody>

<tbody>
</tbody>

I used LoVs for the Status and Weight check (to avoid typos) with:
C2 Data, Data Validation, List Source Shipped,Cancelled,Completed
D2 Data, Data Validation, List Source Bulk,Parcel

Of course you just use the Delete key to empty either or both
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,272
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top