title: Excel VBA - Summing up different items
body: <p>Ppl</p>
  
  <p>I have data like:</p>
  
  <pre><code>ID | Country
  1  | DE
  1  | GB
  2  | DE
  2  | DE
  3  | GB
  </code></pre>
  
  <p>After using my macro, I have the following data:</p>
  
  <pre><code>1 | DE;GB
  2 | DE
  3 | GB
  </code></pre>
  
  <p>What I like to have, is:</p>
  
  <pre><code>1 | DE(1);GB(1)
  2 | DE(2)
  3 | GB(1)
  </code></pre>
  
  <p>I am not sure how my code is able to do the sums, could you help me with my request?</p>
  
  <p>Attached my code:</p>
  
  <pre><code>Public Sub Calc()
  
  Z = 2
  z2 = 1
  
  Do Until Cells(Z, 5).Value = ""
  
  
      If Cells(Z, 5).Value &lt;&gt; Kunde_Alt Then
          z2 = z2 + 1
          Cells(z2, 9).Value = Cells(Z, 5).Value
      End If
  
      s = 10
      Land = Cells(Z, 6).Value
      Gef = False
      Do Until Cells(z2, s).Value = ""
  
          If Cells(z2, s).Value = Land Then
              Gef = True
              Exit Do
          End If
  
          s = s + 1
      Loop
  
      If Gef = False Then
          Cells(z2, s).Value = Land
      End If
  
  
  Kunde_Alt = Cells(Z, 5).Value
  Z = Z + 1
  Loop
  
  End Sub
  </code></pre>