Help

Help With Switch Formula

Topic Labels: Formulas
Solved
Jump to Solution
1705 6
cancel
Showing results for 
Search instead for 
Did you mean: 
Hunter_Casillas
4 - Data Explorer
4 - Data Explorer

SWITCH(PageID, "18479402361", "NKH", "8532248414", “WWP”, "8271670852", “LLS”, "342294162453301", “PP”, "27817332304", “AFSP”, "55701226138", “AHA”, "15687409793", “WWF”, "12692786774", “ALS, "184404096774", “LUPUS”, "105229062888132", “SSS”, "25372476424", “BFAS”, "12596759677", “RAICES”, "14084625156", “SGK”, “13793312555", “MAW”, "1562713090633117", “OUR”, "20876805343", “MOD”, "100438444321", “CCA”, "8492293163", “EDF”, "111541054636", “BTM”, "10331123781", “SO”, "371566686229476", “ADAA”, "342091725962792", “M22”, "8047221596", “STC”, "11791104453", “NRDC”, "81517275796", “UNICEF”, "512423278811960", “DS”, "122531741163825", “ALF”, "22902828717", “BB”, "332378771195", “CF”, "97646191545", “HA”, "44224524016", “AKF”, "332077995968", “LCRF”, "84618074710", “CCC”, "95155519857", “BLISS”, "24470472733", “TP”, "7271534916", “FFB”, "N/A")

Here is my switch formula currently. I have genuinely been looking at this for 45 minutes now and I cannot seem to figure out why it is erroring out. I’m sure it’s a very simple issue but I cannot seem to find the cause. Please let me know if you see any errors. Thanks!

1 Solution

Accepted Solutions

Hi @Hunter_Casillas

There was a quote missing from one of the strings of letters (ALS.).

image

Mary K

See Solution in Thread

6 Replies 6

Your formula has a mix of straight quotes "..." and curly quotes “...”.

Make sure you use only straight quotes.

Hi @Hunter_Casillas

There was a quote missing from one of the strings of letters (ALS.).

image

Mary K

Didn’t even notice that, thank you!

E_K
6 - Interface Innovator
6 - Interface Innovator

Any idea, what is max number of patterns and results SWITCH() function can handle?
If that is exceeded, what might be a sidewalk (but not nested IF, I am have about 180 patterns. Thank you

I haven’t seen a documented limit on the SWITCH function. I have see some very long formulas.

On the other hand, you are probably better off with writing a script for the scripting block (unless the info changes frequently). I think it would be much easier. The syntax for a JavaScript SWITCH is a bit different from Airtable’s formula fields.

E_K
6 - Interface Innovator
6 - Interface Innovator

Thank you, @kuovonne. I am a total lamer in JavaScript and will probably continue with SWITCH() function. So far it handles my 180 patterns and results.