DATETIME_FORMAT(
DATEADD(
{Your Date Field},
IF(
WEEKDAY({Your Date Field}) = 0,
-6,
IF(
WEEKDAY({Your Date Field}) = 1,
-7,
-WEEKDAY({Your Date Field}) + 1
)
),
'days'
),
'YYYY-MM-DD'
)
This formula works as follows:
- It first checks the day of the week for the given date.
- If the date is a Sunday (0), it subtracts 6 days to get to the previous Monday.
- If the date is a Monday (1), it subtracts 7 days to find the last Monday.
- For any other day, it subtracts the weekday number from 1 (-WEEKDAY({Your Date Field}) + 1) to go back to the previous Monday.
- DATETIME_FORMAT is then used to format the resulting date. You can adjust the 'YYYY-MM-DD' part of the formula to match your preferred date format.
Make sure to replace {Your Date Field} with the actual name of your date field in Airtable. This formula should be added in a new formula field in your Airtable base.
For the any help of Airtable formula you can always check this https://www.airtable.com/universe/expHF9XTWWwAT299z/airtable-formula-playground
👍