In allowing a claim the personal representative may deduct any counterclaim which the estate has against the claimant. In determining a claim against an estate a court shall reduce the amount allowed by the amount of any counterclaim and, if the counterclaims exceed the claim, render a judgment against the claimant in the amount of the excess. A counterclaim, liquidated or unliquidated, may arise from a transaction other than that upon which the claim is based. A counterclaim may give rise to relief exceeding in amount or different in kind from that sought in the claim.
SDCL 29A-3-811