Can I do this WITHOUT VBA??

T

Titanus

Can anyone tell me, since I'm a VBA-virgin, if this routine can be
performed (and how) using just a regular Excel spreadsheet? Thanks so
much!

Sub titanus()
Dim interest(50)
Period = 0
valu = 0

For i = 1 To 50
interest(i) = 5
Next

For Count = 1 To 50
valu = valu + interest(Count)
If valu > 100 And Period = 0 Then
Period = Count
End If
Next
End Sub
 
B

Bernie Deitrick

Titanus,

=100/5 +1

or

=Int(A1/B1 + 1)

where A1 has the amount, and B1 has the interest...

But you would be much better off telling us what it is that you want to do.... There are lots of
financial functions that can give answers to complex situations with a minimum of work.

HTH,
Bernie
MS Excel MVP
 
L

Lori

If you want the number of periods it should be 100/5+1 = 21 or more
generally:

=INT(Valu_min/interest + 1)

providing this is less than the Maximum value of i (50).
 
T

Titanus

This routine comes on the heels of the following:

I have a column called Phase (which is in degrees), which runs, say,
from A1:A100. Then the next column is DePhase (also in degrees) which
= Phase(current cell) - Phase(prior cell).

The next column is a DePhase smoother called DePhase2 where, based on
certain conditions of Phase and DePhase I come up with a better value
for DePhase.

Now, the routine I want to run will sum the DePhase2's to reach 360
degrees. The sum is the InstPeriod.) So then I need to Excel-ize the
following:

InstPeriod = 0;
Value4 = 0;
For count = 0 to 50 begin
Value4 = Value4 + DePhase[count];
If Value4 > 360 and InstPeriod = 0 then begin
InstPeriod = count;
end;
end;

{It looks a little different from the first posting simply because I
thought I could kind of Cliff Note it.}
 
B

Bernie Deitrick

Titanus,

In the next column - I'm guessing D, but the Cliff Notes version may not be specific enough ;-) -
enter this formula in D2 and copy down:

=IF(AND(SUM($C$1:C2)>360,SUM($D$1:D1)=0),ROW(),"")

and copy down for 50 rows. The number that appears in column D will be your count. You could show
that value in another cell by simply using

=SUM(D:D)

HTH,
Bernie
MS Excel MVP


Titanus said:
This routine comes on the heels of the following:

I have a column called Phase (which is in degrees), which runs, say,
from A1:A100. Then the next column is DePhase (also in degrees) which
= Phase(current cell) - Phase(prior cell).

The next column is a DePhase smoother called DePhase2 where, based on
certain conditions of Phase and DePhase I come up with a better value
for DePhase.

Now, the routine I want to run will sum the DePhase2's to reach 360
degrees. The sum is the InstPeriod.) So then I need to Excel-ize the
following:

InstPeriod = 0;
Value4 = 0;
For count = 0 to 50 begin
Value4 = Value4 + DePhase[count];
If Value4 > 360 and InstPeriod = 0 then begin
InstPeriod = count;
end;
end;

{It looks a little different from the first posting simply because I
thought I could kind of Cliff Note it.}
Bernie said:
Titanus,

=100/5 +1

or

=Int(A1/B1 + 1)

where A1 has the amount, and B1 has the interest...

But you would be much better off telling us what it is that you want to do.... There are lots of
financial functions that can give answers to complex situations with a minimum of work.

HTH,
Bernie
MS Excel MVP
 
Top