calculate total bad formula