@Judith_Soto The formula as listed above isn’t formatted as preformatted text, so it contains styled quotes, and styled quotes won’t work in Airtable. If you copied and pasted without fixing the quotes, that will lead to an error. I’ll give you a variant in a bit that fixes that problem, but there are other problems.
In your logic, there are multiple conditions that all trigger on the state of the {Sold Date}
field. You have conditions that tie to the elapsed days, as well as conditions for Paid or Unpaid, but those latter two are actually tied to the two “sold” conditions farther up the list; i.e. you want to know the paid/unpaid status of sold items in addition to knowing if they’re sold. With the formula above, these conditions are separate, not connected (plus the last {Sold Date}
comparison looked for an empty field, not a filled field). The problem there is that Airtable latches onto the first condition that tests as true, working from the outside in. It won’t return multiple outputs from different levels of the nesting. Looking at the formula above, if the condition that returns “Sold” triggers, you won’t know the paid/unpaid status because that check isn’t done until the innermost level.
Another issue is the day counts that you listed. The two criteria that you indicated are “<90” and “>91”, but “<90” means 89 or lower, and “>91” means 92 or higher. That means that a difference of 90 or 91 days won’t trigger either condition. The second criteria should be “>=90” to ensure that nothing is missed.
Finally, a shortcut way of checking for an empty/filled field is to just use the field name itself. Comparing against an empty string or the BLANK()
function is largely unnecessary. (I say “largely” because there’s a small issue with numeric fields, but I won’t get into that here.)
This revised formula has all of these issues addressed:
IF(
DATETIME_DIFF(NOW(), {Date of listing}, "days") < 90,
IF({Sold date}, "Sold - " & IF({Payout date}, "Paid", "Unpaid"), "Active"),
IF(
DATETIME_DIFF(NOW(), {Date of listing}, "days") >= 90,
IF({Sold date}, "Sold Past Expiration - " & IF({Payout date}, "Paid", "Unpaid"), "Expired")
)
)
It might even be safe to assume that if the date difference isn’t less than 90, then it’s automatically >=90, so this even simpler formula might do the job:
IF(
DATETIME_DIFF(NOW(), {Date of listing}, "days") < 90,
IF({Sold date}, "Sold - " & IF({Payout date}, "Paid", "Unpaid"), "Active"),
IF({Sold date}, "Sold Past Expiration - " & IF({Payout date}, "Paid", "Unpaid"), "Expired")
)