Hi,
I am new to excel VBA programming, but had to build an oil production profile. I came up with the following and it works ok:
-------------------------------------------------------------------------------------
Public Function Prod(Time, Rate, Startup, Rampup, Plateau, Decline)

Application.Volatile
If Time < Startup Then
Prod = 0
ElseIf Time < Startup + Rampup Then
Prod = (Time - Startup) / Rampup
ElseIf Time < Startup + Rampup + Plateau Then
Prod = 1
Else
Prod = (1 - Decline) ^ (Time - (Startup + Rampup + Plateau))
End If
Prod = Prod * Rate

End Function
-----------------------------------------------------------------------------

However, in order to automate my Capex and Opex in that profile I will also need to use VBA for that. My Opex has to always start when my production starts (in same year). And, Capex also starts by few years earlier than my production. There should be a difference between Opex and Capex as well in several percents (e.g. 5%). I would really appreciate your help in solving this problem.