 # Multiple IF Formula

Hi!

Below is my full if formula, for now Im just testing this one:

=IF([HOTEL]="CVS - Centralværkstedet","info@t.dk","Test")

Pretty basic, but it is not working.

Error message:

" Sorry, something went wrong

The formula contains a syntax error or is not supported."

``````=IF([HOTEL]="CVS - Centralværkstedet","info@t.dk",
IF([HOTEL]="CBO - Borupgaard","info@t.dk",
IF([HOTEL]="CCP - Copenhagen Portside","info@t.dk",
IF([HOTEL]="CHC - HC Andersen Odense","info@t.dk",
IF([HOTEL]="CHO - Holte","info@t.dk",
IF([HOTEL]="CAL - Hvide Hus Aalborg","info@t.dk",
IF([HOTEL]="CKP - Kellers Park","info@t.dk",
IF([HOTEL]="CKL - Klarskovgaard","info@t.dk",
IF([HOTEL]="CKO - Kolding","info@t.dk",
IF([HOTEL]="CKG - Kongerbrogaarden","info@t.dk",
IF([HOTEL]="CKS - Køge Strand","info@t.dk",
IF([HOTEL]="CMI - Middelfart","info@t.dk",
IF([HOTEL]="CRE - Rebild Bakker","info@t.dkm",
IF([HOTEL]="CRO - Roskilde","info@t.dk",
IF([HOTEL]="CSO - Sorø","info@t.dk",
IF([HOTEL]="CAA - Aarhus","info@t.dk"))))))))))))))))``````

8 Replies

# Re: Multiple IF Formula

I think you simply nested too many IFs. Isn't 7 the maximum?

What kind of column is [HOTEL] ? Text, Choice, Lookup?

# Re: Multiple IF Formula

While I couldn't figure out the exact issue, I received the same error when I copy/paste your test formula. I erased it and started building it one element at a time. I started with

=IF([HOTEL]="","1","2")

and substitute one string at a time, testing between each change. I ended up with

=IF([HOTEL]="CVS - Centralværkstedet","info@t.dk","Test")

which works. It looks the same, but something is different. (I suspect a hidden invalid character.) Just keep building the formula piece by piece. It's slow and frustrating sometimes, but without a better error message from SharePoint, there is not much else you can do. It will either work, or you will find the exact change that is causing the issue.

If this helps, please consider marking it as the solution. Thanks and good luck!

Don

# Re: Multiple IF Formula

Hi,

I am trying one single line.
Does it work for you if you try with letters/alphabeth?

# Re: Multiple IF Formula

@Bernd71 also has a valid point for the full formula.

https://support.microsoft.com/en-us/office/introduction-to-sharepoint-formulas-and-functions-94e1b4c...

has the following statement:

Nesting level limits A formula can contain up to eight levels of nested functions.

It doesn't explain the issue in the test formula, but you will need to make changes based on number of nested formulas. It will take multiple calculated fields to reach the final result.
Basic approach I would take is maximize the nesting in the first calculated column, with the final result being either the custom result from one of the nested IFs, or the original HOTEL if none match. Then in the next calculated column, the initial IF will test IF [Calc1]=[HOTEL]. If they match, add additional IFs. If they don't match, return the value of Calc1.

# Re: Multiple IF Formula

Yes, I showed the formula that is working for me. It looks identical to your formula, but I also get the same error if I just copy/paste your formula. I think there is a hidden character causing the error, but rather than troubleshoot that, just recreate the formula one piece at a time, which will hopefully bypass the bad character.

# Re: Multiple IF Formula

Sadly this nesting limit is not good for me.

I am now trying to use lookup columns instead. But I need Power Automate to Insert the Microsoft Form entry into that lookup-column. That is also an issue now.

Thanks for your help.

# Re: Multiple IF Formula

Jesus, what an annoying limitation :(

# Re: Multiple IF Formula

The solution was actually like this.

https://i.stack.imgur.com/YCALp.png