I am having problems with label expression in ArcMap 10.2.1.

I want to show two labels per polygon, but only when there are two labels to show. Every polygon has at least one label (Veg_Dominant), but some polygons also have a second (Veg_codominant). I want polygons with only one label to show this one label, and polygons with two labels to show both with a '+' sign in between.

This is how I entered it in the label expression:

enter image description here

This is how it looks in the map:

enter image description here

is there a way to only show the '+' sign when there is more than one label to show?

  • Click on Help in the lower middle of your label expression dialog. The If-Else statement is one of the examples there.
    – Matte
    Commented Nov 20, 2018 at 10:58

3 Answers 3


In the Label Expression, switch to "advanced", select VBScript as Parser, and paste this code:

Function FindLabel ( [veg_dominant] , [veg_codominant]  )
if [veg_codominant] <> " " then
  FindLabel = [veg_dominant] + "+" + [veg_codominant]
 FindLabel = [veg_dominant]
end if
End Function

This expression means: if veg_codominant has values, then the label will be field1+field2, otherwise if the field is empty, use only field1 as the label


Here is the Python version after selecting advanced in Label Expression:

def FindLabel ( [veg_dominant] , [veg_codominant]):
    if [veg_codominant] != ' ':
        return [veg_dominant] + "+"+ [veg_codominant]
        return [veg_dominant] 

I think the most pythonic way of doing this is to use filter and str.join built-in methods, which lets you to add as many fields as you like without worrying about putting delimiters in between and checking if the value is False, for example:

def FindLabel ([veg_dominant], [veg_codominant]):
    return  "+".join(filter(None, ([veg_dominant], [veg_codominant])))

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.