I’m working with a dataset containing information about bike sharing rides. The data includes the start time and end time of each ride. I want to calculate the average time between bike rides for a given month.
The challenge I’m facing is that some rides start on one day and end on the next day. For example, if a ride starts at 11:00 PM and ends at 1:00 AM the following day, calculating the elapsed time using a simple formula like “end time minus start time” results in a negative value.
I initially tried using a formula like =EndTime – StartTime to calculate the elapsed time between rides. However, this approach doesn’t work correctly when the end time is earlier than the start time due to the rides spanning across different days.
I also considered adding an extra day to the end time if it’s less than the start time, but this solution isn’t efficient when dealing with a large dataset, as I would need to manually identify and adjust the formula for each case.
Robert Nyakundi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.