ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Can I do this WITHOUT VBA?? (https://www.excelbanter.com/excel-worksheet-functions/122685-can-i-do-without-vba.html)

Titanus

Can I do this WITHOUT VBA??
 
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


John Bundy

Can I do this WITHOUT VBA??
 
As soon as I can figure out what you are trying get with that. Is it number
of periods to pay back?
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Titanus" wrote:

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



Bernie Deitrick

Can I do this WITHOUT VBA??
 
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


"Titanus" wrote in message
oups.com...
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




Lori

Can I do this WITHOUT VBA??
 
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).

Titanus wrote:

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



Titanus

Can I do this WITHOUT VBA??
 
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 Deitrick wrote:
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


"Titanus" wrote in message
oups.com...
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



Bernie Deitrick

Can I do this WITHOUT VBA??
 
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" wrote in message
oups.com...
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 Deitrick wrote:
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


"Titanus" wrote in message
oups.com...
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






All times are GMT +1. The time now is 04:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com