<?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: vbscript to split a name field into two separate fields in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vbscript-to-split-a-name-field-into-two-separate/m-p/70998#M843</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a table with a name field (where a name is like "John Smith") and I want to build a separate first_name and last_name fields. How can I populate each new field with just the first ("John) or last name ("Smith") using the original name field?&lt;BR /&gt;&lt;BR /&gt;I'm fine with 2 sep scripts I plug into the field calculator for each new field, unless someone wants to suggest another way.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You have to calculate each field separately.&amp;nbsp; Here are the two calculations you could use.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Split([Full_Name], " ")(0) ' Gets the first word&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Split([Full_Name], " ")(Ubound(Split([Full_Name], " "))) ' Gets the Last Word&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This really only works if the name is two words, but the code does not assume that.&amp;nbsp; You could include an if then statement to deal with the situation where Ubound(Split([Full_Name], " ")) is anything other than 1 to decide if the additional words belong to the first name, the middle name, the last name or a company name (which you would not normally split).&amp;nbsp; Technically if there is only one word in Full_Name then both functions will return that word (Ubound(Split([Full_Name], " ")) will equal 0).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Feb 2014 04:37:05 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2014-02-05T04:37:05Z</dc:date>
    <item>
      <title>vbscript to split a name field into two separate fields</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vbscript-to-split-a-name-field-into-two-separate/m-p/70997#M842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a table with a name field (where a name is like "John Smith") and I want to build a separate first_name and last_name fields. How can I populate each new field with just the first ("John) or last name ("Smith") using the original name field?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm fine with 2 sep scripts I plug into the field calculator for each new field, unless someone wants to suggest another way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 23:22:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vbscript-to-split-a-name-field-into-two-separate/m-p/70997#M842</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-02-04T23:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: vbscript to split a name field into two separate fields</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vbscript-to-split-a-name-field-into-two-separate/m-p/70998#M843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a table with a name field (where a name is like "John Smith") and I want to build a separate first_name and last_name fields. How can I populate each new field with just the first ("John) or last name ("Smith") using the original name field?&lt;BR /&gt;&lt;BR /&gt;I'm fine with 2 sep scripts I plug into the field calculator for each new field, unless someone wants to suggest another way.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You have to calculate each field separately.&amp;nbsp; Here are the two calculations you could use.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Split([Full_Name], " ")(0) ' Gets the first word&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Split([Full_Name], " ")(Ubound(Split([Full_Name], " "))) ' Gets the Last Word&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This really only works if the name is two words, but the code does not assume that.&amp;nbsp; You could include an if then statement to deal with the situation where Ubound(Split([Full_Name], " ")) is anything other than 1 to decide if the additional words belong to the first name, the middle name, the last name or a company name (which you would not normally split).&amp;nbsp; Technically if there is only one word in Full_Name then both functions will return that word (Ubound(Split([Full_Name], " ")) will equal 0).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 04:37:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vbscript-to-split-a-name-field-into-two-separate/m-p/70998#M843</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-02-05T04:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: vbscript to split a name field into two separate fields</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vbscript-to-split-a-name-field-into-two-separate/m-p/70999#M844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Never thought of using Unbound. But I like it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A couple other methods.&amp;nbsp; export a unique identifier along with the full name field to a .csv&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;in word open the .csv and replace all spaces with a tab.&amp;nbsp; Save the .csv&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;open it in excel.&amp;nbsp; update the column names.&amp;nbsp;&amp;nbsp; i.e. last and first names.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now here you can error check for those names that may have a middle name or more than 2 words in the name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ideally you would end up with 3 columns.&amp;nbsp; You can sort the 4th column and quickly see it there is anything there and fix it if there is.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;open the .csv back in ArcGIS and join the unique identifiers up and update your feature with first and last.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Method 2.&amp;nbsp; Create your first and last name fields. Assuming your field is called [FirstLast] and you want it split to [First] and [Last]&amp;nbsp; I was going to give a fancy instring command but I would suggest using the unbound from the previous example to get the first part.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then for the second attribute&amp;nbsp; mid([firstlast],((len([first])+1),100)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will populate the [last] field with a string beginning at the character after the space and fill it in with the next 100 characters.&amp;nbsp; If you [firstlast] field has entries longer than 100 characters then just make the number longer, won't hurt anything.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a table with a name field (where a name is like "John Smith") and I want to build a separate first_name and last_name fields. How can I populate each new field with just the first ("John) or last name ("Smith") using the original name field?&lt;BR /&gt;&lt;BR /&gt;I'm fine with 2 sep scripts I plug into the field calculator for each new field, unless someone wants to suggest another way.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 11:40:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vbscript-to-split-a-name-field-into-two-separate/m-p/70999#M844</guid>
      <dc:creator>RobertBorchert</dc:creator>
      <dc:date>2014-02-05T11:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: vbscript to split a name field into two separate fields</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vbscript-to-split-a-name-field-into-two-separate/m-p/71000#M845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you both - both of your suggestions work great! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 15:27:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vbscript-to-split-a-name-field-into-two-separate/m-p/71000#M845</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-02-05T15:27:46Z</dc:date>
    </item>
  </channel>
</rss>

