Help

Help with formula

426 1
cancel
Showing results for 
Search instead for 
Did you mean: 
vel4
4 - Data Explorer
4 - Data Explorer

I'm new to Airtable and as expected I need help with a formula, please! 

This is what I need: 

IF( {Days to Deliver} is equal to 0 then it   'Expires Today',
IF({Days to Deliver}  is equal or bigger than 1 but less or equal than 7 then it is  'About to Expire',
IF(  {Days to Deliver} greater than 8 then it is 
'On Time'
IF(  {Days to Deliver} is <0 then it is
'Completed'
))))
 
Any help will be appreciated
1 Reply 1

Hey @vel4

Here's a formula that gets you the basic functionality that you're looking for:

IF(
{Days to Deliver},
IF(
{Days to Deliver} < 0,
"Completed",
IF(
{Days to Deliver} > 7,
"On Time",
IF(
AND(
{Days to Deliver} >= 1,
{Days to Deliver} <= 7
),
"About to Expire"
)
)
),
"Expires Today"
)

 

Ben_Young1_0-1673578308865.png

Here's an example of how that formula behaves.
It's important to call out a potential downside to this particular formula.
The biggest issue that since the IF function is evaluating the Days to Deliver field for a boolean, the formula will evaluate the value of 0 (zero) as the same as being nothing.

Since both zero and null/undefined evaluate to falsy boolean values, the formula will always return a value of Expires Today for records containing both defined values of zero or blank.

Personally, it would drive me insane, but other people wouldn't even notice it.
It's a matter of personal preference.

Happy to answer any questions about the formula or solutions if you're curious.