AnsweredAssumed Answered

Comparing multiple fields to each other within one feature class using Python?

Question asked by dmensah2 on Apr 11, 2018
Latest reply on Apr 12, 2018 by bixb0012



So I have a feature class of 5 fields that I'm looking at. I'm looking to compare 4 fields to 2 other fields. Essentially, if any of the first 4 fields match to the other 2 fields then I want to return a "YES" in a new field. If none of the 4 fields match the 2 fields, then I want to return a NO. I started typing this out in the field calculator, but I'm unsure if this is the most efficient method.


I'm a beginner at python, so here is my code below:


def TextValue(MATCH):
  if !JURIS! or !MGMT1! or !MGMT2! or !MGMT3! == !EDC_MGMT! or !EDC_JURIS!:
    return = "YES"
    return = "NO"

Am I going about this the right way? Let me know if my question should be clarified.