# Re: Formula using IF

Solved
211 0
cancel
Showing results for
Did you mean:  5 - Automation Enthusiast

i have the following colums that iam trying to combine in a formula :

• customer billing (with only two possibles choices: direct or indirect)
• indirect total sales revenue (a formula which multiplies a monthly amount by a number of months)

I need a formula in a new column which combines the two following conditions:

IF “indirect” is chosen, then copy the same amount
IF “direct” is chosen, then apply a 12% on the “indirect total sales revenue”

i hope it is clear enough.

Thyank you very much in advance!

1 Solution

Accepted Solutions  5 - Automation Enthusiast

Kuovonne,

You were 100% correct. No need to use the SWITCH instruction (even though I learnt something new!).

My IF formula works exactly as I needed it to.

Thank you again for your help, very instructive.

François

5 Replies 5  18 - Pluto

Welcome to the Airtable community!

The formula field reference has info on the functions to combine to do what you want.

``````IF( {customer billing) = "indirect",
{indirect total sales revenue},
{indirect total sales revenue} * 1.12,
)
``````  5 - Automation Enthusiast

thank you very much! it helps.

the first condition of the formula works.

I still need the second condition in the formula

should the formula continue with:

OR IF ( {customer billing = “direct”, {indirect total sales revenue}) ?  5 - Automation Enthusiast

thank you very much Kuovonne! it helps.

the first condition of the formula works.

I still need the second condition in the formula

should the formula continue with:

OR IF ( {customer billing = “direct”, {indirect total sales revenue}) ?

Thank you again!  18 - Pluto

The second situation is handled in the last part of the `ÌF` function, where the {indirect total sales revenue} is multiplied by 1.12. Since the {customer billing} field can only have two values, the function only needs to test if the {customer billing} is “indirect”. If {customer billing} is not “indirect”, then it must be “direct”, without having to explicitly test for it.

On the other hand, if you really want a different formula that explicitly lists all of the possible values for the {customer billing} field, you can use a switch function.

``````SWITCH({customer billing},
"indirect", {indirect total sales revenue},
"direct", {indirect total sales revenue} * 1.12
)
``````

There are many different ways of doing things with formulas/code. Pick whatever makes the most sense to you.

If neither of these formulas work for you, please send a screen capture annotated with your desired results!  5 - Automation Enthusiast

Kuovonne,

You were 100% correct. No need to use the SWITCH instruction (even though I learnt something new!).

My IF formula works exactly as I needed it to.

Thank you again for your help, very instructive.

François 