<?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: Compare two fields and replace certain values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Compare-two-fields-and-replace-certain-values/m-p/1222172#M624384</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you share the script/sample to show what you are doing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Dec 2016 15:30:10 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-12-07T15:30:10Z</dc:date>
    <item>
      <title>Compare two fields and replace certain values</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-two-fields-and-replace-certain-values/m-p/1222171#M624381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a table with Customers and Customer IDs. The problem is that about 4 or 5 of these Customers are listed in a dataset with the parent Customer and we need to break it up by state and replace the Parent Customer ID with the Child Customer ID based on the state.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example of Child-Parent relationship&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); border-image: none; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Parent Customer ID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Parent Customer State&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Child Customer ID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Child Customer State&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1233&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Georgia&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1534&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Georgia&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1233&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;California&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1635&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;California&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1233&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Maine&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1936&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Maine&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is only correct for a select number of states, so I created an Excel file that has the ParentID, the State and the New Child ID I want to change the Parent ID to for those specific customers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe I know the way to fix this, but I keep getting weird results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I create a key in the First table and the Fix Excel document, that shows the ParentID and State. I use that key to join the two tables and compare them, and if the Keys match then replace the key with the new key, if not, then keep the original.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure it is doing this in the most efficient way though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone else has had this issue and has any ideas or tricks that worked for them, any help would be greatly appreciated! Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 15:28:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-two-fields-and-replace-certain-values/m-p/1222171#M624381</guid>
      <dc:creator>crystles</dc:creator>
      <dc:date>2016-12-07T15:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two fields and replace certain values</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-two-fields-and-replace-certain-values/m-p/1222172#M624384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you share the script/sample to show what you are doing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 15:30:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-two-fields-and-replace-certain-values/m-p/1222172#M624384</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-12-07T15:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two fields and replace certain values</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-two-fields-and-replace-certain-values/m-p/1222173#M624386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;There is a lot of script that goes before this to get the list of original customers, but here is the section that adds the keys and then compares them.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;//*************************************************************************&lt;BR /&gt; // add key to main table &lt;BR /&gt; //*************************************************************************&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;SalesTrans2:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;LOAD&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; *,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;STATE_ABBREV&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &amp;amp;'-'&amp;amp; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CU_PARENTBP&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerKey_Org&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Resident&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; SalesTrans_Units&lt;BR /&gt; ;&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;DROP&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Table&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; SalesTrans_Units; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;//*************************************************************************&lt;BR /&gt; //Add key from Dealer Fix Excel document&lt;BR /&gt; //*************************************************************************&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Left&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Join&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (SalesTrans2)&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;LOAD&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;StateName&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;FIX_StateName&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;StateID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;FIX_StateID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DISTRIBUTOR_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;OLD_DealerID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DISTRIBUTOR_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CU_PARENTBP&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;NEW_DealerID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;StateID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &amp;amp; '-'&amp;amp; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DISTRIBUTOR_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerKey_NewFix&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt; POLK_MAP_DealerFix.xlsx&lt;BR /&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;ooxml&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;embedded&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;labels&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;is&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; BossUnits); &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;//*************************************************************************&lt;BR /&gt; //Compare and replace dealers based on the Dealer Fix excel doc&lt;BR /&gt; //*************************************************************************&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;SGM_2:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;LOAD&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; *,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerKey_NewFix&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerKey_Org&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;NEW_DealerID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ORG_DealerID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerID_FINAL&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerKey_NewFix&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerKey_Org&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerKey_NewFix&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerKey_Org&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerKey_FINAL&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerKey_NewFix&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DealerKey_Org&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;FIX_StateID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;STATE_ABBREV&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;StateID_FINAL&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Resident&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; SalesTrans2;&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;DROP&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Table&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; SalesTrans2; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 15:46:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-two-fields-and-replace-certain-values/m-p/1222173#M624386</guid>
      <dc:creator>crystles</dc:creator>
      <dc:date>2016-12-07T15:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two fields and replace certain values</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-two-fields-and-replace-certain-values/m-p/1222174#M624389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you describe your expected result given your provided sample data?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2016 00:10:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-two-fields-and-replace-certain-values/m-p/1222174#M624389</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2016-12-12T00:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two fields and replace certain values</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-two-fields-and-replace-certain-values/m-p/1222175#M624390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found out what the issue was. I'll try to explain as clearly as I can, in case someone else has this issue and comes across this post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my code I had a list of Dealers, all the Parent Dealers. But for about 5 Dealers, who showed up with different Dealer States but the same DealerID, we needed to break these out and use the Child DealerID instead to be able to differentiate between them. To do this, I have an Excel document that I add a new field that only relates to the Full list by these 5 dealers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So essentially I have a field with the full list of dealers, and I add a field with only the 5 dealers I need changed, by a key that connects them to the specific 5 dealers, and the rest of the records in that field are blank. This is where my problem was, because my formula did not address all the blank records in my new field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I changed my formula. Instead of looking for where the new field matched one of the DealerIDs in my full field, I just checked when the record was blank. If the record is blank, use the Original DealerID, if the field is NOT blank, then use the new DealerID provided in the new field. This fixed my issues with the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the final script I used in my document. Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//*************************************************************************&lt;/P&gt;&lt;P&gt;// add key to main table now that state and customer have been joined/added&lt;/P&gt;&lt;P&gt;//*************************************************************************&lt;/P&gt;&lt;P&gt;SalesTrans2:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;&amp;nbsp; STATE_ABBREV &amp;amp;'-'&amp;amp; CU_PARENTBP as DealerKey_Org&lt;/P&gt;&lt;P&gt;Resident SalesTrans_Units&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP Table SalesTrans_Units;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//*************************************************************************&lt;/P&gt;&lt;P&gt;//Add key from Dealer Fix Excel document&lt;/P&gt;&lt;P&gt;//*************************************************************************&lt;/P&gt;&lt;P&gt;Left Join (SalesTrans2)&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;// StateName as FIX_StateName, &lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StateID as FIX_StateID, &lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISTRIBUTOR_ID as OLD_DealerID, &lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DealerID as NEW_DealerID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StateID &amp;amp; '-'&amp;amp; DISTRIBUTOR_ID as DealerKey_Org,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StateID &amp;amp;'-'&amp;amp; DealerID as DealerKey_NewFix&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[..\..\01. Repository\99. External\data\POLK_MAP_DealerFix.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is BossUnits);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP Fields CU_PARENTBP, STATE_ABBREV;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//*************************************************************************&lt;/P&gt;&lt;P&gt;//Compare and replace dealers based on the Dealer Fix excel doc&lt;/P&gt;&lt;P&gt;//*************************************************************************&lt;/P&gt;&lt;P&gt;SGM_2:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(Len(trim(DealerKey_NewFix)) = 0,DealerKey_Org, DealerKey_NewFix) as DealerKey_FINAL&lt;/P&gt;&lt;P&gt;Resident SalesTrans2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP Table SalesTrans2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP Fields DealerKey_Org, DealerKey_NewFix;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2016 14:50:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-two-fields-and-replace-certain-values/m-p/1222175#M624390</guid>
      <dc:creator>crystles</dc:creator>
      <dc:date>2016-12-14T14:50:14Z</dc:date>
    </item>
  </channel>
</rss>

