Sunteți pe pagina 1din 27

CSc 2 Introduction to Computers II

Lesson 2 - Excel Functions

Using functions
A function is a pre-defined formula that helps perform common mathematical functions. Excel literally has hundreds of different functions to assist with your calculations. Building formulas can be difficult and time-consuming. Excel's functions can save you a lot of time and headaches. You could use an Excel function called Average, for example, to quickly find the average of range of numbers. Or you could use the Sum function to find the sum of a cell range. Excel XP contains many different functions.

Examples of creating a function


An example of a function with one argument that adds a range of cells, B3 through B10:

Basic Functions
SUM - summation adds a range of cells together. AVERAGE - average calculates the average of a range of cells. MAX - identifies the largest number in a range of cells. MIN - identifies the smallest number in a range of cells.

Basic Functions
SUM
=SUM(A1:A10) =SUM(A1:B10,C3) =SUM(A1:B10,D1:E10)

AVERAGE
=AVERAGE(A1:A10) =AVERAGE(A1:B10,C3) =AVERAGE(A1:B10,D1:E10)

MAX
=MAX(A1:A10) =MAX(A1:B10,C3) =MAX(A1:B10,D1:E10)

MIN
=MIN(A1:A10) =MIN(A1:B10,C3) =MIN(A1:B10,D1:E10)

TODAY() and NOW() Functions


The TODAY and NOW functions are calendar functions that display the current date and/or time. =TODAY() Displays current date: i.e. 4/12/10. Date displays in short date format. =NOW() Displays current date and time:4/12/10 16:10. Date displays in short date format and time displays in military time.

COUNT and COUNTA Functions


The COUNT function is used to count the number of cells in a range that contain numbers or values. The COUNTA function is used to display the number of cells in a range that contain both text AND values.

COUNT and COUNTA Functions


=COUNT(A1:A10) Displays the number of cells that contain numbers (values). =COUNTA(A1:B10,C3) Displays the number of cells that contain text and values in range A1:B10 and cell C3. =COUNT(A1:B10,D1:E10) Displays the number of cells that contain numbers (values) in ranges A1:B10 and D1:E10.

COUNTIF Function
The COUNTIF function is used to count the number of cells in a range that meet specific criteria. This function contains two arguments. COUNTIF Function Syntax =COUNTIF(Range,"Criteria") The Range argument is the range address that will be the subject of the count. The Criteria argument is the specification that must be met for the cell to be counted. The criteria argument is surrounded by quotation marks.

COUNTIF Function
=COUNTIF(A1:A10,mango") Displays the number of cells in the range indicated that contain the label mango. =COUNTIF(B1:B10,">=3") Displays the number of cells in the range indicated that contain values greater than or equal to 3.

COUNTBLANK Function
The COUNTBLANK function is used to count the number of empty cells in a range. =COUNTBLANK(A1:A10) Displays the number of empty cells in range A1:A10. =COUNTBLANK(B1:B10,D1:D10) Displays the number of empty cells in ranges B1:B10 and D1:D10.

IF Function
The IF function is a logical function that tests a condition and then returns a result based on that condition. If the condition is TRUE, a user specified value displays. If the condition is FALSE, a different specified value displays.

IF Function
IF Function Syntax IF(logical test,value if TRUE,value if FALSE) =IF(A1>=75,"Pass","Fail") If a student's exam grade in cell A1 is greater than or equal to 70, the word Pass will display, otherwise, Fail will display. When text is the True and False arguments, they must be enclosed in quotation marks. =IF(A1>50000,500,0) If the Sales amount in cell A1 exceeds $50,000, then display a bonus of $500, otherwise, show 0 for a bonus. =IF(A1<20,B1,B1*.9) If the Quantity Purchased in cell A1 is less than 20, then the customer pays full price which is in cell B1, otherwise, they get a 10% discount which is the full price * 90%.

Nested IF
Nested IF functions are a simple way to do a complex conditional formula. Nested IF functions allow you to use up to seven IF functions to impose conditions. Limited to 7 conditions only.

Sample Situation
To illustrate, let's say you have a spreadsheet that you use to keep track of your sales force. The rate of commission each sales person receives is based on the amount of sales they have generated for that month. For example:
From $1 to $10 earns 10% commission rate From $11 to $100 earns 15% commission rate Anything over $100 earns 20% commission rate

Sample Situation
Assuming the amount of sales is in column B, starting at row 4, and that the column containing the commission is formatted for percentages, this is what the nested IF function would look like:
=IF(B4<=10, 0.1, IF(B4<=100, 0.15, 0.2))

Sample Situation

Take note that the commission rate is formatted into Percentage.

Sample Situation
This nested IF function says that if the cell B4 is less than or equal to 10, then put .10 in this cell (the commission), if the cell B4 is greater than 10, but less than or equal to 100, then put .15 in this cell. If the number in cell B4 is greater than 100, then put .20 in this cell.

ROUND Function
In Excel, the ROUND function returns a number rounded to a specified number of digits. The syntax for the ROUND function is: ROUND( number, digits ) Example using the image at the right: =ROUND(A1, 0) would return 663 =ROUND(A1, 1) would return 662.8

ISBLANK, ISERROR Functions


The ISBLANK function can be used to check for blank or null values. The syntax for the ISBLANK function is: ISBLANK ( value ) In Excel, the ISERROR function can be used to check for error values. The syntax for the ISERROR function is: ISERROR ( value )

ISBLANK, ISERROR Functions


=ISBLANK(A1) would return FALSE =ISBLANK(A2) would return TRUE =ISBLANK("Tech on the Net") would return FALSE =ISERROR(A1) would return TRUE =ISERROR(A2) would return TRUE =ISERROR(A3) would return TRUE =ISERROR(A4) would return FALSE =ISERROR("Tech on the Net") would return FALSE =ISERROR(3/0) would return TRUE

The Function Wizard


The purpose of the function wizard is to provide you with all of the possible Excel functions, and make them easy to implement. The function wizard is useful when you can not remember which function to use, or when you have no idea which functions even exist. Excel has 348 functions and are grouped by category in the Function Wizard.

Sample Situation
You are working on a spreadsheet, and need to know the monthly payment of a loan.

The Function Wizard


Click on the fx button to launch the Function Wizard.

The Function Wizard


You understand that the function you are looking for is a Financial function, so you click on the Financial function category. You then scroll down the list of available functions. You run across a function called PMT, and you read the description. It sounds like the one you are looking for, so you click OK.

The Function Wizard


The next window you see allows you to either manually key in all of the functions argument values, or simply tell Excel which cells contain the argument values. So, we go field by field in the dialog box, and click on the corresponding cell in the workbook that contains the argument value.

The Function Wizard

After putting all the necessary values in the argument list, Excel will then generate the computed result.

S-ar putea să vă placă și