Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations Danlap on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repeating many calcs with Step then SUM

Status
Not open for further replies.

zliazmei

Structural
Feb 5, 2002
97
HI there all experts,

I have a big problem.

Let say:
I have a formula that depends from the value in a cell.

Now I want this equation to be performed for the values in this cell between 2 numbers with some step and all results to be sumarised in another cell.

Can you help?

Thanks in Advice

Zmei
 
Replies continue below

Recommended for you

zliazmei:

I'm not exactly sure what you want to do, but I interpreted your problem as this:

You have a cell that you want to enter a number into (lets call this cell "A1"). You also have an equation in a different cell that uses the number you entered in cell A1 (call this cell "A2").

Now, if I understand you correctly, you want the equation (in A2) to be calculated if the number entered (in A1) is between two numbers, and not calculated if it is outside of these numbers (If I misunderstood, please correct me).

To do this, you want to use the following format for your equation (in cell A2):

=IF(AND(A1>=1,A1<=20),A1^2,0)

..where I use a lower limit of 1, an upper limit of 20, an equation equal to A1^2, with the result if the conditions are not met being 0.

If this is not what you had in mind, let me know.

jproj
 
Sounds more like a FOR loop to me.

I guess I don't understand while you don't just set up a column with the value range and a corresponding column with the results. That's precisely what Excel was designed for.

What you're asking for would require a macro. Alternately, you might think about doing this in Mathcad, Matlab, or TK solver, since the problem setup you describe certainly fits rnage variable calculations in Mathcad.
TTFN
 
Try Thread770-31578 for iterative solutions. I might be what you need.

[smile]
David
 
HI there,

Thanks to all.
I will try to clarify the problem.
Exactly what I need is to solve and Integral of a functon Between 2 values, using the &quot;rectagles method&quot; with acuracy of 0.01.
IrStuff it sounds like For loop for me to but I do not know how to make this.

Thanks again.

Zmei
 
Zliazmei
Try this

trial X | B1 =IF(ISERR(B13),B2,MAX(B2,B13))*B14
lower limit| B2 = 2
upper limit| B3 = 10
increment | B4 = 0.01
formula 1 | B5 =5*(B1^2)
formula 2 | B6 =5*(B1+B4)^2
result | B7 =AVERAGE(B5,B6)*B4
count | B8 =(B3-B2)/B4
act count | B9 =IF(B1=B2,0,B10)*B14
new count | B10 =(B9+1)
prior value| B11 =IF(B9=0,0,B12*B14)
accumulated| B12 =IF(B9<B8,B7+B11,B11)*B14
new X | B13 =MIN((B1+B4),B3)
reset | B14 =1


First enter zero in the reset cell
Go to tools|options|calculation iteration=checked #=1(for debugging)
Select your own lower and upper limits and increment.
Write your own formula 1. Formula 2 is the same with the increment included.
When it's ready, enter 1 in the reset cell and press F9 until it stops.
I used an easy formula for the example so that you can check the value by true integration.
I rushed this off without a rigorous debug so I'm sure someone else can jump in with an improvement! It's just a matter of choosing the right logic steps to accumulate the value properly.
[smile]
David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor