title: Check column if values differ between rows and insert number alternately
body: <p><strong>Excel-Table</strong></p>
  <pre><code>     |      A       |       B
  -----|--------------|-----------------
  1    |  Product_A   |   
  2    |  Product_A   |
  3    |  Product_A   |
  4    |  Product_B   |       1
  5    |  Product_C   |       2
  6    |  Product_C   |
  7    |  Product_D   |       1
  8    |  Product_E   |       2
  9    |  Product_E   |
  10   |  Product_E   |       
  11   |  Product_F   |       1
  12   |              |
  </code></pre>
  <p>In the above Excel table I have a list of different products in <code>Column A</code>. <br>
  A product can appear <strong>multiple times</strong>.</p>
  <p>Currently, I am using this <code>VBA</code> to check if a product in <code>Column A</code> switches between the <strong>current</strong> and the <strong>previous</strong> row. <br>
  If the products switch the number <code>1</code> is inserted in <code>Column B</code>.</p>
  <pre><code>Sub FilB()
  Dim N As Long
  N = Cells(Rows.Count, &quot;A&quot;).End(xlUp).Row
  Range(&quot;B2:B&quot; &amp; N).Formula = &quot;=IF(A2=A1,&quot;&quot;&quot;&quot;,1)&quot;
  End Sub
  </code></pre>
  <p>However, now I want to include the condition that if the <strong>previous</strong> inserted number was <code>1</code> the <strong>next</strong> number should be <code>2</code> and if the <strong>previous</strong> inserted number was <code>2</code> the <strong>next</strong> number should be <code>1</code>.</p>
  <p>How do I have to modify the <code>VBA</code> to achieve this?</p>