# Re: IF statements and formulas

Solved
1969 0
cancel
Showing results for
Did you mean:
4 - Data Explorer

Hello!
I am trying to make a formula based on an IF statement.

IF one cell = something, then perform this formula. For example,

IF(
{Frequency},
‘Annual’,({Cost/12}))

I would like to have multiple “IF” statements & formulas. Is this possible?

1 Solution

Accepted Solutions
18 - Pluto
``````SWITCH( {Frequency},
"Weekly", {Cost} * 4.3,
"Monthly", {Cost},
"Annual", {Cost} / 12
)
``````

In general, put field names in curly braces `{}` and put literal text strings in straight quotes `" "`.

7 Replies 7
11 - Venus

Hi @Lindsay_Kirsch,
You are pretty close you your IF statement. The format is like this:

IF(something that can be true, if true do this, is not true do this)

Notice there are 3 sections separated by a comma.

But…

SWITCH() would likely be better than nesting IF().

the format for that would be

``````SWITCH(
{Field Name},
option, result,
option, result,
'default')

``````
4 - Data Explorer

I am still having trouble - Image 2022-08-12 at 7.13.35 PM

``````SWITCH(

Frequency,

Annual,=SUM(Cost/12),

'default')
``````
11 - Venus

Hey @Lindsay_Kirsch!

Unlike a spreadsheet application, Airtable’s formula syntax does not use `=` characters in front of functions.

So you’d just remove the character from the SUM function and it should work.

Quick Edit:

Noticed this just now.

This function will probably throw an error at you.
If you’re trying to just divide the {Cost} by 12, then you can remove it from the SUM function and just put in: `({Cost} / 12)`, and it will do so.

It should probably look something like this:

``````SWITCH(
{Frequency},
{Annual}, ({Cost} / 12),
'Default'
)
``````
4 - Data Explorer

Still not working :frowning: Image 2022-08-12 at 8.16.43 PM

4 - Data Explorer

I would like to calculate the total monthly cost based on the variables in Frequency.

So if Frequency = Weekly then it would be Cost*4.3
If Frequency = Annual then it would be Cost/12

18 - Pluto
``````SWITCH( {Frequency},
"Weekly", {Cost} * 4.3,
"Monthly", {Cost},
"Annual", {Cost} / 12
)
``````

In general, put field names in curly braces `{}` and put literal text strings in straight quotes `" "`.

4 - Data Explorer

This worked! Thank you so much!