How do I filter Date that is before yesterday?

JohnnyPicnic

New Member
Joined
Feb 8, 2021
Messages
17
Office Version
  1. 2019
Platform
  1. Windows
I have a list of date/times and I want to filter/keep data that is before yesterday. In other words I don't want today or yesterday.
I found this Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1) but not sure how to use it in the query.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I always try to use the Ui to write the code, then edit it as needed. Manually add a filter upon the column in the UI, ie < anyDate. This will hard code a less than filter in the code. Replace the date with your code provided above. It should work.
 
Upvote 0
Solution
I always try to use the Ui to write the code, then edit it as needed. Manually add a filter upon the column in the UI, ie < anyDate. This will hard code a less than filter in the code. Replace the date with your code provided above. It should work.
Thank you! I was able to get it with
VBA Code:
= Table.SelectRows(#"Renamed Columns", each [Date modified] < Date.AddDays(DateTime.LocalNow(),-1))
 
Upvote 0

Forum statistics

Threads
1,225,399
Messages
6,184,749
Members
453,254
Latest member
topeb

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