.


:




:

































 

 

 

 


, , Excel




, Excel VBA , :

1 Excel. VBA Excel:

1. Excel / - .

2. : (), . , 3,5 ( ). . , G. ( , , , , ..). Microsoft Excel .

3. Excel.

:

1. Excel \. , , .

2. ( ) Visual Basic Excel, .

, . 2, , Excel.

2. (PERSONAL.XLS).

PERSONAL, : 1. \\ - . 2. : . 3. . 4. \\ Visual Basic, , PERSONAL . PERSONAL, , , G 1.

1. , , Y(x)=X^2 PERSONAL.XLS. 2. \ Microsoft Excel. 3. f(x), , Y Y PERSONAL.XLS!Y. 4. \ : ? , Y Microsoft Excel. , Y . 1 3,5 ( G) Excel.

2. C :

VBA

If Then.

Function Z(t)

If t<= -1 Then z=(1+Abs(t))/(1+t+t^2)^(1/3)

If t>-1 And t<0 Then z=2*Application.Ln(1+t^2)+ _

(1+cos(t)^4)/(2+t)

If t>=0 Then z=(1+t)^(3/5)

End Function.

: 1. 1 2 . 2. . 2 If Then Else.

Ln VBA, Application.Ln. .

3. , , : 100 200 , 7 %, 201 300 -10 %, 300 15 %. , 5 %.

, . : 1 0 .

:

1. , , Visual Basic, Visual Basic.

2. , .

3. , .

4. :

Function (, , )

' .

'

If <100 Then

'

' 99

'

= *

Else

If <=200 Then

'

' 100 200

'

= * * 0,93

Else

' 201 300

'

If < = 300 Then

=**0,9

Else

'

' 300

'

=**0,85

End If

End If

End If

'

'

'

If =0 Then

=

Else

=*0,95

End If

End Function

 

, . , .

Excel , Microsoft Excel. - fx, - , . (. 3.5.1.1).

. , VBA. .

 

 
 

. 3.5.1.1.

, , . . .

: 1. .

2. , If Then Else .

3. N, N .

4. Select Case

Select Case , , , .

Select Case. :

, .. , %
0-9999 10000-39999 40000 -  

:

Function ()

Select Case

Case 0 To 9999

=0.08*

Case 10000 To 39999

=0.1*

Case Is>=40000

=0.14*

End Select

End Function.

Is VBA, Case. Case , :

Case 4, 7 8, 11 12, 15 , : 7 8 11 12 : 4 15.

Case 5, 6, 9 10, 13, 14 Is>=16 , 9 10 : 5, 6, 13 14, , 16.

, 1 Excel

=((1>=0; A1<10000);a1*0.08;((A1>=10000;A1<40000);

A1*0.1;(1>=40000;A1*0.14)))

5. , Select Case, (0; 0,05; 0,10; 0,15; 0,20) int. , int Case.

Function (sng As Single, int As Integer)

Select Case int

ase 0

= sng*0

Case 1

= sng*0,05

Case 2

= sng*0,1

Case 3

= sng*0,15

Case 4

= sng*0,2

Case Else

= sng*0

End Select

End Function

 

6. For-Next

, , .. ,

 

P(1) d(1) - , P(1) , P(j), d(j) - j- , n-1 - , i - .

Option Explicit

Option Base 1

Function ( As Double, As Variant, _

As Variant) As Double

Dim i, j, n As Integer, s As Double

n=. Rows. Count

S=0

For i=1 To n

S=S+ (i)/ _

(1+)^(((i)-(1))/365)

Next i

=S

End Function.

 
 

, Rows , Count . , .Rows.Count . , .Columns.Count.

 

. 3.5.1.2.

. , 11.01.97 10000 . : 20.12.97 - 2000 ., 18.10.98 - 40000 ., 12.04.99 - 7000 . 10%?

, . 3.5.1.2.

2 , .. . 8, , =(7;2:5;D2:D5). 857.91. , .

7. C Exit For

, . , , , -1.

Function (a As Variant, As Variant) As Integer

Dim i, n As Integer, t As Boolean

n=a. Rows.Count*a.Columns.Count

t=False

For i=1 To n

If a(i)= Then

=i

T=True

Exit For

End If

Next i

If t=False Then =-1

End Function

8. While-Wend

While-Wend .

_2 , , While-Wend:

Option Base 1

Function _2( As Double, As Variant, _

As Variant) As Double

Dim i, j, n As Integer, s As Double

n=.Rows.Count

S=0

I=1

While i<=n

S=S+ (i)/(1+)^(((i)-(1))/365

I=i+1

Wend

_2=S

End Function.

: 1. 1-8.

2. 1. Y(Xi) ( 1-12 . ). 12 , 12 12, .. 13 13-12=1 ..

VBA , Excel Xi, .

 

 

xi (12), i Xi =5 c 1,5. , a k .

a=1; k=6; x(1)=1; x(2)=2, x(12)=12

c(1)=5; c(2)=6,5, c(12)=21,5

1 (1)=1 Y(1)=5*1*1=5

2 (7)=7 Y(7)=1*7+14=21

c Y(x):

1. Excel ,, Visual Basic, VBA

2. ,

3. :

Function Y (X, C As Variant) As Variant

If X>6 Then Y=1*X+C Else Y=5*1*X

End Function

4. Excel , Microsoft Excel.

5. Excel 1:12 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1:12 , - 5; 6,5; 8; 9,5; 11; 12,5; 14; 15,5; 17; 18,5; 20; 21,5.

6. 1, - f, - , Y OK.

7. 1, 1 .

8. .. 6-7 2.

9. ( Å ) 12.

1:12 - Y(x).

10. () Y(x)

 

1

i - , i 1 12 1. , , k1, k2 xi .

2

xi ci - , (12), (12); i 1 12 1.

3

xi 12 . , , k .

4

12 . , k1,k2 .

5

12 . , b .

6

i - , i = 5 1,5; (12), b k - .

7

i i - (15) (15). , b, k1, k2 k3 .

8

i - (12), = -8 1.5. , b .

9

i - (12), =1.5 0.5. , k1 .

10

i - (12), i = -1.5 0.5. , b k .

11

20 , , c, b, k1, k2, k3 .

12

i - (12); k1 < k2< k3; a, b, c, k1, k2 , k3 - .

 

 





:


: 2015-11-23; !; : 3296 |


:

:

.
==> ...

1294 - | 1245 -


© 2015-2024 lektsii.org - -

: 0.076 .