I would like to do a simple calculation using VB script or Python. Here is a screenshot of my field calculator which continuously seems to run into errors. Basically for the SITE CLASS field I would like to assign all the ST as "Optimal", all the WT as "Subsuitable" and all the CT as "Unsuitable".enter image description here

  • 1
    Can you edit your post to include all the text in the Pre-Logic Script Code box? Right now it's getting cut off, so it is hard to see what you are currently doing. Commented Sep 8, 2021 at 12:58
  • 3
    (You should always try to add the code as text instead of screenshots of it, see: stackoverflow.com/help/minimal-reproducible-example)
    – Bera
    Commented Sep 8, 2021 at 13:21

1 Answer 1


I think you are mixing SQL, VB and python syntax. Use python parser and:


def reclass(siteclass):
    if 'ST' in siteclass:
        val = "Optimal"
    elif 'WT' in siteclass:
        val = "SubSuitable"
        val = "Unsuitable"
    return val

Call with



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.