title: Iterate Over Rows & Sum Results
body: <p>Using the following examples:</p>
  
  <p>Main sheet:</p>
  
  <pre><code>+----------+-----+
  |    A     |  B  |
  +----------+-----+
  |  Value1  |  3  |
  |  Value2  |  0  |
  |  Value3  |  1  |
  |  Value4  |  2  |
  +----------+-----+
  </code></pre>
  
  <p>RangeA: (Column A is identical to that of the main sheet)</p>
  
  <pre><code>+----------+-------+---------+
  |    A     |   B   |    C    |
  +----------+-------+---------+
  |  Value1  |  ...  |  Type1  |
  |  Value2  |  ...  |  Type2  |
  +----------+-------+---------+
  </code></pre>
  
  <p>RangeB:</p>
  
  <pre><code>+---------+-------+--------+
  |  Type1  |  5    |  20    |
  |  Type2  |  20   |  100   |
  |  Type3  |  100  |  400   |
  |  Type4  |  400  |  1600  |
  +---------+-------+--------+
  </code></pre>
  
  <p>I have a formula that returns an integer value for each row on the main sheet:</p>
  
  <pre><code>=MAX(0, B - 2) * VLOOKUP(VLOOKUP(A, RangeA, 3, FALSE), RangeB, 2)
  </code></pre>
  
  <p>So if run on the first row, the value of 5 is returned. On the second row, 0, and so on.</p>
  
  <p>What I would like to do is get the sum of this formula run on all rows, in a single cell. I've attempted various methods using <code>ARRAYFORMULA</code> but have had no luck.</p>
  
  <p>I would appreciate any help.</p>