This VBA macro script for Excel provides various distribution models for forecasting purposes. Simply provide a target number and specify the desired number of steps in the formula. The script allows you to apply different mathematical models to change the distribution.
All the numbers at each step will add up to the the 'goal' you provided. When expressed as a percentage the percentage of each 'step' will add up to 100%.
Note - there is also a verion for Google Sheets, which you can find here: https://github.com/multiplicit-com/Google-Sheets-Number-Distribution-AppScript-formula
The script currently supports the following distribution models:
- Linear Distribution: Equally distributes the target value across all months.
- Logarithmic Distribution: Distributes the target value such that the values start low and increase gradually.
- Exponential Distribution: Distributes the target value such that the values start low and increase rapidly.
- Normal Distribution: Distributes the target value according to a normal distribution curve, peaking in the middle.
- Quadratic Distribution: Distributes the target value such that the values start low and increase sharply towards the end, creating a "ski jump" shape.
To use the VBA script, follow these steps:
- Open your Excel workbook.
- Press
Alt + F11
to open the VBA editor. - Insert a new module by going to
Insert
>Module
. - Copy and paste the VBA code from this repository into the module.
Make sure the excel workbook is saved in the '.xlsm' file format, or it won't support VBA macros.
Once installed, the DistributeGoal function can be called like any excel formula.
VBA declaration: DistributeGoal(DistributionType As String, TotalMonths As Integer, CurrentPosition As Integer, Target As Double) As Double
-
DistributionType: the type of distribution model to apply to the target number. The accepted distribution types are:
- linear
- logarithmic
- exponential
- normal
- quadratic
-
TotalMonths: The total number of months to distribute the goal across.
-
CurrentPosition: The current position in the month range.
-
Target: The goal value to be distributed.
Logarithmic distribution over 7 steps, show position 1:
=DistributeGoal("logarithmic", 7, 1, $A$8)
quadratic distribution over 9 steps, show position 8:
=DistributeGoal("quadratic", 9, 8, $A10)