Nov 12, 2019 03:36 PM
I need a simple formula for working out a suburb and it puts out a selected output.
eg: if the suburb gorokan or toukley is in the field, the formula puts in KPM1. IF the suburb is hamlyn terrace it puts in KPM2 etc etc This will apply to 5 different outputs ( KPM1 KPM2 KPM 3 KPM4 LM1) based on the suburb.
IF({Suburb}=“gorokan”, “KPM1”)
This formula works great for the single suburb but I cant get it to output KPM1 if I put multiple suburbs in there
I know it will be nested IF formulas but I just cant get this first one to work as expected.
It will be simple im sure! lol
Solved! Go to Solution.
Nov 12, 2019 04:03 PM
It might be easier to use a SWITCH()
statement, since you are checking the same field, namely {Suburb}
, each time.
For an overview of formula fields, please refer to the Guide to Formula, Lookup, Count, and Rollup fields. Formulas may involve functions, numeric operations, logical operations, and text operation...
SWITCH(
{Suburb},
"gorokan", "KPM1",
"hamlyn terrace", "KPM2",
...
)
Nov 12, 2019 04:03 PM
It might be easier to use a SWITCH()
statement, since you are checking the same field, namely {Suburb}
, each time.
For an overview of formula fields, please refer to the Guide to Formula, Lookup, Count, and Rollup fields. Formulas may involve functions, numeric operations, logical operations, and text operation...
SWITCH(
{Suburb},
"gorokan", "KPM1",
"hamlyn terrace", "KPM2",
...
)
Nov 12, 2019 04:22 PM
yep, that works but is there a way so I dont have to do individual suburbs? eg:
“gorokan, toukley, etc, etc”, “KPM1”
“hamlayn terrace, kanwal, etc etc” “KPM2”
…
I would prefer to group the suburbs into one part of the formula rather than 1 per suburb as I have about 30 to do. lol
Nov 12, 2019 05:34 PM
Nope.
You could group them together in a repeated IF(OR())
structure, but you’d likely end up writing more characters, only to have a far less readable formula.
I’d suggest biting the bullet and writing out the explicit SWITCH()
function. Perhaps a good Programming text editor would come in handy here…
Nov 12, 2019 05:38 PM
Thats what I thought! lol
Already writing it out, not the most elegant but at least it will work!
Thanks for the help!
Nov 12, 2019 05:38 PM
If you think 30 lines in a SWITCH()
function is bad, you should take a look at this formula I had to write for a client…
Nov 12, 2019 05:47 PM
haha… cut and paste is your friend there!
Im only new to airtable and functions, formula’s / excel in general and can do the basics but I get lost in all the (((((( ) ()))))))'s
Nov 12, 2019 05:56 PM
I refer you to a programming text editor again.
Auto-indentation and auto-closing of parentheses and brackets will make your life much easier.
Nov 12, 2019 06:00 PM
I will certainly look into it! ( your link above where you suggested it doesnt work if you were recommending one.)
Nov 12, 2019 06:55 PM
Fixed it (20 characters)