title: Combine rows and sum values by unique identifiers vba excel
body: <p>I am in kind of a pickle :(</p>
  
  <p>I have the below data and the task is to identify the unique records and combine them summing the values.</p>
  
  <p>Let me explain, below is the data:</p>
  
  <p><a href="http://im80.gulfup.com/uDNyW7.png" rel="nofollow noreferrer">OrgData http://im80.gulfup.com/uDNyW7.png</a></p>
  
  <p>So the end result that I need to get is the data per visit of each client with total of the price and the item name to be kept as the first item:</p>
  
  <p><a href="http://im75.gulfup.com/PvkIWz.png" rel="nofollow noreferrer">EndData http://im75.gulfup.com/PvkIWz.png</a></p>
  
  <p>I have tried using a helper column which is a combination of the "Client ID" and the "Date"</p>
  
  <pre><code>For i = 1 to Lastrow
  Worksheets("Sheet1").Range("F" &amp; i).Value = Worksheets("Sheet1").Range("A" &amp; i).Value &amp; _
  Worksheets("Sheet1").Range("C" &amp; i).Value
  Next i
  </code></pre>
  
  <p>I then tried to copy the helper column to a temp sheet and remove duplicates and then for each of the remaining values I used autofilter by the helper column value and then summed the result of column D and wrote that to a new sheet.</p>
  
  <pre><code>Set rng = Sheet1.Range("D2:D" &amp; lastrow2)
  total = Application.WorksheetFunction.Sum(rng.SpecialCells(xlCellTypeVisible))
  </code></pre>
  
  <p>But given that my sheet has more than 60K + rows, it takes forever.</p>
  
  <p>I am sure that there is a better approach out there, but just can't think of any.</p>