Help

IF statements and formulas

Topic Labels: Formulas
Solved
Jump to Solution
1584 7
cancel
Showing results for 
Search instead for 
Did you mean: 
Lindsay_Kirsch
4 - Data Explorer
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
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 " ".

See Solution in Thread

7 Replies 7

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

Lindsay_Kirsch
4 - Data Explorer
4 - Data Explorer

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'
)
Lindsay_Kirsch
4 - Data Explorer
4 - Data Explorer

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

Lindsay_Kirsch
4 - Data Explorer
4 - Data Explorer

@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!