Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Calculate number of days between dates across multiple rows

$
0
0

I am trying to find a way to create a pivot table in Google Sheets that lists the years as rows, the countries as columns and the number of days lived in each country as the values.

I think the way to go is to add a column to the table that is something like "Days in outbound country", starting from the second row.

Date & timeOutbound countryInbound country
11/01/2020 17:25GermanyFrance
10/10/2020 12:45FranceGermany
15/11/2020 17:45GermanyBrazil
19/12/2020 20:00BrazilSpain
23/01/2021 18:00SpainGermany

The issue is that not always the trip is linear (Country A -> Country B ; Country B -> Country A). Sometimes there are other countries in-between.

Could I use the LOOKUP function to search for the previous occurrance of the country? Then how do I calculate the difference for the number of days?


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>