简体   繁体   中英

Excel Pivot Date Filter on Previous Business Day

I have scoured stackoverflow for an answer to this but this link is all I found.

I want to filter data in a pivot table in excel based on the previous business day. I know I need to modify the vba but am not sure how to write it.

Could anyone help a brother out?

You can probably add another column in your original data - which would have the previous business day. Then include this column in your pivot table. This is probably the easiest solution I can think of.

You can use the formula to get previous business day.

IF(WEEKDAY(A2)=1,A2-2,IF(WEEKDAY(A2)=2,A2-3,A2-1))

(assuming Cell A2 as your date)

This would give you Friday as previous business day for Saturday, Sunday and Monday. For the rest of the days - its just the previous day

Hope this helps. In case you don't want to use this approach, let me know, I can try to think of some other solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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