Difference between two dates, number of nights between a certain range of period

BobsterT

New Member
Joined
Mar 23, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I want to know the number of nights people are staying between two dates. (in this example, it's between the 1st and the 31st of March.
If someone arrives the 28 of February and is leaving the 3rd of March, then the result should be 2, that is the night of the first and the second of March.

If someone is arriving the 30st of March and leaving the 1st of April, they stay the 30st and the 31st, thus 2.
If they leave the 31st of March, they stay one day, thus 1.

...
Is there anyone who can help me? I'm struggling with loads of what if's and I'm not getting the result I need.
Something more easier ?

Tx

Bob
 

Attachments

  • Picture.JPG
    Picture.JPG
    85.7 KB · Views: 29

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
PHP:
=MAX((MIN($B3,D$1)-MAX($A3,C$1)),0)
Try this formula in C3.
feb = 1-2-24
mrt =1-3-24
apr=1-4-24
 

Attachments

  • month.jpg
    month.jpg
    171.5 KB · Views: 18
Last edited:
Upvote 0
How about

Book1
BCD
1RangeFrom1-Mar-24
2To31-Mar-24
3
4ArrivalDeparture
515-Feb-2429-Feb-240
626-Feb-245-Mar-244
79-Mar-2412-Mar-243
828-Feb-245-Apr-2431
926-Mar-2410-Apr-246
101-Mar-243-Mar-242
112-Mar-243-Mar-241
1226-Mar-2431-Mar-245
1328-Mar-241-Apr-244
Sheet1
Cell Formulas
RangeFormula
D5:D13D5=MAX(0,MIN($D$2+1,C5)-MAX($D$1,B5))
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,617
Latest member
Narendra Babu D

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top