SWITCH formula help

Hello Experts,
I am trying to write a SWITCH formula, as below:

SWITCH({CUSTOMER NUMBER},“123”,ABC
,“456”,DEF
,“789”,GHI
,“012”,JKL
,“345”,MNO)

The customer number column is TEXT column, which is linked to a submission form. I cannot get this formula to work, I have no idea why.

I have another formula, wherein the lookup column is a dropdown menu, which works beautifully, with the same parameters

Please guide and help

Hi @Tabish - you just need to have your results in quotes and this should work for you:

SWITCH({CUSTOMER NUMBER},“123”, “ABC”
,“456”, “DEF”
,“789”, “GHI”
,“012”, “JKL”
,“345”, “MNO”, “ZZZ”)

It’s also good to add a default value (I added “ZZZ”) if none of the comparisons within the statement match.

Thanks,
Mark

Hi @mark.anley
Thank you so much for your reply, I tweaked the formula to add the last default value, however now the result shows up as 123, i.e., the fist lookup values for all the rows, regardless if there is a match or not.

What am I doing wrong here?

Hi @Tabish - that seems strange. I tested the same thing in my environment and it worked perfect. Here is a screen shot just to be sure:

image

image

Let me know,
Mark

Hi @mark.anley ,
I copied and pasted your code, and it is working fine now.
I think I misplaced the coma somewhere.

Thank you so much for your help, you are a lifesaver

1 Like

You are most welcome @Tabish