PDA

View Full Version : Help With Recursive Formula



Edoardo1985
06-10-2016, 03:05 AM
Hi all!

I've a problem with sum in VBA without having data area in Excel. I mean, I need to write a sum without having data, only the formula. I have to sum values that come from another formula in a recursive way. My purpose is to find a formula that give me a result starting from 3 numbers. I mean, I will insert the numerical value of this number and the formula give me back a result.

Thankyou for help.

Sincerely,

Edoardo

SamT
06-10-2016, 06:45 AM
=A1+B1+C1

=SUM(A1,B1,C1)

=SUM(A1:C1)

Edoardo1985
06-10-2016, 07:07 AM
thankyou very much for the reply but this is not what I need... :)

I need a way to write the summatory for a recursive formula... I don't know why I can't attach an image that probably explain in a better way my problem...

Thanks again,

Edoardo

SamT
06-10-2016, 07:12 AM
Need more details about the desired formula

Edoardo1985
06-10-2016, 07:34 AM
Ok I try to explain. I need to calculate the number of combination resulting from a particular formula. What I need inside this formula is the summatory. Maybe with a numerical example is easyer to understand. I have 3 kind of values, let's be number of men (n), age (j) and year of sport done in their life (i).

n= 10
j= 30
i= 7

I know that in this case the value that I need is given by sum of past values, i.e. the value when n=10, j=29, i=7 , n=10, j=29, i=8, n=10, j=29, i=6 and so on... I don't have this value but I have the formula for calculate each one of this. What I need is to write the summatory without having the numbers.

Thankyou very very much,

Edoardo

mdmackillop
06-10-2016, 10:12 AM
You can post a workbook using Go Advanced/Manage Attachments

Edoardo1985
06-13-2016, 12:15 AM
Ok, I'll attach an image.

Thankyou very much,

Edoardo

Edoardo1985
06-13-2016, 01:57 AM
Hi,
I'll attach a woorkbook. I try to explain what's my problem. As you can see in woorkbook I have a table in which I have 3 numbers: n, j ,i. We start from the fact that n is fixed. What I want to calculate is the number that appears in blanck cells. The result from i=1, i=n, j=0 and i=n-1 are known. The problem is that all the values inside depends on the previous ones. For example:
n=8
j=3
i=5 (i.e. n-3) let's be h=3 so i=n-h

is given from the sum of n=8, j=2, i=5 and the summatory for k=1 to h of (-1)^(k+1) * n=8, j=2, i =n-(h-k).

So my problem is to write this recursive formulas including the summatory on k.

Thanks a lot for help,

Edoardo

mdmackillop
06-13-2016, 04:07 PM
Sorry, I'm no mathematician and have no idea what function you are using to create the results you show or how they are recursive. Can you substitute formulae for the constants?

Edoardo1985
06-14-2016, 01:45 AM
hi,

Thank for reply to me.

Sorry but I don't understand what you mean with "Can you substitute formulae for the constants? "... :(

Tahks again,

Edoardo

snb
06-14-2016, 01:55 AM
Your file seems to be invalid.
I can't load it (Excel 2010)

Edoardo1985
06-14-2016, 02:15 AM
Ah ok is because I have Office 2016... I try to upload in a different format now.

Thanks,

Edoardo

snb
06-14-2016, 03:10 AM
In the formula you use h, k, n

In the file you use i, j,n

What is what ??

Edoardo1985
06-14-2016, 03:33 AM
Hello,
this is the point of my question. I have the values of n that is fixed. I want to know at a certain values of i and j which is the numbers that appears. h and k are values that change depending on what I'm looking for. For example if n=8, j=5 and i=6 i write
n=8
j=5
i= n-h where in this case h is egual 2, i.e. h=2 --> i=8-2

k is the values that change in my summatory as I wrote before, I mean that my value at n=8, j=5, i=6 is given from the sum of other values (with minor j and i) and k is proper the number that make change the values of i.

I hope now is clear :)

Regards,

Edoardo

mdmackillop
06-14-2016, 09:30 AM
I think you would be better posting this in a mathematics forum. If you get a formula, then we can look at an Excel implementation.

Edoardo1985
06-14-2016, 09:48 AM
Hi,
I have the basical formulas from which I have to start. It doesn't exist a formula for each number i look for. This is the point. I have to start from the formulas that I have and from this I have to calculate what I'm looking for. If you want I can post the formulas that I have, i.e. the one with j=0, i=n, i=n-1 and i=1.

Regards,

Edoardo

offthelip
06-15-2016, 03:33 AM
Hi Edoardo
I haven't had time to test this so this is probaly going to fail but it should give the idea about how to do this:
I am assuming "Ffunction" is the function that calcuates "F2 from the K value


Function summation(k, h)
sumtemp = 0
minus1 = 1
For i = k To h - 1
Functionfvalue=Ffunction (k)
minus1 = -minus1
sumtemp = sumtemp + minus1 + functionfvalue
Next i
summation = sumtemp
End Function

Edoardo1985
06-15-2016, 04:55 AM
Ok thankyou very very much!

As soon as I try I let you know.

Thanks again,

Edoardo