Newbie with array-problem

  • Thread starter Thread starter nilserik.oscarsson
  • Start date Start date
N

nilserik.oscarsson

I have 7 arrays with 15 elements in each. I need to combine every
element, one from each array for each loop and compare the sum of
these 7 values with an intervall to se if the value should be passed
on. How to find a smart solution that want be to heavy on the Excel-
program and on the computer. Is it possible or am I reaching for the
moon? Thanks in advance for any suggestions.
 
I have 7 arrays with 15 elements in each. I need to combine every
element, one from each array for each loop and compare the sum of
these 7 values with an intervall to se if the value should be passed
on. How to find a smart solution that want be to heavy on the Excel-
program and on the computer. Is it possible or am I reaching for the
moon? Thanks in advance for any suggestions.

It shouldn't be too hard. Post some more information as to the type of data
and how the arrays are stored or entered.
--ron
 
It shouldn't be too hard. Post some more information as to the type of data
and how the arrays are stored or entered.
--ron

Nmeric values - the interval of comparison is entered as parameters
 
Nmeric values - the interval of comparison is entered as parameters

Sorry - fast answer - the values are already in the arrays and are
numeric so that is not the problem. The intervall is passed to the
macro as parameters. My problem is th loop with so many arrays and not
breaking the memory or the program. My math is not that good in
finding a "maximal solution" - sorry for the earlier incorrrect answer.
 
Sorry - fast answer - the values are already in the arrays and are
numeric so that is not the problem. The intervall is passed to the
macro as parameters. My problem is th loop with so many arrays and not
breaking the memory or the program. My math is not that good in
finding a "maximal solution" - sorry for the earlier incorrrect answer.

Well, if you just want to sum the total of each nth element in a bunch of
arrays, something like:

for i = lbound(array) to ubound(array)
dTemp = array1(i) + array2(i) + array3(i) ... + array7(i)
if dTemp = interval then
pass it on
end if
next i

--ron
 
Well, if you just want to sum the total of each nth element in a bunch of
arrays, something like:

for i = lbound(array) to ubound(array)
dTemp = array1(i) + array2(i) + array3(i) ... + array7(i)
if dTemp = interval then
pass it on
end if
next i

--ron

It does not cobmbine all values in all array elements - only 15.
I tried to define lbound/ubound as Array1/Array7 or as a seperar Array/
Array with 15 elements?? but the same result. How to define nbr of
elements in ARRAY?
 
It does not cobmbine all values in all array elements - only 15.
I tried to define lbound/ubound as Array1/Array7 or as a seperar Array/
Array with 15 elements?? but the same result. How to define nbr of
elements in ARRAY?

If you can't adapt what I posted to your circumstance, you are going to have to
provide more specifics.

What you write may be clear to you, but it is not clear to me.
--ron
 
If you can't adapt what I posted to your circumstance, you are going to have to
provide more specifics.

What you write may be clear to you, but it is not clear to me.
--ron

Sorry - thanks for your time. I wont to make these combinations for
EVERY elements (E) in EVERY array (A)
Ex: Array1 element 1 to 15 combined with element 1 in array 2-7, with
element 2 in array 2-7,with element 3 in array 2-7 and so on until or
combinations are covered between the arrays. Does this make any
sense ?? - this is why it is so hard to make without breaking the
memory or the computer. Your solution only takes A1E1, A2E1...A1E2,
A2E2.. or have I completle misunderstood your solution
 
Sorry - thanks for your time. I wont to make these combinations for
EVERY elements (E) in EVERY array (A)
Ex: Array1 element 1 to 15 combined with element 1 in array 2-7, with
element 2 in array 2-7,with element 3 in array 2-7 and so on until or
combinations are covered between the arrays. Does this make any
sense ?? - this is why it is so hard to make without breaking the
memory or the computer. Your solution only takes A1E1, A2E1...A1E2,
A2E2.. or have I completle misunderstood your solution

I have tried to nest your loop but it breaks down the memory, but
seems to work when debuging at least as long I tried
for A1 = lbound(array1) to ubound(array1)
for A2 = lbound(array2) to ubound(array2)
.....
.....
dTemp = array1(a1) + array2(a2) + array3(a3) ... + array7(a7)
 
Sorry - thanks for your time. I wont to make these combinations for
EVERY elements (E) in EVERY array (A)
Ex: Array1 element 1 to 15 combined with element 1 in array 2-7, with
element 2 in array 2-7,with element 3 in array 2-7 and so on until or
combinations are covered between the arrays. Does this make any
sense ?? - this is why it is so hard to make without breaking the
memory or the computer. Your solution only takes A1E1, A2E1...A1E2,
A2E2.. or have I completle misunderstood your solution

I don't think you've misunderstood my solution.

My solution basically does this:

A1 = ARRAY1
E1 = ELEMENT1

=A1E1+A2E1+A3E1+A4E1+A5E1+A6E1+A7E1

Then compare that SUM with interval

Then do

=A1E2+A2E2+A3E2+A4E2+A5E2+A6E2+A7E2

and compare the SUM with interval

and repeat to

=A1E15+A2E15+A3E15+A4E15+A5E15+A6E15+A7E15



--ron
 
I don't think you've misunderstood my solution.

My solution basically does this:

A1 = ARRAY1
E1 = ELEMENT1

=A1E1+A2E1+A3E1+A4E1+A5E1+A6E1+A7E1

Then compare that SUM with interval

Then do

=A1E2+A2E2+A3E2+A4E2+A5E2+A6E2+A7E2

and compare the SUM with interval

and repeat to

=A1E15+A2E15+A3E15+A4E15+A5E15+A6E15+A7E15

--ron

Thanks for you time - as I said earlier - that's what your souloution
does - not combine all elements in alla arrays with each other
 
I don't think you've misunderstood my solution.

My solution basically does this:

A1 = ARRAY1
E1 = ELEMENT1

=A1E1+A2E1+A3E1+A4E1+A5E1+A6E1+A7E1

Then compare that SUM with interval

Then do

=A1E2+A2E2+A3E2+A4E2+A5E2+A6E2+A7E2

and compare the SUM with interval

and repeat to

=A1E15+A2E15+A3E15+A4E15+A5E15+A6E15+A7E15

--ron

Thanks very much Ron. With a pre-routine taking away "to high values"
in each array and nesting your solution (se earlier) I managed to
reduce the nbr of elements to calculate in each array and all went
well. I used "For x = y to z" to reduce the loops. Your a smart guy,
perhaps to smart for a newbie (novis in Excel) like me - many thanks.
 
Thanks very much Ron. With a pre-routine taking away "to high values"
in each array and nesting your solution (se earlier) I managed to
reduce the nbr of elements to calculate in each array and all went
well. I used "For x = y to z" to reduce the loops. Your a smart guy,
perhaps to smart for a newbie (novis in Excel) like me - many thanks.

Even though I couldn't give you a complete solution, I'm happy to have given
you some hints that enabled you to develop one on your own.

And I've never been accused of being "too smart" before -- just ask my wife!
<g>
--ron
 
Back
Top