0
我有一個Excel工作簿,看起來像這樣如何計算兩個日期截止之間的天數在Excel
Year Date Was the office open?
2016-01-01 Y
2016-01-02 Y
2016-01-03 N
2016-01-04 N
2016-01-05 N
2016-01-06 Y
2016-01-07 Y
2016-01-08 Y
2016-01-09 Y
2016-01-10 Y
2016-01-11 N
2016-01-12 Y
2016-01-13 Y
2016-01-14 Y
2016-01-15 Y
2016-01-16 N
2016-01-17 Y
2016-01-18 Y
2016-01-19 Y
2016-01-20 Y
2016-01-21 Y
2016-01-22 Y
2016-01-23 Y
2016-01-24 Y
2016-01-25 Y
2016-01-26 Y
2016-01-27 N
2016-01-28 Y
2016-01-29 Y
2016-01-30 Y
2016-01-31 Y
2016-02-01 Y
2016-02-02 Y
我有看起來像這樣的
Period Cutoff Dates
2016-01-01
2016-01-06
2016-01-12
2016-01-16
2016-01-27
2016-02-02
工作簿中的第二個電子表格我希望是一種基於Y/N的虛擬查詢和計數,它根據日期(或第一次日期)和前一日期的差異告訴我該期間辦公室開放的天數。我想看到這
Year Date Was the office open? Days office was open in the period
2016-01-01 Y
2016-01-02 Y
2016-01-03 N
2016-01-04 N
2016-01-05 N Count the number of 'Y' between 2016-01-01 and 2016-01-06 less 1 day, show 2 in the 3rd column
2016-01-06 Y
2016-01-07 Y
2016-01-08 Y
2016-01-09 Y
2016-01-10 Y
2016-01-11 N Count the number of 'Y' between 2016-01-06 and 2016-01-12 less 1 day, show 5 in the 3rd column
2016-01-12 Y
2016-01-13 Y
2016-01-14 Y
2016-01-15 Y Count the number of 'Y' between 2016-01-12 and 2016-01-16 less 1 day, show 4 in the 3rd column
2016-01-16 N
2016-01-17 Y
2016-01-18 Y
2016-01-19 Y
2016-01-20 Y
2016-01-21 Y
2016-01-22 Y
2016-01-23 Y
2016-01-24 Y
2016-01-25 Y
2016-01-26 Y Count the number of 'Y' between 2016-01-16 and 2016-01-27 less 1 day, show 10 in the 3rd column
2016-01-27 N
2016-01-28 Y
2016-01-29 Y
2016-01-30 Y
2016-01-31 Y
2016-02-01 Y
2016-02-02 Y Count the number of 'Y' between 2016-01-27 and 2016-02-02, show 6 in the 3rd column
這應該很容易。我無法到達那裏。任何幫助,將不勝感激。
謝謝 JM
通過你的歷史剛走到,如果答案幫助和做了什麼,有人問,你應該標記它由答案擊中綠色對勾是正確的。我會回顧你的歷史,並標記正確的答案,這將鼓勵其他人在未來提供幫助。 –
感謝您的解決方案 - 現貨。 –
感謝您對將問題標記爲答案的評論。老實說,我不明白,如果我點擊箭頭,它被標記爲答案。現在有道理。我也將答案標記爲答案。非常感激 !! –