Zoho CRM Formula field - lots of "If", "And", "Contains" and "Not"..

Zoho CRM Formula field - lots of "If", "And", "Contains" and "Not"..

Hi,

I have a problem with my formula code. It doesn't give me the right output.

  1. If(And(Contains(${Sager.Kundetype},'BtC'),Contains(${Sager.Type},'Ny kunde'),Not(Contains(${Sager.Kilde},'Autobutler'))),'Retail Nye',

  2. If(And(Contains(${Sager.Kundetype},'BtC'),Contains(${Sager.Type},'Eksisterende kunde'),Not(Contains(${Sager.Kilde},'Autobutler'))),'Retail Eksisterende',

  3. If(And(Contains(${Sager.Kundetype},'BtC'),Contains(${Sager.Type},'Ny kunde'),Contains(${Sager.Kilde},'Autobutler')),'AB - Nye',

  4. If(And(Contains(${Sager.Kundetype},'BtC'),Contains(${Sager.Type},'Eksisterende kunde'),Contains(${Sager.Kilde},'Autobutler')),'AB - Eksisterende',

  5. If(And(Contains(${Sager.Kundetype},'BtB'),Contains(${Sager.Type},'Ny kunde'),Not(Contains(${Sager.Kilde},'Autobutler'))),'BtB / Partners - Nye',

  6. If(And(Contains(${Sager.Kundetype},'BtB'),Contains(${Sager.Type},'Eksisterende kunde'),Not(Contains(${Sager.Kilde},'Autobutler'))),'BtB / Partners - Eksisterende',

  7. If(${Sager.Mekanikertilbud},'Mersalg',

  8. 'Fejl')))))))
Can you see where the error lies? It doesn't give an error, but just shows nothing in the field, when updating any of the mentioned fields.

I think it might have something to do with "not contains". Can this code be written somehow else?

Also; I need to put in that a checkbox is NOT marked (${Sager.Mekanikertilbud is a checkbox). So all lines should have that this checkbox is NOT marked, unless the last two lines, of course. Or; which statement has priority over the others? Should I just put the last statement first, and then it's not needed for the rest, basically? Same with the Autobutler in "kilde" - if they come first, then it might not be needed with "not contains"?

Please advise, and hopefully point me in the right direction regarding the code.