excel functions. part 1. introduction 2 an excel function is a formula or a procedure that is...

36
Excel Functions Excel Functions

Upload: katrina-goolsby

Post on 28-Mar-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Excel FunctionsExcel Functions

Page 2: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Part 1. Introduction

2

Page 3: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the Excel spreadsheet.

3

Page 4: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

For example, the sum of two variables can be evaluated in an Excel spreadsheet as follows:

4

Page 5: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Sum x + y

  x = 5

  Y = 3

Sum = 8

5

Sum of two variables in an Excel spreadsheet

Page 6: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

This same sum can be done in the environment of Visual Basic (VB)

6

Page 7: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

You can define a function called "Sum", which receives the You can define a function called "Sum", which receives the value of two inputs "x" and "y" and returns the value of value of two inputs "x" and "y" and returns the value of the sum of themthe sum of them

7

Page 8: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

How to build the function "Sum"How to build the function "Sum"

8

Page 9: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

- Click on the "Programmer" tab- Click on the "Programmer" tab

9

Page 10: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

- Click on the "Programmer" tab- Click on the "Programmer" tab

10

If the tab is not available, see Note 1 "Activate tab" at the end of the document.

Page 11: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

- Click on the "Programmer" tab- Click on the "Programmer" tab

11

Page 12: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Click on "view code"Click on "view code"

12

Page 13: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

The "Visual Basic" ambient is openThe "Visual Basic" ambient is open

13

Page 14: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Function code

14

Page 15: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Function code

15

The codes are written in the VB "Modules"

Page 16: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Function code

16

The codes are written in the VB "Modules"

To open a module

Page 17: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Function code

17

The codes are written in the VB "Modules"

To open a module

Click right button on the left side window

Page 18: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Function code

18

The codes are written in the VB "Modules"

To open a module

Click right button on the left side window

It opens a window

Page 19: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

19

Select “Insert”

Page 20: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Click Module

20

Page 21: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Appears the new created VB module, with the name Module1.

21

This name can be changed later by a more suitable one.

Page 22: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

The right window displays a flashing line

22

Page 23: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

The right window displays a flashing line

23

The module is now ready for use

Page 24: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Sum Function Code

24

Page 25: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Código de la función Suma

25

In the right window type the function name followed by the dependent variables.

Page 26: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Código de la función Suma

26

In the right window type the function name followed by the dependent variables

Function Suma(x,y)

Page 27: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Código de la función Suma

27

In the right window type the function name followed by the dependent variables.

Function Suma(x,y)

When you "Enter", VB automatically puts the final line of the function.

Page 28: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Sum Function Code

28

In the right window type the function name followed by the dependent variables.

Function Suma(x,y)

End Function

Page 29: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

The new code must be written between these two commands.

29

Page 30: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

The new code must be written between these two commands.

30

In this case, the code consists of a single line

Page 31: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

The new code must be written between these two commands.

31

In this case, the code consists of a single line

Suma = x + y

Page 32: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

32

The complete function looks like

Page 33: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

 x = 5Y = 3

Sum =  =SUMA(C5,C6)Sum = 8

33

Application of the Sum function in the Excel spreadsheet

Page 34: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

End of Part 1. Introduction

34

Page 35: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Activating the "Programmer" tab

35

Page 36: Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the

Activating the "Programmer" tab

36

Nota 1

To activate the “Programmer” tab

1. Click the File tab.

2. Under Help, click Options.

3. Click Customize Ribbon.

4. Select the Developer check box.