1
votes

Using the following examples:

Main sheet:

+----------+-----+
|    A     |  B  |
+----------+-----+
|  Value1  |  3  |
|  Value2  |  0  |
|  Value3  |  1  |
|  Value4  |  2  |
+----------+-----+

RangeA: (Column A is identical to that of the main sheet)

+----------+-------+---------+
|    A     |   B   |    C    |
+----------+-------+---------+
|  Value1  |  ...  |  Type1  |
|  Value2  |  ...  |  Type2  |
+----------+-------+---------+

RangeB:

+---------+-------+--------+
|  Type1  |  5    |  20    |
|  Type2  |  20   |  100   |
|  Type3  |  100  |  400   |
|  Type4  |  400  |  1600  |
+---------+-------+--------+

I have a formula that returns an integer value for each row on the main sheet:

=MAX(0, B - 2) * VLOOKUP(VLOOKUP(A, RangeA, 3, FALSE), RangeB, 2)

So if run on the first row, the value of 5 is returned. On the second row, 0, and so on.

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 ARRAYFORMULA but have had no luck.

I would appreciate any help.

1
@I'-'I Edited to describe the formula a bit more. The desired output was already in the question.Spedwards
@I'-'I A single number. The desired output is a single number. I want to somehow iterate over all the rows, run the formulae, and get the sum of the result, all in a single cell, if it's even possible.Spedwards
@I'-'I I've gone into more detail. This is the best I can do.Spedwards
@pnuts that link is removed nowtehhowch

1 Answers

1
votes
=SUMPRODUCT(IFERROR(TEXT(B3:B7-2,"0;\0")*VLOOKUP(VLOOKUP(A3:A7,RangeA!A1:C5,3,0),RangeB!A1:C4,2)))
  • TEXT to ignore negative numbers
  • SUMPRODUCT to sum array.