开发者

Excel: filtering a time series graph

I have data that looks like the following:

ID      | Location | Attendees | StartDate | EndDate
---------------------------------------------
Event1  | Bldg 1   | 10        | June 1    | June 5
Event2  | Bldg 2   | 15        | June 3    | June 6
Event3  | Bldg 1   | 5         | June 3    | June开发者_JAVA百科 10

I'd like to create a time series graph showing, for every given date, how many events were active on that date (i.e. started but haven't ended yet). For example, on June 1, there was 1 active event, and on June 4, there were 4 active events.

This should be simple enough to do by creating a new range where my first column consists of consecutive dates, and the second column consists of formulas like the following (I hardcoded June 8 in this example):

=COUNTIFS(Events[StartDate],"<=6/8/2009", Events[EndDate],">6/8/2009")

However, the challenge is that I'd like to be able to dynamically filter the time series graph based on various criteria. For example, I'd like to be able to quickly switch between seeing the above time series only for events in Bldg 1; or for Events with more than 10 attendees. I have at least 10 different criteria I'd like to be able to filter on.

What is the best way to do this? Does Excel have a built-in way to do this, or should I write the filtering code in VBA?


Apart from that my answer is not programming related: That's prime example for using a pivot table. Use this to show data consolidated for e.g. each day. Then you can play around with filtering as you like.

Your question is exactly what pivot tables are made for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜