Oct 16, 2016 09:35 AM
What is the syntax for an IF statement that only generates output if two conditions, in two fields, are met?
Thanks for your help!
Solved! Go to Solution.
Oct 16, 2016 07:24 PM
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)
Oct 16, 2016 05:14 PM
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
.
Oct 16, 2016 07:24 PM
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)
Oct 16, 2016 07:43 PM
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, “”,"")))
Oct 16, 2016 10:52 PM
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)
Jun 18, 2018 07:48 AM
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?
Jun 18, 2018 08:21 AM
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.
Jun 18, 2018 08:48 AM
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).
Jun 18, 2018 09:46 AM
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})
Jun 18, 2018 10:16 AM
Thank you!! I think that will work. I appreciate the help!