<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic If/Then statement in Model Builder in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/if-then-statement-in-model-builder/m-p/201707#M6884</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For this new field &lt;C&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the value of an existing field &lt;A&gt; is greater than 75 &lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then the value for this new field &lt;C&gt; should be 1&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the value of an existing field &lt;A&gt; is less than 75&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then the value for this new field &lt;C&gt; should be 0&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I have added another field and I would like the field to be populated like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the value of the existing field &lt;C&gt; is 1, take the value from the existing field &lt;B&gt;&lt;/B&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the value of the existing field &lt;C&gt; is 0, take the value from the existing field &lt;D&gt;&lt;/D&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Aug 2012 19:18:06 GMT</pubDate>
    <dc:creator>AshleighTurner1</dc:creator>
    <dc:date>2012-08-01T19:18:06Z</dc:date>
    <item>
      <title>If/Then statement in Model Builder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/if-then-statement-in-model-builder/m-p/201707#M6884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For this new field &lt;C&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the value of an existing field &lt;A&gt; is greater than 75 &lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then the value for this new field &lt;C&gt; should be 1&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the value of an existing field &lt;A&gt; is less than 75&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then the value for this new field &lt;C&gt; should be 0&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I have added another field and I would like the field to be populated like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the value of the existing field &lt;C&gt; is 1, take the value from the existing field &lt;B&gt;&lt;/B&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the value of the existing field &lt;C&gt; is 0, take the value from the existing field &lt;D&gt;&lt;/D&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Aug 2012 19:18:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/if-then-statement-in-model-builder/m-p/201707#M6884</guid>
      <dc:creator>AshleighTurner1</dc:creator>
      <dc:date>2012-08-01T19:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: If/Then statement in Model Builder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/if-then-statement-in-model-builder/m-p/201708#M6885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000004s000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Calculate Field Examples&lt;/A&gt;&lt;SPAN&gt; help article should give you some ideas.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This example comes from that page:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Expression:
density

Expression Type:
VB

Code Block:
Dim density
If [POP90_SQMI] &amp;lt; 100 Then
density = "low"

elseif [POP90_SQMI] &amp;lt; 300 Then
density = "medium"

else
density = "high"
end if&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:01:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/if-then-statement-in-model-builder/m-p/201708#M6885</guid>
      <dc:creator>LucasDanzinger</dc:creator>
      <dc:date>2021-12-11T10:01:41Z</dc:date>
    </item>
  </channel>
</rss>

