I am new to using VBA/ Python and am trying to write an if/then code. In model builder, I am trying to write an If/Then statement for a newly created field. I want to populate the newly added field by stating the following in the Calculate Field tool:
For this new field If the value of an existing field is greater than 75 Then the value for this new field should be 1 If the value of an existing field is less than 75 Then the value for this new field should be 0
Also, I have added another field and I would like the field to be populated like this:
If the value of the existing field is 1, take the value from the existing field If the value of the existing field is 0, take the value from the existing field
I have searched the forums and cannot find anything to help me complete this task. Thank you in advance for any help or support you can provide.
Expression:
density
Expression Type:
VB
Code Block:
Dim density
If [POP90_SQMI] < 100 Then
density = "low"
elseif [POP90_SQMI] < 300 Then
density = "medium"
else
density = "high"
end if