There are a couple of things that needs to be assessed and analysed in details before making a recommendation.
So request you to raise a service request with Ariba Customer Support so that we can assist you with this further.
we did register a service request for this.
I think the field you want to use in the formula should have a numerical value. So, in your case, if the contract type is not maintained as a numerical value, then you may have to use a work around with the help of a custom field, say, HasContract with numerical value of either 0 or 1, that indicates no contract and having a contract, respectively.
Hope it helps.