Check if record is on, or spans a weekend

147 10
Showing results for 
Search instead for 
Did you mean: 

Hi Everyone,
I’ve got a table that pulls Google Calendar events for my team into Airtable. It’s there to build an interface that breaks the events down and gives summaries as to how many days are spent On Site, Working from Home, in the Office etc…

I need to find a way to be able to filter out, or mark with a checkbox, the records that happen on, or span a weekend. Google Calendar only brings in start and end dates of events.

Any pointers would be fantastic. I’m quite an experienced Airtable user, but have no experience of coding but willing to try.


10 Replies 10

Hi @Max_Spielbichler
Here is a formula that will tell you if a date in on a weekend or a weekday

IF(OR(WEEKDAY(Date)=0,WEEKDAY(Date)=6), 'Weekend', 'Weekday')

This formula would be a good starting point, but it would need to be expanded in order to tell him if any of the dates in between the start date & end date also fall on a weekend.

I’m sure there’s some easy formula to pull this off that involves calculating the total number of days between the start date & the end date, and then subtracting the total number of days from the end date, but I’m not able to dedicate time right now to figuring out this exact formula.

Good point. I can try to expand on it if this is not enough. I’m guessing you would need to get the DATETAIME_DIFF for the range, then WORKDAY() to find the weekends.

Welcome to the Airtable Community!

Try this:

        WORKDAY_DIFF(startDate, endDate)
        DATETIME_DIFF(endDate, startDate, 'days') + 1
  "includes weekend"

Items to note:

  • WORKDAY_DIFF and DATETIME_DIFF take their inputs in different orders. Thus the dates are flip-flopped for the two functions.

  • WORKDAY_DIFF includes both the start and end date in its count, but DATETIME_DIFF does not. For example, if both dates are the same workday, WORKDAY_DIFF will give you 1, but DATETIME_DIFF will give you 0. To account for this difference, I add 1 to the DATETIME_DIFF.

  • If the dates have times associated with them (even hidden times), this might not work

  • If either date is missing, this will give an error

  • You might run into timezone issues.