I have an Excel file with two worksheets (list of single dates of absence, and list of calendar weeks with start/end date of calendar week and availability status).
(date writing style: year-month-day)
worksheet list of single dates of absence (Absence
):
worksheet list of calendar weeks with start/end date of calendar week and availability status Availability
:
My goal is to have the Status
column in the Status
worksheet show the number of distinct days (0-7) within the inclusive date range (Monday
to Sunday
column).
For example, given a single calendar week:
- when there is no date from the
Absence
worksheet list that falls in between (inclusively) the current given calendar week, then theStatus
column should show0
, - when there is a single distinct date from the
Absence
worksheet list that falls in between (inclusively) the current given calendar week, then theStatus
column should show1
, - when there is a single distinct date, but the same date is listed twice, from the
Absence
worksheet list that falls in between (inclusively) the current given calendar week, then theStatus
column should show1
, - when there are two distinct dates from the
Absence
worksheet list that falls in between (inclusively) the current given calendar week, then theStatus
column should show2
, - when there are seven distinct dates (the whole week) from the
Absence
worksheet list that falls in between (inclusively) the current given calendar week, then theStatus
column should show7
.
Important: The upper bound (Sunday
) may be changed to Friday, so a function which is dynamic instead of six times adding one day and checking again would be favorized.
Distinctness: The user may enter the same date multiple times due to user error. The formular shall take measures that two or three times the mention of 2025-12-31 shall not be counted as 2 but as 1 instead.
In the given example, CW1 would show Status
"1" (one single distinct date within the CW), and all the others would show "0" (in the example, there is no CW for February/March/April) shown.
Later on, the numbers from 0-7 shall be an indicator for highlighting the entire calendar week row, but this is not the topic of this question.
I know the LOOKUP
/VLOOKUP
function, but my case is the "reverse LOOKUP logic" and I don't even know how to start writing the formular/function to have my problem solved. Maybe I'm overthinking it and there is an easy solution but I don't see it right now.