Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here
Jan 24, 2020 04:11 AM
Hello!
I have created a food management base for my film production company and I want to create a formula that will flag food products that are:
-Expired
-Expiring within 28 days
The name of the field with the dates in is “Use by Date”.
Thank you!
Jan 24, 2020 07:06 AM
Here’s what I came up with:
I went with two formula fields: one to calculate the date difference between {Use by Date}
and the current day, and another to use that difference to decide how to flag each item. This could all be done in a single formula, but whenever I’m using the same calculation several times, I prefer to throw that into its own formula field and treat it like a programming variable. {Diff}
is this:
DATETIME_DIFF({Use by Date}, NOW(), "days")
And {State}
is this:
IF(Diff <= 0, "❌", IF(AND(Diff > 0, Diff <= 28), "⚠️"))