# IF Formula with values from multiple columns

#1

Hello Everyone, I’m very new with AirTable and I have been struggling with this formula.

I have these 3 different columns: 1) Lead Count, 2) Opportunity Count 3) Total Amount (\$). I’m creating a formula to select the Account Status based on these three columns in this way:

• If Lead Count = 0 --> “Cold”
• If Lead Count = 1 --> “Aware”
• If Lead Count >1 --> “Qualified”
OR
• If Opportunity Count >0 --> Opportunity (regardless of Lead Count)
• If Total Amount (\$) > 0 --> Customer (regardless of anything else)

How can I put this into a formula?

0 Likes

#2

Hi @Franco_Caporale - I found the easiest way to do this is to break it down into 4 formula fields. The first 3 are “interim” statuses and the final field is the final status you’re after.

Status Lead produces the status of the Lead Count column using this:

`SWITCH({Lead Count}, 0, "Cold", 1, "Aware", "Qualified")`

Status Opp produces the status of the Opportunity Count column using this:

`IF({Opportunity Count} &gt; 0, "Opportunity", "")`

Status Total produces the status of the Total Amount column using this:

`IF({Total Amount} &gt; 0, "Customer", "")`

And, finally, the Status column works off the other 3 to provide the consolidated status using:

`IF({Status Total}, {Status Total}, IF({Status Opp}, {Status Opp}, {Status Lead}))`

You can hide the 3 interim status columns to make the view a bit prettier.

You could probably combine these into a single formula/column if you wanted to, although in this case, I think separating them makes the formulas easier to manage.

JB

2 Likes

#3

Also to add, the Lead Count field, which is used in the SWITCH formula, needs a default value of 0. Otherwise, when you create an new record and the lead count number is empty, you get “qualified” in the Status Lead field, which you don’t want.

0 Likes

#4

Hi @JonathanBowen, thank you very much for the detailed response! Very appreciated!

This is the perfect approach, I like how more manageable it is, even if we decide to change values, without having to deal with all those nested formulas.

Again, thank you so much, you saved me hours of frustration!

1 Like