Help

Re: Simple If function

Solved
Jump to Solution
2847 7
cancel
Showing results for 
Search instead for 
Did you mean: 
Micheal_Ward
6 - Interface Innovator
6 - Interface Innovator

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

1 Solution

Accepted Solutions
Jeremy_Oglesby
14 - Jupiter
14 - Jupiter

It might be easier to use a SWITCH() statement, since you are checking the same field, namely {Suburb}, each time.

5f73751092c6afb3485d0dfe997b3809227f5002.png

Formula field reference

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


image

SWITCH(
   {Suburb},
   "gorokan", "KPM1",
   "hamlyn terrace", "KPM2",
   ...
)

See Solution in Thread

9 Replies 9
Jeremy_Oglesby
14 - Jupiter
14 - Jupiter

It might be easier to use a SWITCH() statement, since you are checking the same field, namely {Suburb}, each time.

5f73751092c6afb3485d0dfe997b3809227f5002.png

Formula field reference

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


image

SWITCH(
   {Suburb},
   "gorokan", "KPM1",
   "hamlyn terrace", "KPM2",
   ...
)
Micheal_Ward
6 - Interface Innovator
6 - Interface Innovator

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

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…

Thats what I thought! lol

Already writing it out, not the most elegant but at least it will work!

Thanks for the help!

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…

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

I refer you to a programming text editor again.
Auto-indentation and auto-closing of parentheses and brackets will make your life much easier.

I will certainly look into it! ( your link above where you suggested it doesnt work if you were recommending one.)

Fixed it (20 characters)