Hello, I've been using this formula to INDEX the Correct rate based on the Date Range the date falls.
=INDEX($B$7:$B$11,MIN(IF((J5>=$E$7:$E$11)*(J5<=$F$7:$F$11),MATCH(ROW($B$7:$B$11),ROW($B$7:$B$11)))))
This works well, but I have to manually write the formula for each Hotel and Room Type. But things get complicated when there are multiple options for hotels and room. I end up with really large IF statements combined with this basic index formula. I thought I could combine this INDEX formula with something like =INDEX(range1,MATCH(1,(A1=range2)*(B1=range3)*(C1=range4),0))} to first Match the "Rate Code" (D2:D21) (Textjoin of Hotel and Room) ((M5) then match the row to the date range. J5>=(E2:E21)*J5<=(F2:F21) to return the Rate (B2:B21)
Thanks in advance! Love this forum!
=INDEX($B$7:$B$11,MIN(IF((J5>=$E$7:$E$11)*(J5<=$F$7:$F$11),MATCH(ROW($B$7:$B$11),ROW($B$7:$B$11)))))
This works well, but I have to manually write the formula for each Hotel and Room Type. But things get complicated when there are multiple options for hotels and room. I end up with really large IF statements combined with this basic index formula. I thought I could combine this INDEX formula with something like =INDEX(range1,MATCH(1,(A1=range2)*(B1=range3)*(C1=range4),0))} to first Match the "Rate Code" (D2:D21) (Textjoin of Hotel and Room) ((M5) then match the row to the date range. J5>=(E2:E21)*J5<=(F2:F21) to return the Rate (B2:B21)
Thanks in advance! Love this forum!
Example.xlsx | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | |||
1 | Hotel | Rate | Room | RateCode | Start Date | End Date | ||||||||||
2 | ABC | 100 | 1 | ABC1 | 12/1/2022 | 12/23/2021 | ||||||||||
3 | ABC | 200 | 1 | ABC1 | 12/24/2021 | 1/5/2022 | ||||||||||
4 | ABC | 100 | 1 | ABC1 | 1/6/2022 | 3/31/2022 | Date | Hotel | Room | RateCode | Manual Rate | |||||
5 | ABC | 200 | 1 | ABC1 | 4/1/2022 | 4/26/2022 | 4/3/2021 | ABC | 2 | ABC2 | 300 | |||||
6 | ABC | 100 | 1 | ABC1 | 4/27/2022 | 6/23/2022 | 4/4/2021 | ABC | 2 | ABC2 | 300 | |||||
7 | ABC | 300 | 2 | ABC2 | 12/1/2022 | 12/23/2021 | 4/5/2021 | ABC | 2 | ABC2 | 300 | |||||
8 | ABC | 400 | 2 | ABC2 | 12/24/2021 | 1/5/2022 | 4/6/2021 | ABC | 2 | ABC2 | 300 | |||||
9 | ABC | 300 | 2 | ABC2 | 1/6/2022 | 3/31/2022 | 4/7/2021 | BBC | 1 | BBC1 | 600 | |||||
10 | ABC | 400 | 2 | ABC2 | 4/1/2022 | 4/26/2022 | 4/8/2021 | BBC | 1 | BBC1 | 600 | |||||
11 | ABC | 300 | 2 | ABC2 | 4/27/2022 | 6/23/2022 | 4/9/2021 | BBC | 1 | BBC1 | 600 | |||||
12 | BBC | 600 | 1 | BBC1 | 12/1/2022 | 12/23/2021 | 4/10/2021 | BBC | 1 | BBC1 | 600 | |||||
13 | BBC | 700 | 1 | BBC1 | 12/24/2021 | 1/5/2022 | 4/11/2021 | BBC | 1 | BBC1 | 600 | |||||
14 | BBC | 600 | 1 | BBC1 | 1/6/2022 | 3/31/2022 | ||||||||||
15 | BBC | 700 | 1 | BBC1 | 4/1/2022 | 4/26/2022 | ||||||||||
16 | BBC | 600 | 1 | BBC1 | 4/27/2022 | 6/23/2022 | ||||||||||
17 | BBC | 800 | 2 | BBC2 | 12/1/2022 | 12/23/2021 | ||||||||||
18 | BBC | 900 | 2 | BBC2 | 12/24/2021 | 1/5/2022 | ||||||||||
19 | BBC | 600 | 2 | BBC2 | 1/6/2022 | 3/31/2022 | ||||||||||
20 | BBC | 700 | 2 | BBC2 | 4/1/2022 | 4/26/2022 | ||||||||||
21 | BBC | 300 | 2 | BBC2 | 4/27/2022 | 6/23/2022 | ||||||||||
22 | ||||||||||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
M5:M13 | M5 | =TEXTJOIN(,TRUE,K5,L5) |
N5:N8 | N5 | =INDEX($B$7:$B$11,MIN(IF((J5>=$E$7:$E$11)*(J5<=$F$7:$F$11),MATCH(ROW($B$7:$B$11),ROW($B$7:$B$11))))) |
N9:N13 | N9 | =INDEX($B$12:$B$16,MIN(IF((J9>=$E$12:$E$16)*(J9<=$F$12:$F$16),MATCH(ROW($B$12:$B$16),ROW($B$12:$B$16))))) |
D2:D21 | D2 | =TEXTJOIN(,TRUE,A2,C2,) |
Press CTRL+SHIFT+ENTER to enter array formulas. |