ehchandler
New Member
- Joined
- Sep 6, 2016
- Messages
- 5
Hello - I'm extremely new to VBA, but have had to learn it at a relatively high level pretty fast, so forgive me if this is a simple question. There are lots of gaps in my understanding.
I have been working with an equation that involves two levels of summation, see formula (a) below, but today was presented with a problem that required an expansion to three levels, given by formula (b) below. Instead of just rewriting the program for three tiered summation, since its likely that I will have to deal with four and five and who knows how many summation tiers in the future, I would like to write it as generalized for "n" summation tiers. See formula (c) below. (Unintentional, but interestingly enough, for this problem, "n" as the number of summation tiers and "N" as the upper bound of each summation are equal, though I would like to understand how to generalize this to any number of upper bounds and tiers, whether or not n=N).
I assume it would look like a series of "For i = 1 To N ..... Next" statements, which I can do, but how do you do an "n-tuple" nested "For ..... Next" statements, where "n" is variable? This is really hurting my head!
(a)
(b)
(c)
Thanks so much in advance for your comments and advice.
I have been working with an equation that involves two levels of summation, see formula (a) below, but today was presented with a problem that required an expansion to three levels, given by formula (b) below. Instead of just rewriting the program for three tiered summation, since its likely that I will have to deal with four and five and who knows how many summation tiers in the future, I would like to write it as generalized for "n" summation tiers. See formula (c) below. (Unintentional, but interestingly enough, for this problem, "n" as the number of summation tiers and "N" as the upper bound of each summation are equal, though I would like to understand how to generalize this to any number of upper bounds and tiers, whether or not n=N).
I assume it would look like a series of "For i = 1 To N ..... Next" statements, which I can do, but how do you do an "n-tuple" nested "For ..... Next" statements, where "n" is variable? This is really hurting my head!
(a)
(b)
(c)
Thanks so much in advance for your comments and advice.