Create a Calendar from Timeframes / Conditional Formatting if an Object is inside a certain timeframe

此生再无相见时 提交于 2019-12-11 15:39:00

问题


I have a Sheet (Sheet1) with objects and times when they are active.

Objects    Begin       End    
Object 1   1/1 2AM     1/2 6AM
Object 1   1/2 12AM    1/2 6PM 
Object 1   ..          ..
Object 2   ..          ..
Object 2   ..          ..
..
..
..

In another Worksheet (Sheet 2) I want a list of all my objects and an array of time blocks, where there is a 1 (or TRUE, ..) each time the time block is one, where the object was active.

The table should look like this

Time       1/1 12 AM      1/1 1 AM     1/1 2 AM    [..]    1/2 12 AM    [..]
Object 1       0             0             1       [..]        1
Object 2      ...
Object 3      ...
....

I don't known how to handle multiple rows for object 1, while there is only one row for object 1 in Sheet 2. If there was only one I guess something like

IF(AND(A2=Sheet2!A2, AND(Sheet2!B2>=A2, Sheet2!C2<A2)) 

Would do the trick?

Happy for any help.


回答1:


The easiest way is to use a Countifs:

=countifs(Sheet1!$A:$A,$A2,Sheet1!$B:$B,"<="&B$1,Sheet1!$B:$B,">="&B$1)



来源:https://stackoverflow.com/questions/54218389/create-a-calendar-from-timeframes-conditional-formatting-if-an-object-is-insid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!