This is incredible help - thank you so much!!! Brilliant to get such a good reply and hugely appreciated.
I have a few other things to add in if you don’t mind helping a little bit further:
The month is taken from a start date (which is in a date field) but I’m having trouble formatting this outside of the typical format, in my timezone we use DD/MM/YYYY. Is it possible just to get the MM part of this - the other is irrelevant for my purposes, or just use the MM part for the above calculation?
Then two more conditions:
- It should only return a 1 according to the above if the “Pet” field is “Dog” (if “Pet” field is “Cat” should always return 0)
- It should return a 1 always if “Pet age” is “6-12 months” (if pet age isn’t this then it should use the formula above).
Happy to help! Because you’re using an actual date, you can do the same thing that was done to NOW() to force that date to be the first of the listed month. To implement that part, change…
DATETIME_PARSE(Month, "MMMM"),
…to…
DATETIME_PARSE(
MONTH({Start Date}) & "/1/" & YEAR({Start Date}),
"M/D/YYYY"
),
(Change the {Start Date} references to your actual field name, of course.)
Even though your timezone formats dates differently, Airtable can still parse dates written in a different format because of the formatting string. However, you can change “M/D/YYYY” to “D/M/YYYY” if you want, but you’ll also have to change the order of the pieces being concatenated for the parsing operations.
To add the other conditions, we’ll wrap the revised formula inside a couple of IF() functions. Here’s the new final result:
IF(
Pet = "Dog",
IF(
{Pet age} = "6-12 months",
1,
MOD(
DATETIME_DIFF(
DATETIME_PARSE(
MONTH({Start Date}) & "/1/" & YEAR({Start Date}),
"M/D/YYYY"
),
DATETIME_PARSE(
MONTH(NOW()) & "/1/" & YEAR(NOW()),
"M/D/YYYY"
),
"months"
), 3
) = 0
), 0
)
