I have a table (below) with start and end dates of trips I have taken. I want to create a formula in which I input a period start and end date, and it gives me the number of days I was on a trip during this period.
Trips table:
Table with start and end dates of trips
So basically, if I put period start as 29th May 2020 and period end as 19th May 2021, output should be 157 trip days (93 days from 29 May 2020 until 30 Aug 2020, 61 days from 19 Dec 2020 until 18 Feb 2021 and 3 days from 17 May 2021 until 19 May 2021).
I tried using sumifs with a trip start dates greater than period start and trip end dates < period end. But answer is not precise in cases where the period start or period end falls in the middle of a trip.