Skip to content

Instantly share code, notes, and snippets.

@stephanbogner
Last active January 25, 2021 09:12
Show Gist options
  • Save stephanbogner/7632052cd9c14be9ebb78039bac503a7 to your computer and use it in GitHub Desktop.
Save stephanbogner/7632052cd9c14be9ebb78039bac503a7 to your computer and use it in GitHub Desktop.
Create date range in Google Sheets from calendar week (with 00:00 on the first date and 23:59 on the end date)

Screenshot 2021-01-25 at 09 53 22

Formula start date (year 2021 hardcoded in my case)

=TEXT(DATE(2021; 1; -3 + 7 * SPLIT( LOWER($A2) ; "abcdefghijklmnopqrstuvwxyz " ) - WEEKDAY(DATE(2021; 1; 4); 2) + 1); "dd.mm.yyyy 00:00")

Formula end date (year 2021 hardcoded in my case)

=TEXT(DATE(2021; 1; -3 + 7 + 7 * SPLIT( LOWER($A2) ; "abcdefghijklmnopqrstuvwxyz " ) - WEEKDAY(DATE(2021; 1; 4); 2)); "dd.mm.yyyy 23:59")

Note

Not all would be necessary just for the date range, but I wanted to write "CW XYZ" and needed the time as well for some calculation

Sources

——————————————————

In German

Datumsbereich in Google Tabellen von Kalenderwoche erstellen (mit 00:00 beim Startdatum und 23:59 am Enddatum)

Formel Startdatum (Jahr 2021 in meinem Fall direkt in die Formel geschrieben)

=TEXT(DATUM(2021; 1; -3 + 7 * SPLIT( KLEIN($A2) ; "abcdefghijklmnopqrstuvwxyz " ) - WOCHENTAG(DATUM(2021; 1; 4); 2) + 1); "dd.mm.yyyy 00:00")

Formel Enddatum (Jahr 2021 in meinem Fall direkt in die Formel geschrieben)

=TEXT(DATUM(2021; 1; -3 + 7 + 7 * SPLIT( KLEIN($A2) ; "abcdefghijklmnopqrstuvwxyz " ) - WOCHENTAG(DATUM(2021; 1; 4); 2)); "dd.mm.yyyy 23:59")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment