I have the following formula in a spreadsheet:

PHP:

`=IF(A6=Controls!$B$3,IF(AD6="CLEAR","CLEAR",IF(AND($AB$5>="5",$AB$5<="6",MyB!$J$2=0,$AA$5="0:0"),"BACK",IF(AND($AB$5>="10",$AB$5<="11",MyB!$J$2=1,$AA$5="0:0"),"BACK",IF(AND($AB$5>="15",$AB$5<="16",MyB!$J$2=2,$AA$5="0:0"),"BACK",IF(AND($AB$5>="20",$AB$5<="21",MyB!$J$2=3,$AA$5="0:0"),"BACK",IF(OR($AA$5<>"0:0",$AC$5="HT"),"LAY")))))),"")`

I am trying to amend the final IF to the following but cannot integrate it correctly. Can anyone offer any tips?

PHP:

`=IF(AND(AE6="SETTLED",OR($AA$5<>"0:0",$AC$5="HT")),"LAY")`

Thank you