Good morning
I want to create a formula based on field
For example
If this field is = to A then do this ( Field X *15 ) … if the field is = to B then do this ( Field X *20)
Good morning
I want to create a formula based on field
For example
If this field is = to A then do this ( Field X *15 ) … if the field is = to B then do this ( Field X *20)
IF(
{Field} = 'A',
{Field}*15,
IF(
{Field}='B',
{Field}*20
)
)
2 notes :grinning_face_with_smiling_eyes:
Field * IF(Field = 'A', A, B)
' around the values.And of course check the docs: https://support.airtable.com/hc/en-us/articles/203255215-Formula-field-reference#logical
2 notes :grinning_face_with_smiling_eyes:
Field * IF(Field = 'A', A, B)
' around the values.And of course check the docs: https://support.airtable.com/hc/en-us/articles/203255215-Formula-field-reference#logical
Depending on what the ‘else’ section of the formula is, though, writing it as an A-or-B choice can mean the field shows as '#ERROR' or 'NaN' until something is entered in the matched field — which can worry some users and make executive presentations very uncomfortable. :winking_face:
I’ve been trying to force myself into the habit of wrapping most formulas with an IF() statement whose job is simply to prevent the formula from being executed until there is actual data entry to evaluate (comments for illustrative purposes only; can’t be included in actual formula):
IF(
{Field}, ; means '{Field} is not empty'
[The original formula] ; execute the formula
) ; otherwise, do nothing
And, of course, if the field might match 'A' or it might match 'B' or it might be empty or match a value other than 'A' or 'B', the A-or-B solution doesn’t work. (I know you know that, but filling in some blanks for the user who finds this thread a year from now while searching ‘Ask the community.’~ :slightly_smiling_face: )
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.