excel vba ternary code example Example: excel vba ternary Sub condition() temp = 15 msgbox IIf(temp >= 20, "hot", "cold") End Sub