Where a counterclaim is established which equals the plaintiff's demand, the judgment must be in favor of the defendant. Where it is less than the plaintiff's demand, the plaintiff must have judgment for the residue only. Where it exceeds the plaintiff's demand, the defendant must have judgment for the excess.
§ 25-31-907, MCA