<?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 Re: Field Calculator: ignore NULL value in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/field-calculator-ignore-null-value/m-p/1477185#M45185</link>
    <description>&lt;P&gt;Wanted to chime in here 10 years later to note that if you're using arcpro and you switch to an arcade expression (instead of python) in the field calculator it'll successfully read the nulls as zeros. Some classic esri nonsense when I have a deadline to meet, but glad I tried that and wanted to share here.&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2024 18:47:37 GMT</pubDate>
    <dc:creator>vico</dc:creator>
    <dc:date>2024-05-22T18:47:37Z</dc:date>
    <item>
      <title>Field Calculator: ignore NULL value</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculator-ignore-null-value/m-p/485799#M27628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using a File Geodatabase and I want to calculate the sum of different coulms. like column5= [column1]+[column2]+[column3]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That works with the Field Calculator very well, but if there is a &amp;lt;Null&amp;gt;, then the result is also NULL.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to ignore the Null fields?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(I want to keep the field like they are, I don't want to overwrite them with '0')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for helping &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cheers Immanuel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 22:20:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculator-ignore-null-value/m-p/485799#M27628</guid>
      <dc:creator>ImmanuelWeber</dc:creator>
      <dc:date>2013-06-25T22:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator: ignore NULL value</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculator-ignore-null-value/m-p/485800#M27629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Immanuel,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you tried using an update cursor in python? You can write a simple script to update the column you want calculated. For example, I have a feature class with columns f1, f2, f3, and calc. F1, f2, and f3 have a mix of numbers and null values, and calc is the column that I want updated with the calculation of f1 + f2 +f3. Here is my simple python script to update these answers and skip null values. Note that the only value that gets changed is the "calc" value, and print statements are just used as reference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import the arcpy module
import arcpy

# Location of the feature class I want to update
fc = "C:\\Data\\NothingSpecial.gdb\\calc"

# Create a cursor using arcpy data access module
cursor = arcpy.da.UpdateCursor(fc,"*")

# For each row in the feature class:
for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "For row: "+str(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # row[2] is the idex position of the f1 column
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[2] &amp;lt;&amp;gt; None:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = row[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "x = %d" %(x)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # row[3] is the idex position of the f2 column
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[3] &amp;lt;&amp;gt; None:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y = row[3]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "y = %d" %(y)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # row[4] is the idex position of the f3 column&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[4] &amp;lt;&amp;gt; None:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z = row[4]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "z = %d" %(z)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Now use these values to calculate the "calc" column
&amp;nbsp;&amp;nbsp;&amp;nbsp; if x:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; calc = x
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "calc = %d" %(x)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if y:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; calc = calc + y
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "calc + y = %d" %(calc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if z:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; calc = calc + z
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "calc + z = %d" %(calc)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the calc column (row[5]) as the calculated value
&amp;nbsp;&amp;nbsp;&amp;nbsp; row[5] = calc

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Update the row with the new value for "calc"
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set all values back to 0 for the next row
&amp;nbsp;&amp;nbsp;&amp;nbsp; x=y=z=calc=0&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's a link for more information on using Update Cursors:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000014000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000014000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:24:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculator-ignore-null-value/m-p/485800#M27629</guid>
      <dc:creator>JillianPenney</dc:creator>
      <dc:date>2021-12-11T21:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator: ignore NULL value</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculator-ignore-null-value/m-p/1477185#M45185</link>
      <description>&lt;P&gt;Wanted to chime in here 10 years later to note that if you're using arcpro and you switch to an arcade expression (instead of python) in the field calculator it'll successfully read the nulls as zeros. Some classic esri nonsense when I have a deadline to meet, but glad I tried that and wanted to share here.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 18:47:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculator-ignore-null-value/m-p/1477185#M45185</guid>
      <dc:creator>vico</dc:creator>
      <dc:date>2024-05-22T18:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator: ignore NULL value</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculator-ignore-null-value/m-p/1589163#M45589</link>
      <description>&lt;P&gt;Thanks for the arcade tip- ignores all my null values and adds the fields that do have values- weird, but very helpful thanks!&lt;/P&gt;&lt;P&gt;Sum($feature.Jan,$feature.Feb,$feature.Mar,$feature.Apr,$feature.May,$feature.Jun,$feature.Jul,$feature.Aug,$feature.Sep,$feature.Oct,$feature.Nov,$feature.Decr)&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 21:07:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculator-ignore-null-value/m-p/1589163#M45589</guid>
      <dc:creator>JessicaTaylor</dc:creator>
      <dc:date>2025-02-25T21:07:04Z</dc:date>
    </item>
  </channel>
</rss>

