title: How to merge rows together where there are more than one columns that share the same value?
body: <p>I have to group information together with VBA in Excel where if there are any duplicate values in <strong>Big Group column &amp; Sub Group column</strong> the rows will then be combine into one row.</p>
  
  <p>This is how the table looks like:</p>
  
  <pre><code>|Big Group|Sub Group| Animals
  ------------------------------
  | A1      | a       | raccoon     
  ------------------------------
  | B2      | b       | dog
  ------------------------------
  | B2      | c       | tiger
  ------------------------------
  | B2      | c       | lion
  ------------------------------
  | A1      | d       | deer
  ------------------------------
  | A1      | a       | bear
  ------------------------------
  </code></pre>
  
  <p>I want to combine the rows to be like this:</p>
  
  <pre><code>|Big Group|Sub Group| Animals
  -----------------------------------
  | A1      | a       | raccoon; bear
  -----------------------------------
  | B2      | b       | dog
  -----------------------------------
  | B2      | c       | tiger; lion
  -----------------------------------
  | A1      | d       | deer
  -----------------------------------
  </code></pre>
  
  <p>I have tried using this macro code. it worked, but my only problem with it is that it only combines the row if they are right next to each other:</p>
  
  <pre><code>Sub combi()
  Dim i As Long
  lastRow = 7
  
  For i = lastRow To 2 Step -1
      If Cells(i, 2).Value = Cells(i - 1, 2).Value Then
          Cells(i - 1, 3).Value = Cells(i - 1, 3).Value &amp; ";" &amp; Cells(i, 3).Value
          Rows(i).Delete
      End If
  Next i
  End Sub 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/wb6JG.jpg" rel="nofollow noreferrer">Here is the table output with the macro above.</a> Can anybody suggest me a way to improve this macro? </p>
  
  <p>Thank you,<br>
  Roody</p>