added else conditional and changed formula to split into two formulas.