Formula field using nested IF and OR

Formula field using nested IF and OR

Hi. I have a formula problem:

Because of the limit of 1000 and the fact you can't calculate a field from data in another calculated field, I have too many characters in my formula if I just use a series of nested IF functions. What I want to achieve is this:


IF field INSCO contains 'A', return the result of field PREM*0.15
IF field INSCO contains 'B', return the result of field PREM*0.25
IF field INSCO contains 'C' OR 'D', return the result of field PREM*0.3
IF field INSCO contains something else, return the result of filed PREM*0.2



(there are many more options, and a further calculation at the end, hence reaching the 1000 character limit!)  

It all worked fine when I just used the nested IF functions for a single content of INSCO as int he first two lines above, but now I need to add more options so need to combine some with the OR function.


It all looks fine, but I keep getting an error saying its missing braces. I am sure I have closed out all the nested IF's at the end, and cant see where any other might belong. Can anyone spot where they are missing please!  Or have I done this formula completely wrong?


Here is my formula so far (I've laid it out in lines for clarity only)

-------------------------------------------------------------------------------------------------------------------

If(Contains(${Potentials.InsCo},'OIM'),(${Potentials.Prem }*.275 ),

If (OR ( (Contains(${Potentials.InsCo},'Gresham Comm'),(Contains(${Potentials.InsCo},'HCC') ) ,(${Potentials.Prem )*.175 ),

If(OR((Contains(${Potentials.InsCo},'Thistle'),(Contains(${Potentials.InsCo},'OIM Comm')),(${Potentials.Prem }*.15),

If(Contains(${Potentials.InsCo},'Rock'),(${Potentials.Prem }*.25 ),

If(Contains(${Potentials.InsCo},'Aviva'),(${Potentials.Prem }*.3 ),

If(OR((Contains(${Potentials.InsCo},'Gresham Property Owners'),(Contains(${Potentials.InsCo},'ARUS')),(${Potentials.Prem }*.225 ),

If(Contains(${Potentials.InsCo},'Specialist Comm'),(${Potentials.FEE}), 

(${Potentials.Prem}*.2)))))))))  

-----------------------------------------------------------------------------------------------------------------------------------

Many thanks for any input!