IF statements and formulas

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?

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')

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

SWITCH(

Frequency,

Annual,=SUM(Cost/12),

'default')

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'
)

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

@Adam_TheTimeSavingCo

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

image

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 " ".

This worked! Thank you so much!

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.