title: Performance alternative over Scripting.Dictionary
body: <p>I am coding a Manager in Excel-VBA with several buttons.</p>
  
  <p>One of them is to generate a tab using another Excel file (let me call it <code>T</code>) as input.</p>
  
  <p>Some properties of <code>T</code>:</p>
  
  <ul>
  <li><code>~90MB</code> size</li>
  <li><code>~350K</code> lines</li>
  <li>Contains <strong>sales</strong> data of the last <code>14</code> months (unordered).</li>
  <li>Relevant columns:
  
  <ul>
  <li><code>year/month</code></li>
  <li>total-money</li>
  <li>seller-name</li>
  <li>family-product</li>
  <li>client-name</li>
  </ul></li>
  <li>There is not id columns (like: cod-client, cod-vendor, etc.)</li>
  </ul>
  
  <p>Main relation:</p>
  
  <ul>
  <li>Sellers sells many Products to many Clients</li>
  </ul>
  
  <p>I am generating a new Excel tab with data from <code>T</code> of the last <code>year/month</code> grouped by Seller.</p>
  
  <p>Important notes:</p>
  
  <ul>
  <li><code>T</code> is the only available input/source.</li>
  <li>If two or more Sellers sells the same Product to the same Client, the <code>total-money</code> should be counted to all of those Sellers.</li>
  </ul>
  
  <hr>
  
  <p>This is enough, now you know what I have <strong>already coded</strong>.</p>
  
  <p>My code works, <strong>but</strong>, it takes about 4 minutes of runtime.</p>
  
  <p>I have already coded some other buttons using smaller sources (not greater than <code>2MB</code>) which runs in 5 seconds.</p>
  
  <p><em>Considering <code>T</code> size, 4 minutes runtime could be acceptable</em>.</p>
  
  <p>But I'm not proud of it, at least not yet.</p>
  
  <hr>
  
  <p>My code is mainly based on <code>Scripting.Dictionary</code> to map data from <code>T</code>, and then I use <code>for each key in obj ... next key</code> to set the grouped data to the new created tab.</p>
  
  <p>I'm not sure, but here are my thoughts:</p>
  
  <ul>
  <li>If <code>N</code> is the total keys in a <code>Scripting.Dictionary</code>, and I need to check for <code>obj.Exists(str)</code> before aggregating <code>total-money</code>. It will run <code>N</code> string compares to return <code>false</code>.</li>
  <li>Similarly it will run maximun <code>N</code> string compares when I do <code>Set seller = obj(seller_name)</code>.</li>
  </ul>
  
  <hr>
  
  <p>I want to be wrong with my thoughts. But if I'm not wrong, my next step (and last hope) to reduce the runtime of this function is to <em>code my own class object</em> with <a href="https://en.wikipedia.org/wiki/Trie" rel="nofollow noreferrer"><code>Tries</code></a>.</p>
  
  <p>I will only start coding tomorrow, what I want is just some confirmation if I am in the right way, or some advices if I am in the wrong way of doing it.</p>
  
  <p>Do you have any suggestions? Thanks in advance.</p>