简体   繁体   English

在Excel中按活动日期/活动日期过滤-VBA

[英]Filter by active/in-active dates in excel - VBA

I have Start and End date columns in my database. 我的数据库中有开始日期和结束日期列。

I want to filter by active and inactive. 我想按活动和不活动过滤。 Active dates would be true if Start date is less than today's date and if end date is more than today's date, which I was able to easily do with advanced filter and a macro. 如果“开始日期”小于今天的日期,并且“结束日期”大于今天的日期,那么有效日期将是正确的,而我可以使用高级过滤器和宏轻松地做到这一点。

For Inactive dates, Start date is more than today's date OR End date is less than today's date. 对于非活动日期,开始日期大于今天的日期,或者结束日期小于今天的日期。 Because of the OR condition, I couldn't achieve this using an advanced filter. 由于存在OR条件,因此无法使用高级过滤器来实现。 Please advise how I should approach this? 请告知我该如何处理?

Note that you should in fact be able to do this using the Advanced Filter...you just need to use a formula as the criteria. 请注意,实际上您应该可以使用“高级筛选器”来执行此操作……您只需要使用公式作为条件即可。 Google Advanced Filter Formula and you'll turn up lots of examples. Google高级过滤器公式,您将看到许多示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM