May be this...

=IF(Z2="Null",IF(OR(T2={"Awaiting Assesment","Referred"}),$AL$1-AE2,"A"),Z2-AE2)