<?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: Convert Excel formula to Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/convert-excel-formula-to-python/m-p/1075701#M61571</link>
    <description>&lt;P&gt;I think I figured it out, thank you for the help.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GISCityofPrinceAlbert_0-1625517092799.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/17750iBC46AD2629E5D57F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GISCityofPrinceAlbert_0-1625517092799.png" alt="GISCityofPrinceAlbert_0-1625517092799.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jul 2021 20:31:56 GMT</pubDate>
    <dc:creator>GISCityofPrinceAlbert</dc:creator>
    <dc:date>2021-07-05T20:31:56Z</dc:date>
    <item>
      <title>Convert Excel formula to Python</title>
      <link>https://community.esri.com/t5/python-questions/convert-excel-formula-to-python/m-p/1075664#M61568</link>
      <description>&lt;P&gt;Hello, I am fairly new to Python and just started working with ArcPro.&amp;nbsp; I have a solution for my problem working in an excel formula but would like to know how to get this to work in Code Block of Pro.&lt;/P&gt;&lt;P&gt;I have 2 fields; Location and Section.&amp;nbsp; My excel formula is this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;=IF((LEFT(A2,3)="RMS"),"",REPLACE(A2,1,1,B2))&lt;/P&gt;&lt;P&gt;A2 is location and B2 is Section.&amp;nbsp; So if the 1st 3 characters of the location = RMS then nothing else replace the first character with Section&lt;/P&gt;&lt;P&gt;The data looks like this&lt;/P&gt;&lt;TABLE width="441"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="174"&gt;Location&lt;/TD&gt;&lt;TD width="64"&gt;Section&lt;/TD&gt;&lt;TD width="203"&gt;Formula&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B - 18 - F - 1 - N.5&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;A - 18 - F - 1 - N.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;RMS - 18 - F - 1 - N.6&lt;/TD&gt;&lt;TD&gt;RMS&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been searching all over but just can't seem to figure it out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 16:58:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-excel-formula-to-python/m-p/1075664#M61568</guid>
      <dc:creator>GISCityofPrinceAlbert</dc:creator>
      <dc:date>2021-07-05T16:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Excel formula to Python</title>
      <link>https://community.esri.com/t5/python-questions/convert-excel-formula-to-python/m-p/1075665#M61569</link>
      <description>&lt;LI-CODE lang="python"&gt;def replace_(fld, val):
    """Replace a value if found"""
    if fld[:3] == val:
        return val
    else:
        return fld[:3]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;python expression&amp;nbsp;&lt;/P&gt;&lt;P&gt;replace_(!Location!, "RMS")&lt;/P&gt;&lt;P&gt;code block is above&lt;/P&gt;&lt;P&gt;However... you really don't say what you want to do it the Location field isn't really RMS ???&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 17:19:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-excel-formula-to-python/m-p/1075665#M61569</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-07-05T17:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Excel formula to Python</title>
      <link>https://community.esri.com/t5/python-questions/convert-excel-formula-to-python/m-p/1075672#M61570</link>
      <description>&lt;P&gt;Ideally I would like to update the location field and not create a new field. So if location starts with RMS then do nothing but if the 1st character in Location does not equal Section then update the 1st character in location to change to Section value.&amp;nbsp; Hopefully that makes sense. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 17:31:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-excel-formula-to-python/m-p/1075672#M61570</guid>
      <dc:creator>GISCityofPrinceAlbert</dc:creator>
      <dc:date>2021-07-05T17:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Excel formula to Python</title>
      <link>https://community.esri.com/t5/python-questions/convert-excel-formula-to-python/m-p/1075701#M61571</link>
      <description>&lt;P&gt;I think I figured it out, thank you for the help.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GISCityofPrinceAlbert_0-1625517092799.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/17750iBC46AD2629E5D57F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GISCityofPrinceAlbert_0-1625517092799.png" alt="GISCityofPrinceAlbert_0-1625517092799.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 20:31:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-excel-formula-to-python/m-p/1075701#M61571</guid>
      <dc:creator>GISCityofPrinceAlbert</dc:creator>
      <dc:date>2021-07-05T20:31:56Z</dc:date>
    </item>
  </channel>
</rss>

