If a setoff established at the trial, exceeds the plaintiff's demand so established, judgment for the defendant shall be given for the excess; or if it appears that the defendant is entitled to any affirmative relief, judgment shall be given accordingly.