I have sheet with calendar, where row (B5-H5) is day of the month and column (A6-A11) is room number. I want to see names of People that has reservation that day and for that room number in each cell. Reservation details are in Reservation table on another sheet.
This formula returns #N/A even though there should be row that matches:
=INDEX(Reservation[NAME AND SURNAME]; MATCH(1; (Reservation[ROOM]=A6)*(Reservation[DATE ARRIVAL]<=DATE(MoYear;MoMonthNum;B5))*(Reservation[DATE DEPARTURE]>=DATE(MoYear;MoMonthNum;B5)); 0))
DATE(MoYear;MoMonthNum;B5)
is a date from calendar in format DD.MM.YYYY
Reservation[DATE *]
is a date in format DD.MM.YYYY
Cell A6 is a room number in format 'ROOM n.1'
Can anyone please tell me, where could be the problem with my formula?
Reservation table:
NAME AND SURNAME | DATE ARRIVAL | DATE DEPARTURE | ROOM |
---|---|---|---|
Petr Vashek | 1.1.2024 | 2.1.2024 | Room n.1 |
Calendar (Peter Vashek should be in the cells, but its #N/A instead):
1.1.2024 | 2.1.2024 | 3.1.2024 | |
---|---|---|---|
Room n.1 | Petr Vashek | Petr Vashek | |
Room n.2 |
I tried this following formula to get number of Reservation for each day and it works as it should:
=COUNTIFS(Reservation[DATE ARRIVAL]; "<="&DATE(MoYear;MoMonthNum;B5); Reservation[DATE DEPARTURE]; ">="&DATE(MoYear;MoMonthNum;B5))
Your formula works with this mod.
=INDEX(Reservation[NAME AND SURNAME]; MATCH(1; (Reservation[ROOM]=$A6)*(Reservation[DATE ARRIVAL]<=B$5)*(Reservation[DATE DEPARTURE]>=B$5); 0))
The cell B5 contains already a complete date.
One more restraint that the Reservation table must contains at least two lines to generate an array for the function MATCH.
Result