I need to apply two conditions which would validate or restrict entry in a cell
Example:

A whole number can be entered in cells A10 to A20
The sub total is calculated in cell A21
The highest number allowed in any cell (A10-A20) is 3
As soon as the sub-total (in A21) exceeds 20, any entry in subsequent cells is denied.

I have applied a data validation check for the first condiotion, which works. when I try to apply an "IF" formula to check for the subtotal condition, it gives me a "circular error"
Help