Hi everyone,
Someone must have had this problem before and shed some light on it for me. I have a long formula that works fine when typed into the formula bar and works find if denote it as a formula in vba but does not work as an array formula in vba. I have tried splitting it and using the replace function but I just can't seem to make it work. Any idea what I am doing wrong???
This works in Cell P2:
This works in vba if I denote it as .Formula but not .FormulaArray:
AMAS
Someone must have had this problem before and shed some light on it for me. I have a long formula that works fine when typed into the formula bar and works find if denote it as a formula in vba but does not work as an array formula in vba. I have tried splitting it and using the replace function but I just can't seem to make it work. Any idea what I am doing wrong???
This works in Cell P2:
Code:
=IF(AND(D2:O2=""),"No RoB assessments performed",
IF(OR(CHOOSE({1,2,3,4,5,6},D2,F2,H2,J2,L2,N2)="no"),"HIGH",
IF(OR(CHOOSE({1,2,3,4,5,6},D2,F2,H2,J2,L2,N2)="High Risk"),"HIGH",
IF(OR(CHOOSE({1,2,3,4,5,6},D2,F2,H2,J2,L2,N2)="UNCLEAR"),"UNCLEAR",
IF(OR(CHOOSE({1,2,3,4,5,6},D2,F2,H2,J2,L2,N2)="Unclear Risk"),"UNCLEAR","LOW")))))
Code:
With Range("P" & A)
.Formula = "=IF(AND(RC[-12]:RC[-1]=""""),""No RoB assessments performed""," & Chr(10) & _
"IF(OR(CHOOSE({1,2,3,4,5,6},RC[-12],RC[-10],RC[-8],RC[-6],RC[-4],RC[-2])=""no""),""HIGH""," & Chr(10) & _
"IF(OR(CHOOSE({1,2,3,4,5,6},RC[-12],RC[-10],RC[-8],RC[-6],RC[-4],RC[-2])=""High Risk""),""HIGH""," & Chr(10) & _
"IF(OR(CHOOSE({1,2,3,4,5,6},RC[-12],RC[-10],RC[-8],RC[-6],RC[-4],RC[-2])=""UNCLEAR""),""UNCLEAR""," & Chr(10) & _
"IF(OR(CHOOSE({1,2,3,4,5,6},RC[-12],RC[-10],RC[-8],RC[-6],RC[-4],RC[-2])=""Unclear Risk""),""UNCLEAR"",""LOW"")))))"
End With