views:

170

answers:

1

I'm creating a "one-period" financial model in Excel - that is, a model where the formulas are consistent in each column, so you can copy/paste/extend them as desired.

I'm breaking out the model's assumptions into a separate sheet. For instance, I have a cell named monthly_sales; that's how many new customers I add each month. The formulas then look like this:

Assumptions sheet 1.0

      A             B                  
1 | Monthly sales | 6                 |

Projections sheet 1.0

     A               B     C                   D                   E                  
1 |               |     | August 2009       | September 2009    | October 2009
2 | # Customers   |     | =B2+monthly_sales | =C2+monthly_sales | =D2+monthly_sales

So in August, I'll have 6 customers; in September, 12 customers; in October, 18 customers. So far, so good. But my earliest customers will need more development resources, right? I'd better add some limits.

Assumptions sheet 2.0

      A                       B                  
1 | Monthly sales           | 6                 |
2 | Early customers         | 3                 |
3 | Early dev cycle, months | 2                 |

In English: The first 3 customers will each take 2 months of development time. From August to November, I have 1 customer. In December, I add a second customer, and in April, a third. By August 2010, I'm through the early_customers, and then I can start growing by 6 per month.

I know how to do this with VBA; I can write a user-defined function that checks previous months, and I change the # Customers formula to something like

=B2+min(max_customers_this_month(),monthly_sales)

But I suspect there's some way to represent this concept declaratively in a proper Excel formula. Is there?

+1  A: 

There's probably a more concise way to do this, but here's a solution. Enter 1 into B2 and the following into C2 (and copy into the following columns):

=IF(
    B2 > Early_customers,
    B2 + Monthly_sales,
    IF(
       OR(
          C1 - $B1 < Early_dev_cycle,
          OFFSET(B2, 0, MAX(-Early_dev_cycle + 1, $B1 - B1)) <> B2 
         ),
       B2,
       B2 + IF(
               B2 < Early_customers,
               1,
               Monthly_sales
              )
      )
   )

Note that this solution assumes that Row 1 is populated with numbers for the months instead of with dates. To use dates, you'll have to use something more sophisticated than simple subtraction for the two subtractions in the OR clause that involve $B1.

MOE37x3
Thanks - that works! (And thanks for pointing out the bugs in my example.)I've been trying to refactor this to understand *why* it works; I don't quite get the intent of each expression, especially the OR'd expressions. If you composed it from smaller named expressions, I'd love to know what the names were; otherwise, don't worry about it.
Jay Levitt