0

How to use this formula in field calcultor in ArcMap. for example: A = Field1 B = Field2

  if A =<B
      C = B
  else:
      C = A
Mumtaz Ali
  • 31
  • 5

1 Answers1

2

@Vince is right and this could be solved using the max(!A!, !B!) expression. However, if you had a more complex situation you could use a custom function. In Arcmap you can write a function on the code block space and then call it where you usually write the expression.

Your function (code block) could look something like:

my_function(field1_value, field2_value):
    if field1_value <= field2_value:
        return field2_value
    else:
        return field1_value

Then you can call it using the following expression:

my_function(!A!, !B!)

Of course, you need to specify Python as the parser.

Marcelo Villa
  • 5,928
  • 2
  • 19
  • 38