16
# 1 CS 105 Simple Functions What is a function? What is a function argument? Return value? What is a PMT function? What is a VLOOKUP function? CS 105 Spring 2011

excel ppt

  • Upload
    dd

  • View
    47

  • Download
    2

Embed Size (px)

Citation preview

Page 1: excel ppt

# 1

CS 105

Simple FunctionsCS 105

Simple Functions

What is a function?

What is a function argument? Return value?

What is a PMT function?

What is a VLOOKUP function?

CS 105 Spring 2011

Page 2: excel ppt

# 2

Functions Functions

• A function is a command that does a specific task

• Example of a function in Excel:

SUM(A2:B5)

• This function sums all cells in the range A2:B5– the answer is called the function’s return

value

• Why functions? Define once, use many times– simply change the stuff within parentheses– called the arguments of the function

CS 105 Spring 2011

Page 3: excel ppt

# 3

Arguments

Arguments

• Arguments can be data, cells/ranges or even other functions

• Some functions have a fixed number of arguments, others have a variable number of arguments

• Examples:SQRT (9) fixed: 1 non-negative

number

SUM (A1:A10, C7) variable: numbers/cells/ranges

CONCATENATE("CS", 105) variable: mixed– concatenation can also be done with &

operator e.g. = B3 & C4CS 105 Spring 2011

Page 4: excel ppt

# 4

Built-in functionsBuilt-in functions

• Excel comes pre-loaded with many useful functions

• Categories include:– Math & Trig e.g. SQRT, ABS, COUNT, COUNTA,…– Statistical e.g. AVG– Financial e.g. PMT– Text e.g. CONCATENATE

• Later, we will see how to write our own functions to extend Excel’s “toolkit” or “library”

CS 105 Spring 2011

Page 5: excel ppt

# 5

PMT function • PMT function has three arguments:

– interest rate per payment period– number of payments– amount of loan

CS 105 Spring 2011

Page 6: excel ppt

# 6

PMT: things to remember

• PMT return value is negative (to indicate that we owe the payment) e.g., ($100.00)– use –PMT(…) to get amount we pay

• If the interest rate is annual and the payment is monthly, use monthly interest rate = (annual interest rate)/12

CS 105 Spring 2011

Page 7: excel ppt

# 7

Using Goal Seek • I want to pay only $200 a month. What car can I afford?– Change payment

total by changing one of the above variables

– The top value must have a formula in it

– Goal: $200– Computer calculates

the value of the car you can afford

Data Tab inExcel 2007

Page 8: excel ppt

# 8

• Often, we want to assign a cell some value based on the value of another (related) cell

• Usually, we have a table listing some values and their related values. For example:– A table listing the score in a class and

the associated grade– A table listing words in English and the

corresponding words in another language

VLOOKUP Function

CS 105 Spring 2011

Page 9: excel ppt

# 9

More on VLOOKUP

• Requires three arguments:– value (or cell) to look up– range of the table– the column number

containing the value you want to return

=VLOOKUP(value, range, answer col., [range lookup?])

CS 105 Spring 2011

Page 10: excel ppt

# 10

Another Example

• AI2 holds the points we want to evaluate

• Range = AL:AM holds the scale

• We want data from the 2nd column

CS 105 Spring 2011

Page 11: excel ppt

# 11

Approximate Matching: Look for 170

VLOOKUP searches the AL column for the largest value less than or equal to 170, and returns the corresponding value from column AM.

CS 105 Spring 2011

Page 12: excel ppt

# 12

Multi-table Lookup• Suppose we want to lookup the match

for something in one table, and then lookup the match for that in another table

• Answer: Nested function calls

CS 105 Spring 2011

Page 13: excel ppt

# 13

1. You can import data and not have to retype it.

2. Excel can create spreadsheets from Word tables

3. You can import and export spreadsheets and databases

Importing Data into Excel

CS 105 Spring 2011

Page 14: excel ppt

# 14

Importing Data into Excel 2007

CS 105 Spring 2011

Page 15: excel ppt

# 15

Importing Data into Excel 2007

CS 105 Spring 2011

Page 16: excel ppt

# 16

To Summarize

• What is a function?

• What is a function argument? Return value?

• What is a PMT function?

• What is a VLOOKUP function?

CS 105 Spring 2011