Skip to main content

Count number of Saturdays & Sundays in a date range

  • March 6, 2022
  • 1 reply
  • 90 views

Forum|alt.badge.img+1

I’m relatively new to airtable and i’m working on a tracking and costing system for the project I am working on.

I am creating security schedules which are usually the same for monday through to friday. they change on saturdays, sundays and public holidays.

I want to count the number of saturdays and sundays in a given period to set the schedule for those particular days but the starting point is knowing how many there are…

can anyone help out with this?
thanks

This topic has been closed for replies.

1 reply

JonathanBowen
Forum|alt.badge.img+18

Hi @Matthew_Camilleri - you can find the number of weekends between a start and end date with formulas:

First, work out the number of days in the period, then work out the number of workdays in the same period, then take them away. Rather than two columns as I have, you can combine this into a single formula field with:

DATETIME_DIFF(End, Start, 'days') + 1 - WORKDAY_DIFF(Start, End)

Note that I am adding 1 to the DATETIME_DIFF part of the formula in order to get the number of days inclusive of both the start and end date. By default DATETIME_DIFF gives a non-inclusive number of days, e.g. diff between 1st March and 1st March is zero.