SOLVED

Date calculation formula needed for daily pickup

Copper Contributor

Hello Experts,
I am looking for a formula that calculates daily numbers from check-in and check-out dates. I am aware of the basic formula that calculates the total number of days between two dates but what I need is a formula that breaks down the total number of days day by day.
For example: check-in: 5/1/10 Check-out: 5/5/19 equals 4 days. Now I need to break down the 4 days by the day like this:
5/1/19     5/2/19      5/3/19       5/4/19
    1              1               1               1
Is there a formula that pulls from the check-in and check-out columns and automatically calculates the daily breakdown as shown above in separate columns? Attached is the file with process I need help with .
Thank you for your help!

10 Replies

@excel101 

You may use in E2

=IF((E$1>=$A2)*(E$1<=$B2),1,"")

and drag it to entire range

 

It appears that the check-in date is included in, while the check-out date is excluded from, the calculation of total nights. Thus, the formula in E2, copied down rows and across columns, is:
=IF((E$1>=$A2)*(E$1<$B2),
1,””)
best response confirmed by excel101 (Copper Contributor)
Solution

@Sergei BaklanThank you so much!

@TwifooThank you so much! It worked!

@TwifooHow can I use the formula you provided with a different date range? I tried to do it with a different date range but it is not working.

 

Thank you again

It depends upon the layout of your data. The formula always conforms to such layout but the logic would remain the same.

@Twifoo @Twifoo Thank you! Can you elaborate a bit further please. I have used the same formula but it just not working. What do you mean by "data layout" exactly? Do mind looking at the attachment with the new set of dates and the formula please? Thank you again.

@excel101 

Formula works (attached), what exactly is wrong?

@Sergei BaklanThank you! One thing I noticed is that when I copied the dates and formula that you sent back and pasted into a new spreadsheet, the formula did not work. But when I re-typed one of the check-in/check-out dates the formula worked all of a sudden. It's like the the dates were not recognized until I re-typed them manually. Do you know what that could be? Thanks again!

 

 

@excel101 

 

Perhaps you didn't fix the row with absolute reference or like. Most probably wrong combination of absolute/relative references in pasted formulas.

1 best response

Accepted Solutions
best response confirmed by excel101 (Copper Contributor)