I want to set values based on a arrival and departure date:
Idx Arrive Depart 01. Jan 02. Jan 03. Jan 04. Jan 05. Jan ...
1 01. Jan 04. Jan 1 1 1
2 02. Jan 04. Jan 1 1
3 02. Jan 05. Jan 1 1 1
4 01. Jan 05. Jan 1 1 1 1
5 03. Jan 05. Jan 1 1
... ... ... ... ... ... ... ... ...
Total 2 4 5 3
For example, Idx 1:
Arrives on 01 January
Departs on 04 January
A total of 3 nights accommodation needed (value of ‘1’ in the columns 01, 02 and 03 January) You’ll note that a ‘1’ isn’t entered in the 04 January column, as this is the date of departure and no accommodation isn’t required that night.
How to archieve this in Excel?
Assuming that Arrive is in column A and the column headers (Arrive, Depart, 01. Jan) are on row 1, you want to put the following formula into cell C2:
From there, you can copy the formula into the other cells. The formula assumes that the dates on the left and at the top are proper data values, i.e. Excel treats them as dates.