Help

Re: Two-Condition IF Formula

Solved
Jump to Solution
5775 0
cancel
Showing results for 
Search instead for 
Did you mean: 

What is the syntax for an IF statement that only generates output if two conditions, in two fields, are met?

Thanks for your help!

1 Solution

Accepted Solutions
Matt_Bush
Airtable Employee
Airtable Employee

To output one value if two conditions are true, and another value otherwise:
IF(AND(Condition-1, Condition-2), Value-If-Both-Are-True, Value-If-Either-Are-False)

See Solution in Thread

14 Replies 14
Simon_Horup_Es1
6 - Interface Innovator
6 - Interface Innovator

https://support.airtable.com/hc/en-us/articles/221564887-Nested-IF-formulas describes in detail how to nest if statements. You could also use an if and an and.

Matt_Bush
Airtable Employee
Airtable Employee

To output one value if two conditions are true, and another value otherwise:
IF(AND(Condition-1, Condition-2), Value-If-Both-Are-True, Value-If-Either-Are-False)

Hmm.

Right now I have a field that creates an underscore if the referenced field contains data. It’s generating a separator for auto-filenaming.

IF(SEGMENT1 = 0, “”,"_")

But it only works when the field that contains data for the second segment of the filename, the one after the underscore, is present.

When the second segment field is empty, I need the first field to return nothing.

Something like (and pardon my french): IF((SEGMENT1 = 0, “”,"_") BUT(IF(SEGMENT2 = Y, “”,"")))

Matt_Bush
Airtable Employee
Airtable Employee

In that case you may need to use OR() to combine two conditions if either are true (used just like AND otherwise), or NOT() to reverse a single condition. Try different combinations of those. For example,

IF(OR(Condition-1, NOT(Condition-2)), Value-1, Value-2)

MAMC
4 - Data Explorer
4 - Data Explorer

Is it possible to create a conditional IF formula to perform a calculation IF a certain condition is met? I have a CHARGES column, a PAYMENTS column and a DISCOUNT column. I want to creat a formula to calculate the discount IF there is a value entered into the PAYMENTS column. Other wise, the formula (CHARGE-PAYMENT) calculates a discount of the full charged amount. Thoughts?

I’m not exactly sure this is what you are intending, but the following does do something kind of like you describe:

IF(
    {Payments},
    ({Charge}*{Discount})-{Payment},
    {Charge}-{Payment}
    )

This assumes {Payments} is, say, a payment made at the time of purchase, which triggers some sort of percentage discount, while {Payment} is a newly received payment. Based on those assumptions, the formula applies the discount, if applicable, and then subtracts the amount of the received payment. If the purchaser does not qualify for the discount, it subtracts the payment from the full charged amount. In either case, the result is the outstanding balance.

If you can’t warp that to your actual needs, let me know, and I’ll try again.

MAMC
4 - Data Explorer
4 - Data Explorer

Thank you for your response! Its close but not quite. The discount is actually a WRITEOFF and will be equal to the CHARGE minus the PAYMENT only IF a payment is made/entered. If there is no payment entered, the writeoff should not be caculated (as it simply calculates the full CHARGE minus a 0 PAYMENT to give me a WRITEOFF amount equal to the orignal CHARGE which is not what I want).

Well, the standard IF() statement structure would look like this:

IF(
    {Payment},
    [What you want if a payment was received],
    [What you want if no payment was received]
    )

(It’s not a multi-condition IF() as the posting initially discussed.)

So essentially you’re looking at this, possibly with a second clause:

IF(
    {Payment},
    {Charge}-{Payment},
    [What you want if no payment was received]
    )

If you don’t want a value when no payment is received, you could just use this:

IF({Payment},{Charge}-{Payment})

Thank you!! I think that will work. I appreciate the help!