Hello,

I am trying to create a function that populates a worksheet with a list of various permutations of a "Total" number.

I have the following fields

The only known entity is TOTAL = A + B + C
Total (T) will be a number from 1 to 30
Variable (A) must be at least 1 and can be equal to Total
Variable (B) and (C) can be 0 or any numbers added to VariableA to equal Total
This is an example of the result I am looking to achieve, but (T) must go all the way to 30, with all the possible permutaions of A + B + C.

T A B C
1 1 0 0
2 2 0 0
2 1 1 0
2 1 0 1
3 3 0 0
3 2 1 0
3 2 0 1
3 1 2 0
3 1 1 1
3 1 0 2
etc


Any help in the right direction would be much appreciated.

Many thanks


Paul