Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Show All
It's important to be aware of what can happen to cell references, whether they are absolute or relative, when you move a formula by cutting and pasting it, or copy a formula by copying and pasting it.
When you move a formula, the cell references within the formula do not change no matter what type of cell reference that you use. When you copy a formula, the cell references may change based on the type of cell reference that you use.
Move a formula
1. 2. Select the cell that contains the formula that you want to move. On the Home tab, in the Clipboard group, click Cut.
You can also move formulas by dragging the border of the selected cell to the upper-left cell of the paste area. Any existing data is replaced.
3.
Do one of the following: To paste the formula and any formatting, on the Home tab, in the Clipboard
To paste the formula only, on the Home tab, in the Clipboard group, click Paste, click Paste Special, and then click Formulas.
TOP OF PAGE
Copy a formula
1. 2. 3.
Select the cell that contains the formula that you want to copy. On the Home tab, in the Clipboard group, click Copy. Do one of the following: To paste the formula and any formatting, on the Home tab, in the Clipboard
To paste the formula only, on the Home tab, in the Clipboard group, click Paste, click Paste Special, and then click Formulas.
NOTE
You can paste only the formula results. On the Home tab, in the Clipboard group, click Paste, click Paste Special,
4.
Verify that the cell references in the formula produce the result that you want. If necessary, switch the type of reference by doing the following: 1. Select the cell that contains the formula. In the formula bar , select the reference that you want to change.
2.
3.
IT CHANGES TO:
A$1 (relative column and absolute row) $A1 (absolute column and relative row) A1 (relative column and relative row)
C$1 $A3 C3
NOTE
You can also copy formulas into adjacent cells by using the fill handle
formula produce the result that you want in step 4, select the cell that contains the copied formula, and then drag the fill handle over the range that you want to fill.
Switch between displaying formulas and formula results on a worksheet This method is a toggle between two different display modes. It does not change the state of the cells. Prevent formulas from displaying in the formula bar by protecting the cells that contain them This method changes the state of the cells protected cells cannot be edited. Show hidden formulas by removing the protection from cells This method changes the state of the cells unprotected cells can be edited. Make sure this is an acceptable risk, and make a backup copy of the workbook before you proceed.
This procedure also prevents the cells that contain the formula from being edited.
1.
Select the range of cells whose formulas you want to hide. You can also select nonadjacent ranges or the entire sheet.
2. 3. 4. 5. 6.
On the Home tab, in the Cells group, click Format, and then click Format Cells. In the Format Cells dialog box, on the Protection tab, select the Hidden check box. Click OK. On the Review tab, in the Changes group, click Protect Sheet. Make sure the Protect worksheet and contents of locked cells check box is selected, and then click OK.
NOTE
Unsharing a workbook deletes the workbooks change history. If you want to keep a copy of this information, print out the
1. 2.
On the Review tab, click Track Changes, and then click Highlight Changes. On the Highlight Changes dialog box, select the When checkbox, then select All from the list box.
3. 4. 5.
Clear the Who and Where check boxes. Select the List changes on a new sheet check box, and then click OK. Do one or more of the following: To print the History worksheet, click Print .
To copy the history to another workbook, select the cells you want to copy, click Copy , switch to another workbook, click where you want the copy to go, and click Paste
NOTE
You may also want to save or print the current version of the workbook, because this history might not apply to later
versions. For example, cell locations, including row numbers, in the copied history may no longer be current.
Unshare a workbook
1.
On the Review tab, in the Changes group, click Share Workbook, and then click the Editing tab.
2.
Make sure that you are the only person listed in the Who has this workbook open now box. If necessary, select another listed user and click Remove User.
3. 4.
Clear the Allow changes by more than one user at the same time check box. When prompted about the effects on other users, click Yes.
On the Review tab, in the Changes group, do one of the following: Click Unprotect Sheet If you do not see Unprotect Sheet, do one of the following: In Excel 2007: Click Protect Workbook, and then under Restrict Editing, click Protect Structure and Windows (to clear the check box). In Excel 2010: Click Protect Workbook. Select the range of cells whose formulas you want to unhide. Right-click the range of cells, and then click Format Cells. On the Protection tab of the Format Cells dialog box, clear the Hidden check box.
2. 3. 4.
Description
Returns TRUE if all its arguments evaluate to TRUE; returns FALSE if one or more arguments evaluate to FALSE.
One common use for the AND function is to expand the usefulness of other functions that perform logical tests. For example, the IF function performs a logical test and then returns one value if the test evaluates to TRUE and another value if the test evaluates to FALSE. By using the AND function as the logical_test argument of the IF function, you can test many different conditions instead of just one.
Syntax
AND(logical1, [logical2], ...)
The AND function syntax has the following arguments:
logical1 Required. The first condition that you want to test that can evaluate to either TRUE or FALSE. logical2, ... Optional. Additional conditions that you want to test that can evaluate to either TRUE or FALSE, up to a maximum of 255 conditions.
Remarks
The arguments must evaluate to logical values, such as TRUE or FALSE, or the arguments must be arrays or references that contain logical values. If an array or reference argument contains text or empty cells, those values are ignored. If the specified range contains no logical values, the AND function returns the #VALUE! error value.
Example 1
The example may be easier to understand if you copy it to a blank worksheet.
1.
Select the example in this article. If you are copying the example in Excel Web App, copy and paste one cell at a time.Important Do not select the row or column headers.
1. 2. 3.
Press CTRL+C. Create a blank workbook or worksheet. In the worksheet, select cell A1, and press CTRL+V. If you are working in Excel Web App, repeat copying and pasting for each cell in the example.
1.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 Formula =AND(TRUE, TRUE) =AND(TRUE, FALSE) =AND(2+2=4, 2+3=5) B Description All arguments are TRUE One argument is FALSE All arguments evaluate to TRUE C Result TRUE FALSE TRUE
Example 2
5
1.
Select the example in this article. If you are copying the example in Excel Web App, copy and paste one cell at a time.Important Do not select the row or column headers.
1. 2. 3.
Press CTRL+C. Create a blank workbook or worksheet. In the worksheet, select cell A1, and press CTRL+V. If you are working in Excel Web App, repeat copying and pasting for each cell in the example.
1.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 Data 50 104 Formula =AND(1<A2, A2<100) 5 =IF(AND(1<A3, A3<100), A3, "The value is out of range.") 6 =IF(AND(1<A2, A2<100), A2, "The value is out of range.") Description Displays TRUE if the number in cell A2 is between 1 and 100. Otherwise, it displays FALSE. Result TRUE B C
Displays the number in cell A3, if it is between 1 and 100. Otherwise, The value is out it displays the message "The value is out of range." of range. Displays the number in cell A2, if it is between 1 and 100. Otherwise, 50 it displays a message.
FALSE function
Returns the logical value FALSE.
Syntax
FALSE( )
Remark
You can also type the word FALSE directly onto the worksheet or into the formula, and Microsoft Excel interprets it as the logical value FALSE.
IF function
Show All
This article describes the formula syntax and usage of the IF function in Microsoft Office Excel.
Description
The IF function returns one value if a condition you specify evaluates to TRUE, and another value if that condition evaluates to FALSE. For example, the formula =IF(A1>10,"Over 10","10 or less") returns "Over 10" if A1 is greater than 10, and "10 or less" if A1 is less than or equal to 10.
Syntax
IF(logical_test, value_if_true, [value_if_false])
The IF function syntax has the following arguments:
logical_test Required. Any value or expression that can be evaluated to TRUE or FALSE. For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100, the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE. This argument can use any comparison calculation operator. value_if_true Required. The value that you want to be returned if the logical_test argument evaluates to TRUE. For example, if the value of this argument is the text string "Within budget" and the logical_test argument evaluates to TRUE, the IF function returns the text "Within budget." If logical_test evaluates to TRUE and the value_if_true argument is omitted (that is, there is only a comma following the logical_test argument), the IF function returns 0 (zero). To display the word TRUE, use the logical value TRUE for the value_if_true argument. value_if_false Optional. The value that you want to be returned if the logical_test argument evaluates to FALSE. For example, if the value of this argument is the text string "Over budget" and the logical_test argument evaluates to FALSE, the IF function returns the text "Over budget." If logical_test evaluates to FALSE and the value_if_false argument is omitted, (that is, there is no comma following the value_if_true argument), the IF function returns the logical value FALSE. If logical_test evaluates to FALSE and the value of the value_if_false argument is blank (that is, there is only a comma following the value_if_true argument), the IF function returns the value 0 (zero).
Remarks
Up to 64 IF functions can be nested as value_if_true and value_if_false arguments to construct more elaborate tests. (See Example 3 for a sample of nested IF functions.) Alternatively, to test many conditions, consider using the LOOKUP, VLOOKUP, HLOOKUP, or CHOOSE functions. (See Example 4 for a sample of the LOOKUP function.) If any of the arguments to IF are arrays, every element of the array is evaluated when the IF statement is carried out. Excel provides additional functions that can be used to analyze your data based on a condition. For example, to count the number of occurrences of a string of text or a number within a range of cells, use the COUNTIF or the COUNTIFS worksheet functions. To calculate a sum based on a string of text or a number within a range, use the SUMIF or the SUMIFS worksheet functions. 7
Example 1
The example may be easier to understand if you copy it to a blank worksheet.
1.
Select the example in this article. If you are copying the example in Excel Web App, copy and paste one cell at a time.Important Do not select the row or column headers.
2. 3. 4.
Press CTRL+C. Create a blank workbook or worksheet. In the worksheet, select cell A1, and press CTRL+V. If you are working in Excel Web App, repeat copying and pasting for each cell in the example.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 Data 50 Formula =IF(A2<=100,"Within budget","Over budget") 4 =IF(A2=100,A2+B2,"") 23 Description If the number in cell A2 is less than or equal to 100, the formula returns "Within budget." Otherwise, the function displays "Over budget." If the number in cell A2 is equal to 100, A2 + B2 is calculated and returned. Otherwise, empty text ("") is returned. Result Within budget Empty text ("") B C
Example 2
The example may be easier to understand if you copy it to a blank worksheet.
6.
Select the example in this article. If you are copying the example in Excel Web App, copy and paste one cell at a time.Important Do not select the row or column headers.
7. 8. 9.
Press CTRL+C. Create a blank workbook or worksheet. In the worksheet, select cell A1, and press CTRL+V. If you are working in Excel Web App, repeat copying and pasting for each cell in the example.
10.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 5 Actual Expenses 1500 500 500 Formula =IF(A2>B2,"Over Budget","OK") =IF(A3>B3,"Over Budget","OK") B Predicted Expenses 900 900 925 Description Checks whether the expenses in row 2 are over budget Checks whether the expenses in row 3 are over budget Result Over Budget OK C
6 7
Example 3
The example may be easier to understand if you copy it to a blank worksheet.
11.
Select the example in this article. If you are copying the example in Excel Web App, copy and paste one cell at a time.Important Do not select the row or column headers.
Press CTRL+C. Create a blank workbook or worksheet. In the worksheet, select cell A1, and press CTRL+V. If you are working in Excel Web App, repeat copying and pasting for each cell in the example.
15.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 5 Score 45 90 78 Formula =IF(A2>89,"A",IF(A2>79,"B", IF(A2>69,"C",IF(A2>59,"D","F")))) =IF(A3>89,"A",IF(A3>79,"B", IF(A3>69,"C",IF(A3>59,"D","F")))) Description Result B C
6 7 8
Assigns a letter grade to the score in cell F A2 Assigns a letter grade to the score in cell A A3
=IF(A4>89,"A",IF(A4>79,"B", IF(A4>69,"C",IF(A4>59,"D","F"))))
The preceding example demonstrates how you can nest IF statements. In each formula, the fourth IF statement is also the value_if_false argument to the third IF statement. Similarly, the third IF statement is the value_if_false argument to the second IF statement, and the second IF statement is the value_if_false argument to the first IF statement. For example, if the first logical_test argument (Average>89) evaluates to TRUE, "A" is returned. If the first logical_test argument evaluates to FALSE, the second IF statement is evaluated, and so on. You can also use other functions as arguments.
The letter grades are assigned to numbers, using the following key.
THEN RETURN A B C D F
Example 4
In this example, the LOOKUP function is used instead of the IF function because there are thirteen conditions to test. You may find the LOOKUP function easier to read and maintain than the IF function.
16.
Select the example in this article. If you are copying the example in Excel Web App, copy and paste one cell at a time.Important Do not select the row or column headers.
Press CTRL+C. Create a blank workbook or worksheet. In the worksheet, select cell A1, and press CTRL+V. If you are working in Excel Web App, repeat copying and pasting for each cell in the example.
20.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
10
Description Assigns a letter grade to the score in cell A2 Assigns a letter grade to the score in cell A3
Result F
A-
IFERROR function
Show All
Returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula. Use the IFERROR function to trap and handle errors in a formula.
Syntax
IFERROR(value,value_if_error)
Value
Value_if_error
is the value to return if the formula evaluates to an error. The following error types are evaluated: #N/A, #VALUE!,
Remarks
If value or value_if_error is an empty cell, IFERROR treats it as an empty string value (""). If value is an array formula, IFERROR returns an array of results for each cell in the range specified in value. See the second example below.
Example: Trapping division errors by using a regular formula
1. 2.
Create a blank workbook or worksheet. Select the example in the Help topic.
11
3. 4. 5.
Press CTRL+C. In the worksheet, select cell A1, and press CTRL+V. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 5 6 Formula =IFERROR(A2/B2, "Error in calculation") =IFERROR(A3/B3, "Error in calculation") =IFERROR(A4/B4, "Error in calculation") Quota 210 55 B Units Sold 35 0 23 Description (result) Checks for an error in the formula in the first argument (divide 210 by 35), finds no error, and then returns the results of the formula (6) Checks for an error in the formula in the first argument (divide 55 by 0), finds a division by 0 error, and then returns value_if_error (Error in calculation) Checks for an error in the formula in the first argument (divide "" by 23), finds no error, and then returns the results of the formula (0).
9 1 0
1. 2. 3. 4. 5.
Create a blank workbook or worksheet. Select the example in the Help topic. Press CTRL+C. In the worksheet, select cell A1, and press CTRL+V. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 5 6 7 8 Quota 210 55 B Units Sold 35 0 23 Formu Description (result) C Ratio =IFERROR(A2:A4/B2:B4, "Error in calculation")
12
la =C2 Checks for an error in the formula in the first argument in the first element of the array (A2/B2 or divide 210 by 35), finds no error, and then returns the result of the formula (6) Checks for an error in the formula in the first argument in the second element of the array (A3/B3 or divide 55 by 0), finds a division by 0 error, and then returns value_if_error (Error in calculation) Checks for an error in the formula in the first argument in the third element of the array (A4/B4 or divide "" by 23), finds no error, and then returns the result of the formula (0)
=C3
=C4
NOTE
The formula in the example must be entered as an array formula. After copying the example to a blank worksheet, select
FUNCTIO DESCRIPTION N AND FALSE IF IFERROR NOT OR TRUE Returns TRUE if all of its arguments are TRUE Returns the logical value FALSE Specifies a logical test to perform Returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula Reverses the logic of its argument Returns TRUE if any argument is TRUE Returns the logical value TRUE
NOT function
Show All
Reverses the value of its argument. Use NOT when you want to make sure a value is not equal to one particular value.
Syntax
NOT(logical)
Logical
Remark
If logical is FALSE, NOT returns TRUE; if logical is TRUE, NOT returns FALSE.
Example
13
1. 2. 3. 4. 5.
Create a blank workbook or worksheet. Select the example in the Help topic. Press CTRL+C. In the worksheet, select cell A1, and press CTRL+V. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 Formula =NOT(FALS E) =NOT(1+1 =2) B Description (Result) Reverses FALSE (TRUE) Reverses an equation that evaluates to TRUE (FALSE)
OR
Show All
Returns TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
Syntax
OR(logical1,logical2,...)
Logical1,logical2,... are 1 to 255 conditions you want to test that can be either TRUE or FALSE.
Remarks
The arguments must evaluate to logical values such as TRUE or FALSE, or in arrays or references that contain logical values.
If an array or reference argument contains text or empty cells, those values are ignored.
If the specified range contains no logical values, OR returns the #VALUE! error value.
You can use an OR array formula to see if a value occurs in an array. To enter an array formula, press CTRL+SHIFT+ENTER.
Example
14
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
B Description (Result) One argument is TRUE (TRUE) All arguments evaluate to FALSE (FALSE) At least one argument is TRUE (TRUE)
=OR(TRUE,FALSE,TR UE)
TRUE
Returns the logical value TRUE.
Syntax
TRUE( )
15
Remark
You can enter the value TRUE directly into cells and formulas without using this function. The TRUE function is provided primarily for compatibility with other spreadsheet programs.
ABS
Show All
Returns the absolute value of a number. The absolute value of a number is the number without its sign.
Syntax
ABS(number)
Number is the real number of which you want the absolute value.
Example
1.
2.
NOTE
3.
Press CTRL+C.
4.
16
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 Data -4
INT
Show All
Syntax
INT(number)
Example
1.
2.
NOTE
17
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 Data 19.5
Description (Result) Rounds 8.9 down (8) Rounds -8.9 down (-9) Returns the decimal part of a positive real number in cell A2 (0.5)
PRODUCT
Show All
Multiplies all the numbers given as arguments and returns the product.
Syntax
PRODUCT(number1,number2,...)
Number1, number2, ... are 1 to 255 numbers that you want to multiply.
Remarks
Arguments that are numbers, logical values, or text representations of numbers are counted; arguments that are error values or text that cannot be translated into numbers cause errors.
18
If an argument is an array or reference, only numbers in the array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.
Example
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 Data 5
15
30
Description (Result) Multiplies the numbers above (2250) Multiplies the numbers above and 2 (4500)
19
ROUND
Show All
Syntax
ROUND(number,num_digits)
Num_digits specifies the number of digits to which you want to round number.
Remarks
If num_digits is greater than 0 (zero), then number is rounded to the specified number of decimal places.
If num_digits is less than 0, then number is rounded to the left of the decimal point.
Example
1.
2.
NOTE
20
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
Rounds 21.5 to one decimal place to the left of the decimal point (20)
SUBTOTAL
Show All
Returns a subtotal in a list or database. It is generally easier to create a list with subtotals by using the Subtotal command in the Outline group on the Data tab. Once the subtotal list is created, you can modify it by editing the SUBTOTAL function.
Syntax
Function_num is the number 1 to 11 (includes hidden values) or 101 to 111 (ignores hidden values) that specifies which function to use in calculating subtotals within a list.
Function_num (includes hidden values) 1 2 3 4 5 6 Function_num (ignores hidden values) 101 102 103 104 105 106
21
7 8 9 10 11
Ref1, ref2 are 1 to 254 ranges or references for which you want the subtotal.
Remarks
If there are other subtotals within ref1, ref2, (or nested subtotals), these nested subtotals are ignored to avoid double counting.
For the function_num constants from 1 to 11, the SUBTOTAL function includes the values of rows hidden by the Hide Rows command under the Hide & Unhide submenu of the Format command in the Cells group on the Sheet tab. Use these constants when you want to subtotal hidden and nonhidden numbers in a list. For the function_Num constants from 101 to 111, the SUBTOTAL function ignores values of rows hidden by the Hide Rows command. Use these constants when you want to subtotal only nonhidden numbers in a list.
The SUBTOTAL function ignores any rows that are not included in the result of a filter, no matter which function_num value you use.
The SUBTOTAL function is designed for columns of data, or vertical ranges. It is not designed for rows of data, or horizontal ranges. For example, when you subtotal a horizontal range using a function_num of 101 or greater, such as SUBTOTAL(109,B2:G2), hiding a column does not affect the subtotal. But, hiding a row in a subtotal of a vertical range does affect the subtotal.
If any of the references are 3-D references, SUBTOTAL returns the #VALUE! error value.
Example
1.
2.
NOTE
22
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 5 Data 120
10
150
23
Description (Result) Subtotal of the column above using the SUM function (303)
SUM
Show All
Syntax
SUM(number1,number2, ...)
Number1, number2, ... are 1 to 255 arguments for which you want the total value or sum.
23
Remarks
Numbers, logical values, and text representations of numbers that you type directly into the list of arguments are counted. See the first and second examples following.
If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, or text in the array or reference are ignored. See the third example following.
Arguments that are error values or text that cannot be translated into numbers cause errors.
Example
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 Data -5
24
4 5 6
15
30
'5
TRUE
Description (Result) Adds 3 and 2 (5) Adds 5, 15 and 1, because the text values are translated into numbers, and the logical value TRUE is translated into the number 1 (21) Adds the first three numbers in the column above (40) Adds the first three numbers in the column above, and 15 (55)
Adds the values in the last two rows above, and 2. Because nonnumeric values in references are not translated, the values in the column above are ignored (2)
SUMIF
Show All
Syntax
SUMIF(range,criteria,sum_range)
Range is the range of cells that you want evaluated by criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored.
Criteria is the criteria in the form of a number, expression, or text that defines which cells will be added. For example, criteria can be expressed as 32, "32", ">32", or "apples".
Sum_range are the actual cells to add if their corresponding cells in range match criteria. If sum_range is omitted, the cells in range are both evaluated by criteria and added if they match criteria.
Remarks
Sum_range does not have to be the same size and shape as range. The actual cells that are added are determined by using the top, left cell in sum_range as the beginning cell, and then including cells that correspond in size and shape to range. For example:
25
You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) preceding the character.
Example
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
B Commission 7,000
26
3 4 5
14,000 21,000 28,000 Description (Result) Sum of the commissions for property values over 160,000 (63,000) Sum of the property values over 160,000 (900,000) Sum of the commissions for property values equal to 300,000 (21,000)
SUMIFS
Adds the cells in a range that meet multiple criteria.
IMPORTANT
The order of arguments is different between SUMIFS and SUMIF. In particular, the sum_range argument is the
first argument in SUMIFS, but it is the third argument in SUMIF. If you are copying and editing these similar functions, make sure you put the arguments in the correct order.
Syntax
SUMIFS(sum_range,criteria_range1,criteria1,criteria_range2,criteria2)
Sum_range is one or more cells to sum, including numbers or names, arrays, or references that contain numbers. Blank and text values are ignored.
Criteria_range1, criteria_range2, are 1 to 127 ranges in which to evaluate the associated criteria.
Criteria1, criteria2, are 1 to 127 criteria in the form of a number, expression, cell reference, or text that define which cells will be added. For example, criteria can be expressed as 32, "32", ">32", "apples", or B4.
Remarks
Each cell in sum_range is summed only if all of the corresponding criteria specified are true for that cell.
Cells in sum_range that contain TRUE evaluate as 1; cells in sum_range that contain FALSE evaluate as 0 (zero).
Unlike the range and criteria arguments in the SUMIF function, in SUMIFS each criteria_range must be the same size and shape as sum_range.
27
You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 Totals 2 3 Interest paid (2000) 4 Interest paid (2001) Interest paid (2002) Formula =SUMIFS(B2:E2,B3:E3,">3%",B4:E4,">=2%") Amount in dollars
Account 4 500 4% 2% 4%
Description (result) Total amounts from each bank account where the interest was greater than 3% for the year 2000 and greater than or equal to 2% for the year 2001 (500)
28
=SUMIFS(B2:E2,B5:E5,">=1%",B5:E5,"<=3%",B4:E4," >1%")
Total amounts from each bank account where the interest was between 1% and 3% for the year 2002 and greater than 1% for the year 2001 (8711)
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 PM: rain (total inches) 4 5 PM: average temperature (degrees) 6 7 AM: average wind speed (miles per hour) PM: average wind speed (miles per hour) AM: average temperature (degrees) Morning and Evening Measurements AM: rain (total inches)
33
12
29
Description (result) Add the total amount of rainfall for days when the average temperature was at least 40 degrees Fahrenheit and the average wind speed was less that 10 miles per hour (3.5)
SUMPRODUCT
Show All
Multiplies corresponding components in the given arrays, and returns the sum of those products.
Syntax
SUMPRODUCT(array1,array2,array3, ...)
Array1, array2, array3, ... are 2 to 255 arrays whose components you want to multiply and then add.
Remarks
The array arguments must have the same dimensions. If they do not, SUMPRODUCT returns the #VALUE! error value.
SUMPRODUCT treats array entries that are not numeric as if they were zeros.
Example
1.
2.
NOTE
30
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
B Array 1 4 6 9 Description (Result) Multiplies all the components of the two arrays and then adds the products that is, 3*2 + 4*7 + 8*6 + 6*7 + 1*5 + 9*3. (156)
C Array 2 2 6 5
D Array 2 7 7 3
Remark
The preceding example returns the same result as the formula SUM(A2:B4*C2:D4) entered as an array. Using arrays provides a more general solution for doing operations similar to SUMPRODUCT. For example, you can calculate the sum of the squares of the elements in A2:B4 by using the formula =SUM(A2:B4^2) and pressing CTRL+SHIFT+ENTER.
CHAR
Show All
Returns the character specified by a number. Use CHAR to translate code page numbers you might get from files on other types of computers into characters.
Operating environment Macintosh
Windows
Syntax
CHAR(number)
31
Number is a number between 1 and 255 specifying which character you want. The character is from the character set used by your computer.
Example
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
B Description (Result) Displays the 65 character in the set (A) Displays the 33 character in the set (!)
LEN, LENB
Show All
32
LENB returns the number of bytes used to represent the characters in a text string.
IMPORTANT
LEN is intended for use with languages that use the single-byte character set (SBCS), whereas LENB is intended
for use with languages that use the double-byte character set (DBCS). The default language setting on your computer affects the return value in the following way:
LEN always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.
LENB counts each double-byte character as 2 when you have enabled the editing of a language that supports DBCS and then set it as the default language. Otherwise, LENB counts each character as 1.
The languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.
Enable Windows XP support for certain languages (East Asian, Southeast Asian, Indic, and right-to-left languages)
Syntax
LEN(text)
LENB(text)
Text is the text whose length you want to find. Spaces count as characters.
Example 1: LEN
1.
2.
NOTE
33
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 Data Phoenix, AZ
One
Description (Result) Length of the first string (11) Length of the second string (0) Length of the third string, which includes 5 spaces (8)
Example 2: LENB (with your computer set to a default language that supports DBCS)
LEN returns 3, because each character is counted as 1. LEN returns 3 no matter what the default language setting is on your computer.
") equals 6
=LENB("
=LEN("
") equals 3
34
TEXT
Show All
Syntax
TEXT(value,format_text)
Value is a numeric value, a formula that evaluates to a numeric value, or a reference to a cell containing a numeric value.
Format_text is a numeric format as a text string enclosed in quotation marks. You can see various numeric formats by clicking the Number, Date, Time, Currency, or Custom in the Category box of the Number tab in the Format Cells dialog box, and then viewing the formats displayed.
Remarks
Formatting a cell by using a command (On the Home tab, in the Number group, click the arrow next to Number, and then click Number.) changes only the format, not the value. Using the TEXT function converts a value to formatted text, and the result is no longer calculated as a number.
Example
1.
2.
NOTE
35
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 Salesperson Buchanan Dodsworth Formula =A2&" sold "&TEXT(B2, "$0.00")&" worth of units." =A3&" sold "&TEXT(B3,"0%")&" of the total sales."
B Sales 2800 40% Description (Result) Combines contents above into a phrase (Buchanan sold $2800.00 worth of units.) Combines contents above into a phrase (Dodsworth sold 40% of the total sales.)
Creating formulas
Overview of formulas
Show All
Formulas are equations that perform calculations on values in your worksheet. A formula starts with an equal sign (=). For example, the following formula multiplies 2 by 3 and then adds 5 to the result.
=5+2*3
A formula can also contain any or all of the following: functions, references, operators, and constants.
Parts of a formula
36
Operators: The ^ (caret) operator raises a number to a power, and the * (asterisk) operator multiplies.
In this article
Using constants in formulas Using calculation operators in formulas Using functions and nested functions in formulas Using references in formulas Using names in formulas Using array formulas and array constants
Top of Page
Types of operators
There are four different types of calculation operators: arithmetic, comparison, text concatenation, and reference.
Arithmetic operators
37
To perform basic mathematical operations such as addition, subtraction, or multiplication; combine numbers; and produce numeric results, use the following arithmetic operators.
Arithmetic operator + (plus sign) (minus sign)
Comparison operators
You can compare two values with the following operators. When two values are compared by using these oper
Comparison operator = (equal sign) > (greater than sign) < (less than sign) >= (greater than or equal to sign) <= (less than or equal to sign) <> (not equal to sign) Meaning Equal to Greater than Less than Greater than or equal to Less than or equal to Example A1=B1 A1>B1 A1<B1 A1>=B1
A1<=B1
Not equal to
A1<>B1
Meaning Connects, or concatenates, two values to produce one continuous text value
Example "North"&"wind"
Reference operators
Combine ranges of cells for calculations with the following operators.
38
Meaning Range operator, which produces one reference to all the cells between two references, including the two references Union operator, which combines multiple references into one reference Intersection operator, which produces on reference to cells common to the two references
Example B5:B15
, (comma) (space)
Calculation order
Formulas calculate values in a specific order. A formula in Excel always begins with an equal sign (=). The equal sign tells Excel that the succeeding characters constitute a formula. Following the equal sign are the elements to be calculated (the operands), which are separated by calculation operators. Excel calculates the formula from left to right, according to a specific order for each operator in the formula.
Operator precedence
If you combine several operators in a single formula, Excel performs the operations in the order shown in the following table. If a formula contains operators with the same precedence for example, if a formula contains both a multiplication and division operator Excel evaluates the operators from left to right.
Operator : (colon) (single space) , (comma) Description Reference operators
Negation (as in 1) Percent Exponentiation Multiplication and division Addition and subtraction Connects two strings of text (concatenation) Comparison
39
>= <>
Use of parentheses
To change the order of evaluation, enclose in parentheses the part of the formula to be calculated first. For example, the following formula produces 11 because Excel calculates multiplication before addition. The formula multiplies 2 by 3 and then adds 5 to the result.
=5+2*3
In contrast, if you use parentheses to change the syntax, Excel adds 5 and 2 together and then multiplies the result by 3 to produce 21.
=(5+2)*3
In the example below, the parentheses around the first part of the formula force Excel to calculate B4+25 first and then divide the result by the sum of the values in cells D5, E5, and F5.
=(B4+25)/SUM(D5:F5)
Top of Page
Structure of a function
40
Structure. The structure of a function begins with an equal sign (=), followed by the function name, an opening parenthesis, the arguments for the function separated by commas, and a closing parenthesis.
Function name. For a list of available functions, click a cell and press SHIFT+F3.
Arguments. Arguments can be numbers, text, logical values such as TRUE or FALSE, arrays, error values such as #N/A, or cell references. The argument you designate must produce a valid value for that argument. Arguments can also be constants, formulas, or other functions.
Argument tooltip. A tooltip with the syntax and arguments appears as you type the function. For example, type =ROUND( and the tooltip appears. Tooltips only appear for built-in functions.
Entering functions
When you create a formula that contains a function, the Insert Function dialog box helps you enter worksheet functions. As you enter a function into the formula, the Insert Function dialog box displays the name of the function, each of its arguments, a description of the function and each argument, the current result of the function, and the current result of the entire formula.
To make it easier to create and edit formulas and minimize typing and syntax errors, use formula autocomplete. After you type an = (equal sign) and beginning letters or a display trigger, Microsoft Office Excel displays below the cell a dynamic drop down list of valid functions, arguments, and names that match the letters or trigger. You can then insert an item in the drop-down list into the formula.
Nesting functions
In certain cases, you may need to use a function as one of the arguments of another function. For example, the following formula uses a nested AVERAGE function and compares the result with the value 50.
The AVERAGE and SUM functions are nested within the IF function.
Valid returns When a nested function is used as an argument, it must return the same type of value that the argument uses. For example, if the argument returns a TRUE or FALSE value, then the nested function must return a TRUE or FALSE. If it doesn't, Microsoft Excel displays a #VALUE! error value.
41
Nesting level limits A formula can contain up to seven levels of nested functions. When Function B is used as an argument in Function A, Function B is a second-level function. For instance, the AVERAGE function and the SUM function are both second-level functions because they are arguments of the IF function. A function nested within the AVERAGE function would be a third-level function, and so on.
Top of Page
Making a reference to another worksheet In the following example, the AVERAGE worksheet function calculates the average value for the range B1:B10 on the worksheet named Marketing in the same workbook.
42
Absolute references An absolute cell reference in a formula, such as $A$1, always refer to a cell in a specific location. If the position of the cell that contains the formula changes, the absolute reference remains the same. If you copy or fill the formula across rows or down columns, the absolute reference does not adjust. By default, new formulas use relative references, and you may need to switch them to absolute references. For example, if you copy or fill an absolute reference in cell B2 to cell B3, it stays the same in both cells =$A$1.
43
Mixed references A mixed reference has either an absolute column and relative row, or absolute row and relative column. An absolute column reference takes the form $A1, $B1, and so on. An absolute row reference takes the form A$1, B$1, and so on. If the position of the cell that contains the formula changes, the relative reference is changed, and the absolute reference does not change. If you copy or fill the formula across rows or down columns, the relative reference automatically adjusts, and the absolute reference does not adjust. For example, if you copy or fill a mixed reference from cell A2 to B3, it adjusts from =A$1 to =B$1.
You can use 3-D references to refer to cells on other sheets, to define names, and to create formulas by using the following functions: SUM, AVERAGE, AVERAGEA, COUNT, COUNTA, MAX, MAXA, MIN, MINA, PRODUCT, STDEV, STDEVA, STDEVP, STDEVPA, VAR, VARA, VARP, and VARPA.
3-D references cannot be used with the intersection operator (a single space) or in formulas that use implicit intersection.
What happens when you move, copy, insert, or delete worksheets The following examples explain what happens when you move, copy, insert, or delete worksheets that are included in a 3-D reference. The examples use the formula =SUM(Sheet2:Sheet6!A2:A5) to add cells A2 through A5 on worksheets 2 through 6.
44
Insert or copy If you insert or copy sheets between Sheet2 and Sheet6 (the endpoints in this example), Microsoft Excel includes all values in cells A2 through A5 from the added sheets in the calculations.
Delete If you delete sheets between Sheet2 and Sheet6, Excel removes their values from the calculation.
Move If you move sheets from between Sheet2 and Sheet6 to a location outside the referenced sheet range, Excel removes their values from the calculation.
Move an endpoint If you move Sheet2 or Sheet6 to another location in the same workbook, Excel adjusts the calculation to accommodate the new range of sheets between them.
Delete an endpoint If you delete Sheet2 or Sheet6, Excel adjusts the calculation to accommodate the range of sheets between them.
Meaning A relative reference to the cell two rows up and in the same column A relative reference to the cell two rows down and two columns to the right An absolute reference to the cell in the second row and in the second column A relative reference to the entire row above the active cell An absolute reference to the current row
R2C2
R[-1] R
When you record a macro, Excel records some commands by using the R1C1 reference style. For example, if you record a command such as clicking the AutoSum button to insert a formula that adds a range of cells, Excel records the formula by using R1C1 style, not A1 style, references.
You can turn the R1C1 reference style on or off by setting or clearing the R1C1 reference style check box under Working with formulas in the Formulas category of the Excel Settings under the File menu.
Top of Page
You can create defined names to represent cells, ranges of cells, formulas, constant values, or Excel tables. A name is a meaningful shorthand that makes it easier to understand the purpose of a cell reference, constant, formula, or table, each of which may be difficult to comprehend at first glance. The following information shows common examples of names and how they can improve clarity and understanding.
Example Type Reference Constant Formula
Table
Types of names
There are several types of names you can create and use.
Defined name A name that represents a cell, range of cells, formula, or constant value. You can create your own defined name, and Excel sometimes creates a defined name for you, such as when you set a print area.
Table name A name for an Excel table, which is a collection of data about a particular subject that is stored in records (rows) and fields (columns). Excel creates a default Excel table name of "Table1", "Table2", and so on, each time you insert an Excel table, but you can change the name to make it more meaningful. For more information on Excel tables, see Using structured references with Excel tables.
Name box on the formula bar This is best used for creating a workbook level name for a selected range.
Create a name from selection You can conveniently create names from existing row and column labels by using a selection of cells in the worksheet.
New Name dialog box This is best used for when you want more flexibility in creating names, such as specifying a local worksheet level scope or creating a name comment.
NOTE
46
Using Formula AutoComplete Use the Formula AutoComplete drop-down list, where valid names are automatically listed for you.
Selecting from the Use in Formula command Select a defined name from a list available from the Use in Formula command in the Defined Names group on the Formula tab.
Top of Page
Array constants can be used in place of references when you don't want to enter each constant value in a separate cell on the worksheet.
To calculate a single result This type of array formula can simplify a worksheet model by replacing several different formulas with a single array formula.
For example, the following calculates the total value of an array of stock prices and shares, without using a row of cells to calculate and display the individual values for each stock.
47
When you enter the formula ={SUM(B2:D2*B3:D3)} as an array formula, it multiples the Shares and Price for each stock, and then adds the results of those calculations together.
To calculate multiple results Some worksheet functions return arrays of values, or require an array of values as an argument. To calculate multiple results with an array formula, you must enter the array into a range of cells that has the same number of rows and columns as the array arguments.
For example, given a series of three sales figures (in column B) for a series of three months (in column A), the TREND function determines the straight-line values for the sales figures. To display all of the results of the formula, it is entered into three cells in column C (C1:C3).
When you enter the formula =TREND(B1:B3,A1:A3) as an array formula, it produces three separate results (22196, 17079, and 11962), based on the three sales figures and the three months.
Array constants can contain numbers, text, logical values such as TRUE or FALSE, or error values such as #N/A. Different types of values can be in the same array constant for example, {1,3,4;TRUE,FALSE,TRUE}. Numbers in array constants can be in integer, decimal, or scientific format. Text must be enclosed in double quotation marks for example, "Tuesday".
Array constants cannot contain cell references, columns or rows of unequal length, formulas, or the special characters $ (dollar sign), parentheses, or % (percent sign).
48
Separate values in different columns with commas (,). For example, to represent the values 10, 20, 30, and 40, enter {10,20,30,40}. This array constant is known as a 1-by-4 array and is equivalent to a 1-row-by-4-column reference.
Separate values in different rows with semicolons (;). For example, to represent the values 10, 20, 30, and 40 in one row and 50, 60, 70, and 80 in the row immediately below, you would enter a 2-by-4 array constant: {10,20,30,40;50,60,70,80}.
In this article
Types of operators
There are four different types of calculation operators: arithmetic, comparison, text concatenation, and reference.
Arithmetic operators
To perform basic mathematical operations such as addition, subtraction, or multiplication; combine numbers; and produce numeric results, use the following arithmetic operators.
49
^ (caret)
Exponentiation
3^2
Comparison operators
You can compare two values with the following operators. When two values are compared by using these operators, the result is a logical value either TRUE or FALSE.
Comparison operator = (equal sign) > (greater than sign) < (less than sign) >= (greater than or equal to sign) <= (less than or equal to sign) <> (not equal to sign)
Meaning Equal to Greater than Less than Greater than or equal to Less than or equal to
A1<=B1
Not equal to
A1<>B1
Meaning Connects, or concatenates, two values to produce one continuous text value
Example ("North"&"wind")
Reference operators
Combine ranges of cells for calculations with the following operators.
Meaning Range operator, which produces one reference to all the cells between two references, including the two references Union operator, which combines multiple references into one reference Intersection operator, which produces on reference to cells common to the two references
Example B5:B15
, (comma) (space)
Top of Page
In some cases, the order in which calculation is performed can affect the return value of the formula, so it's important to understand how the order is determined and how you can change the order to obtain desired results.
Calculation order
Formulas calculate values in a specific order. A formula in Excel always begins with an equal sign (=). The equal sign tells Excel that the succeeding characters constitute a formula. Following the equal sign are the elements to be calculated (the operands), which are separated by calculation operators. Excel calculates the formula from left to right, according to a specific order for each operator in the formula.
Operator precedence
If you combine several operators in a single formula, Excel performs the operations in the order shown in the following table. If a formula contains operators with the same precedence for example, if a formula contains both a multiplication and division operator Excel evaluates the operators from left to right.
Negation (as in 1) Percent Exponentiation Multiplication and division Addition and subtraction Connects two strings of text (concatenation) Comparison
Use of parentheses
To change the order of evaluation, enclose in parentheses the part of the formula to be calculated first. For example, the following formula produces 11 because Excel calculates multiplication before addition. The formula multiplies 2 by 3 and then adds 5 to the result.
=5+2*3
51
In contrast, if you use parentheses to change the syntax, Excel adds 5 and 2 together and then multiplies the result by 3 to produce 21.
=(5+2)*3
In the example below, the parentheses around the first part of the formula force Excel to calculate B4+25 first and then divide the result by the sum of the values in cells D5, E5, and F5.
=(B4+25)/SUM(D5:F5)
Formulas are equations that perform calculations on values in your worksheet. A formula starts with an equal sign (=). For example, the following formula multiplies 2 by 3 and then adds 5 to the result.
=5+2*3
A formula can also contain any or all of the following: functions, references, operators, and constants.
Parts of a formula
Operators: The ^ (caret) operator raises a number to a power, and the * (asterisk) operator multiplies.
Create a simple formula with constants and calculation operators Create a formula with functions
52
Create a formula with nested functions Create a formula with references and names Create an array formula that calculates a single result Create an array formula that calculates multiple results Delete a formula Learn tips and tricks about creating formulas Avoid common errors when creating formulas
1.
2.
3.
4.
Press ENTER.
Top of Page
What it does Adds all numbers in column A Averages all numbers in the range
53
1.
Click the cell in which you want to enter the formula. To start the formula with the function, click Insert Function on the formula bar .
2.
3.
Select the function you want to use. You can enter a question that describes what you want to do in the Search for a function box (for example, "add numbers" returns the SUM function), or browse from the categories in the Or Select a category box.
4.
Enter the arguments. To enter cell references as an argument, click Collapse Dialog hides the dialog box), select the cells on the worksheet, and then press Expand Dialog .
(which temporarily
5.
Top of Page
The AVERAGE and SUM functions are nested within the IF function.
1.
Click the cell in which you want to enter the formula. To start the formula with the function, click Function Wizard on the formula bar .
2.
3.
Select the function you want to use. You can enter a question that describes what you want to do in the Search for a function box (for example, "add numbers" returns the SUM function), or browse from the categories in the Or Select a category box.
4.
54
(which temporarily hides the dialog box), select the cells on the worksheet, and then press Expand Dialog .
To enter another function as an argument, enter the function in the argument box that you want. For example, you can add SUM(G2:G5) in the Value_if_true edit box of the IF function.
The parts of the formula displayed in the Function Arguments dialog box reflect the function that you selected in the previous step. For example, if you clicked IF, Function arguments displays the arguments for the IF function.
1.
Top of Page
What it does Uses the value in the cell C2 Uses the value in cell B2 on Sheet2 Subtracts a cell named Liability from a cell named Asset
1.
Click the cell in which you want to enter the formula. In the formula bar , type = (equal sign).
2.
3.
To create a reference, select a cell, a range of cells, a location in another worksheet, or a location in another workbook. This behavior is called semi-selection. You can drag the border of the cell selection to move the selection, or drag the corner of the border to expand the selection.
55
The first cell reference is B3, the color is blue, and the cell range has a blue border with square corners.
The second cell reference is C3, the color is green, and the cell range has a green border with square corners.
NOTE
If there is no square corner on a color-coded border, then the reference is to a named range.
OK.
To enter a reference to a named range, press F3, select the name in the Paste name box, and click
4.
Press ENTER.
Top of Page
1.
Click the cell in which you want to enter the array formula.
2.
For example, the following calculates the total value of an array of stock prices and shares, without using a row of cells to calculate and display the individual values for each stock.
56
When you enter the formula {=SUM(B2:C2*B3:C3)} as an array formula, it multiples the Shares and Price for each stock, and then adds the results of those calculations together to get a total value of 9500.
3.
Press CTRL+SHIFT+ENTER.
IMPORTANT
When you edit the array formula, the braces ({ }) do not appear in the array formula, and you must press
CTRL+SHIFT+ENTER again.
Top of Page
1.
Select the range of cells in which you want to enter the array formula.
2.
For example, given a series of three sales figures (column B) for a series of three months (column A), the TREND function determines the straight-line values for the sales figures. To display all of the results of the formula, it is entered into three cells in column C (C1:C3).
When you enter the formula =TREND(B1:B3,A1:A3) as an array formula, it produces three separate results (22196, 17079, and 11962), based on the three sales figures and the three months.
3.
Press CTRL+SHIFT+ENTER.
57
IMPORTANT
When you edit the array formula, the braces ({ }) do not appear in the array formula, and you must press
CTRL+SHIFT+ENTER again.
Top of Page
Delete a formula
1. Click the cell that contains the formula.
2.
Press DELETE.
Top of Page
Use Formula Autocomplete To make it easier to create and edit formulas and minimize typing and syntax errors, use formula autocomplete. After you type an = (equal sign) and beginning letters or a display trigger, Excel displays below the cell a dynamic drop down list of valid functions, arguments, and names that match the letters or trigger. You can then insert an item in the drop-down list into the formula.
Use Function tooltips If you are familiar with the arguments of a function, you can use the function tooltip that appears after you type the function name and an opening parenthesis. Click the function name to view the Help topic on the function, or click an argument name to select the corresponding argument in your formula.
Top of Page
58
Use a colon to indicate a range Enter all required arguments Nest no more than seven functions Enclose other sheet names in single quotation marks
When you refer to a range of cells, use a colon (:) to separate the reference to the first cell in the range and the reference to the last cell in the range. Some functions have required arguments. Also, make sure that you have not entered too many arguments. You can enter, or nest, no more than seven levels of functions within a function.
If the formula refers to values or cells on other worksheets or workbooks and the name of the other workbook or worksheet contains a nonalphabetical character, you must enclose its name within single quotation marks ( ' ). Make sure that each external reference contains a workbook name and the path to the workbook.
Do not format numbers as you enter them in formulas. For example, even if the value that you want to enter is $1,000, enter 1000 in the formula.
Type the = (equal sign) and beginning letters or a display trigger to start Formula AutoComplete.
As you type, a scrollable list of valid items is displayed with the closest match highlighted.
59
Control the drop-down list by using display triggers Navigate the Formula AutoComplete drop-down list by using keys Enter an item from the drop-down list by using an insert trigger Turn Formula AutoComplete on or off
Function arguments
(No display trigger). Type the argument, such as a number or cell reference, or use a display trigger, such as beginning letters or an [ (opening bracket). Example: SUM(5, A2, [ For each subsequent argument, type a comma and then the argument or another display trigger. NOTE The following functions have arguments with enumerated constants that automatically display in the drop-down list: CELL, FV, HLOOKUP, MATCH, PMT, PV, RANK, SUBTOTAL, and VLOOKUP.
A letter or beginning letters where that name can be entered. Example: Ann
Table column specifiers and special item specifiers ([#All], [#Data], [#Headers], [#Totals], [#ThisRow])
60
: (colon) immediately after a column name. Example: AnnualSummary[Sales: NOTE If the cell is in a table, the table name is optional. For example, the following formulas would be the same: =[Sales]/[Costs] =AnnualSummary[Sales]/AnnualSummary[Costs]
" (opening quotation mark) immediately after the opening parenthesis of a Cube function name. Example: CUBEMEMBER(" NOTE listed. Only OLAP connections stored in the current workbook are
" (opening quotation mark) immediately after the comma for an argument. Example: CUBEMEMBER("SalesCubeData","
. (period) immediately after a closing bracket. Example: CUBEMEMBER("SalesCubeData","[Customers] . Example: CUBEMEMBER("SalesCubeData","[Customers]. [Mexico].
( (opening parenthesis) immediately after an opening quotation mark for an MDX text string to indicate the beginning of a tuple. Example: CUBEVALUE("SalesCubeData","(
, (comma) immediately after a closing bracket in an MDX text string to indicate the second part of a tuple. Example: CUBEVALUE("SalesCubeData","([Customers].[Mexico] ,
{ (opening brace) immediately after an opening quotation mark for an MDX text string to indicate the beginning of a set expression. Example: CUBEVALUE("SalesCubeData","{ NOTES
You must be connected to an OLAP data source to enter an MDX text string using Formula AutoComplete. If a caption is defined, it is displayed in a ScreenTip to help confirm the choice. If an MDX text string is ambiguous, then a unique member
61
name is still entered but you must decide if the correct one was entered. For example, if there are two values for the following MDX text string: CUBEMEMBER("SalesCubeData","[Customers].[Mexico].[Hidalgo]. [Dora N. Boots] One of the following values would be entered: [Customers].[Name].&[54342] [Customers].[Name].&[34297] If the one entered is not what you want, you would delete it, and then select the other one.
Microsoft SQL Server Analysis Services function names, such as "Children", "Parent", or "Crossjoin" are not displayed in the drop-down list, but you can still type them.
NOTES
At any time that you are using Formula AutoComplete, you can type what you want to finish the formula.
You can use Formula AutoComplete in the middle of an existing nested function or formula. The text immediately before the insertion point is used to display values in the drop-down list, and all of the text after the insertion point remains unchanged.
Defined names that you create for enumerated constants, such as the ones used in the SUBTOTAL function, and Cube function connections do not display in the AutoComplete drop-down list, but you can still type them.
Top of Page
RIGHT ARROW
62
Select the first item. Move down one page and select a new item. Move up one page and select a new item. Close the drop-down list. Turn on or off Formula AutoComplete.
HOME PAGE DOWN PAGE UP ESCAPE (or click another cell) ALT+DOWN ARROW
Top of Page
As you are typing a formula, even after using an insert trigger, don't forget to type the closing parenthesis for a
function, closing bracket for a table reference, or closing quotation mark for an MDX text string.
To insert the selected item into the formula and put the insertion point directly after it, press TAB, or double-click the item.
Top of Page
2.
Nested functions use a function as one of the arguments of another function. You can nest up to 64 levels of functions. The following formula sums a set of numbers (G2:G5) only if the average of another set of numbers (F2:F5) is greater than 50. Otherwise it returns 0.
The AVERAGE and SUM functions are nested within the IF function.
63
1.
Click the cell in which you want to enter the formula. To start the formula with the function, click Function Wizard on the formula bar .
2.
3.
Select the function you want to use. You can enter a question that describes what you want to do in the Search for a function box (for example, "add numbers" returns the SUM function), or browse from the categories in the Or Select a category box.
4.
want (which temporarily hides the dialog box), select the cells on the worksheet, and then click Expand Dialog .
To enter another function as an argument, enter the function in the argument box that you want. For example, you can add SUM(G2:G5) in the Value_if_true edit box of the IF function.
The parts of the formula displayed in the Function Arguments dialog box reflect the function that you selected in the previous step. For example, if you clicked IF, Function arguments displays the arguments for the IF function.
It's important to be aware of what can happen to cell references, whether they are absolute or relative, when you move a formula by cutting and pasting it, or copy a formula by copying and pasting it.
When you move a formula, the cell references within the formula do not change no matter what type of cell reference that you use.
When you copy a formula, the cell references may change based on the type of cell reference that you use.
64
Move a formula
1. Select the cell that contains the formula that you want to move.
2.
You can also move formulas by dragging the border of the selected cell to the upper-left cell of the paste area. Any existing data is replaced.
3.
To paste the formula and any formatting, on the Home tab, in the Clipboard group, click Paste.
To paste the formula only, on the Home tab, in the Clipboard group, click Paste, click Paste Special, and then click Formulas.
Top of Page
Copy a formula
1. Select the cell that contains the formula that you want to copy.
2.
3.
To paste the formula and any formatting, on the Home tab, in the Clipboard group, click Paste.
To paste the formula only, on the Home tab, in the Clipboard group, click Paste, click Paste Special, and then click Formulas.
NOTE
You can paste only the formula results. On the Home tab, in the Clipboard group, click Paste, click Paste
4.
Verify that the cell references in the formula produce the result that you want. If necessary, switch the type of reference by doing the following:
5.
65
1 1 Select the cell that contains the formula. 1 1 In the formula bar
, select the reference that you want to change.
If the reference is: $A$1 (absolute column and absolute row) A$1 (relative column and absolute row) $A1 (absolute column and relative row) A1 (relative column and relative row)
C$1 $A3 C3
NOTE
You can also copy formulas into adjacent cells by using the fill handle
in the formula produce the result that you want in step 4, select the cell that contains the copied formula, and then drag the fill handle over the range that you want to fill.
To make it easier to view and edit a long formula or large amount of text in a cell, you can adjust the size of the formula box in the formula bar. To accommodate long names, you can also resize the name box in the formula bar. The worksheet and formula bar work in tandem so that contents of both do not overlap.
66
Text
Let's say you want to convert text from uppercase to lowercase or from lowercase to proper case to make it more readable. To change the case of text, use the UPPER, LOWER, or PROPER functions.
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
67
Formula =UPPER(A2)
Description (Result) Changes text to all UPPERCASE (NANCY DAVOLIO) Changes text to all lowercase (nancy davolio)
=LOWER(A2 ) =PROPER(A 2)
UPPER
Show All
Syntax
UPPER(text)
Text is the text you want converted to uppercase. Text can be a reference or text string.
Example
1.
2.
NOTE
3.
Press CTRL+C.
4.
68
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 Data total
Yield
LOWER
Show All
Syntax
LOWER(text)
Text is the text you want to convert to lowercase. LOWER does not change characters in text that are not letters.
Example
1.
2.
NOTE
69
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
Formula =LOWER(A2)
Description (Result) Lower case of first string (e. e. cummings) Lower case of last string (apt. 2b)
=LOWER(A3)
PROPER
Show All
Capitalizes the first letter in a text string and any other letters in text that follow any character other than a letter. Converts all other letters to lowercase letters.
Syntax
PROPER(text)
Text is text enclosed in quotation marks, a formula that returns text, or a reference to a cell containing the text you want to partially capitalize.
Example
70
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
Proper case of second string (2-Cent'S Worth) Proper case of third string (76Budget)
Math
71
=5+10
15
Top of Page
1.
Click a cell below the column of numbers or to the right of the row of numbers.
2.
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
72
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 5 6 7 Salesperson Buchanan Buchanan Suyama Suyama Buchanan Dodsworth Formula =SUM(B2:B3, B5) =SUM(B2,B5,B 7)
B Invoice 15,000 9,000 8,000 20,000 5,000 22,500 Description (Result) Adds two invoices from Buchanan, and one from Suyama (44,000)
NOTE
Function details
SUM
Top of Page
You can use the SUMIF function to create a total value for one range based on a value in another range, as in the following example.
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 5 6 7 Salesperson Buchanan Buchanan Suyama Suyama Buchanan Dodsworth Formula =SUMIF(A2:A7,"Buchanan",B2 :B7) B Invoice 15,000 9,000 8,000 20,000 5,000 22,500 Description (Result) Sum of invoices for Buchanan (29000)
74
Sum of large invoices greater than or equal to 9,000 (66500) Sum of small invoices less than 9,000 (13000)
Range to evaluate: Check these cells to determine whether a row meets your criteria.
Criteria: The condition that the cells you evaluate must meet for the row to be included in the sum.
Range to sum: Add the numbers in these cells provided that the row satisfies the condition.
Function details
SUMIF
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
75
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 5 6 7 8 9 1 0 1 1 Region South West East North South South South East North South Formula =SUM(IF((A2:A11="South")*(C2:C11="Meat"),D2: D11)) =SUM(IF((A2:A11="South")+ (A2:A11="East"),D2:D11))
B Salesperson Buchanan Davolio Suyama Suyama Dodsworth Davolio Davolio Suyama Davolio Dodsworth Description (Result) Sum of Meat sales in the South region (14719) Sum of sales where the region is South or East (32753)
C Type Beverages Dairy Beverages Dairy Produce Meat Meat Produce Produce Meat
D Sales 3571 3338 5122 6239 8677 450 7673 664 1500 6596
NOTE
The formulas in the example must be entered as array formulas. After copying the example to a blank worksheet,
select the formula cell. Press F2, and then press CTRL+SHIFT+ENTER. If the formula is not entered as an array formula, the error #VALUE! is returned.
Function details
76
SUM
IF
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
77
A 1 2 3 4 5 6 7 8 9 1 0 1 1 Region South West East North South South South East North South Region South
B Salesperson Buchanan Davolio Suyama Suyama Dodsworth Davolio Davolio Suyama Davolio Dodsworth Salesperson
C Type Beverages Dairy Beverages Dairy Produce Meat Meat Produce Produce Meat Type Meat Produce
D Sales 3571 3338 5122 6239 8677 450 7673 664 1500 6596 Sales
Function details
DSUM
78
Top of Page
Add numbers based on multiple conditions with the Conditional Sum Wizard
If you want to summarize a range of cells based on specific conditions, you can use the Conditional Sum Wizard. For example, if your range of cells contain sales amounts for different salespeople, the Conditional Sum Wizard add-in program can help you create a formula that calculates the total sales amount for one salesperson.
1.
2.
If the Conditional Sum command or Solutions tab are not available, then you need to load the Conditional Sum Wizard add-in program.
1.
2.
Select Excel Add-ins in the Manage list box, and then click Go.
3.
In the Add-Ins available list, select the Conditional Sum Wizard check box, and then click OK.
3.
NOTE
The formulas created by the Conditional Sum Wizard are array formulas. After you edit these formulas, you must
Top of Page
FREQUENCY function to identify the unique values. For the first occurrence of a specific value, this function returns a number equal to the number of occurrences of that value. For each occurrence of that same value after the first, this function returns a 0 (zero).
79
Tip To see a function evaluated step by step, select the cell containing the formula, and then on the Formulas tab, in the Formula Auditing group, click Evaluate Formula.
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 5 6 Data 986
456
67
80
7 8 9 1 0
34
689
456
56
67
NOTE
The formulas in this example must be entered as array formulas. Select each cell that contains a formula, press F2,
Subtract numbers
Show All
Let's say you want to find out how many inventory items are not profitable (total inventory profitable items) or how many employees are approaching retirement age (total employees employees under 55). There are several ways to subtract numbers.
10-5
81
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 Data 15,000
9,000
82
-8,000
Description (Result) Subtracts 9,000 from 15,000 (6,000) Adds all numbers in the list, including negative numbers (16,000)
Multiply numbers
Show All
Let's say you want to figure out how much bottled water that you need for a customer conference (total attendees 4 days 3 bottles per day) or the reimbursement travel cost for a business trip (total miles .46). There are several ways to multiply numbers.
=5*10
50
Top of Page
83
1.
In an empty cell, enter the number that you want to multiply by.
2.
Select the cell, and on the Home tab, in the Clipboard group, click Copy
3.
4.
On the Home tab, in the Clipboard group, click the arrow below Paste, and then click Paste Special.
5.
6.
Click OK.
7.
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
84
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 Data 5
15
30
Description (Result) Multiplies the numbers in the first two cells (75) Multiplies all the numbers in the range (2250)
Divide numbers
Show All
Let's say you want to find out how many person hours it took to finish a project (total project hours total people on project) or the actual miles per gallon rate for your recent cross-country trip (total miles total gallons). There are several ways divide numbers.
=10/5
85
Top of Page
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 Data 15,000
12
Formul
Description (Result)
86
Calculate percentages
Show All
Let's say you want to calculate a sales tax for different states, compute a grade for a test score, or determine a percent change in sales between two fiscal quarters. There are several ways to calculate percentages.
amount/total = percentage
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
87
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
Sales tax (in decimal form) 0.089 Description (Result) Multiplies 800 by 0.089 to find the amount of sales tax to pay ($71.20)
NOTE
To convert a number in percentage format to a decimal, divide it by 100. For example, the sales tax in this example
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
88
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
Total points possible 50 Description (Result) Divides 42 by 50 to find the percentage of correct answers (0.84 or 84%)
NOTE
You can view the number as a percentage. Select the cell, and then on the Home tab, in the Number group, click .
Percent Style
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
89
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
B 100% minus the discount (in decimal form) 0.75 Description (Result) Divides 15 by 0.75 to find the original price (20)
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
90
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
December earnings 2500 Description (Result) Divides the difference between the second and first numbers by the absolute value of the first number to get the percentage change (0.06746 or 6.75%)
NOTE
You can view the number as a percentage. Select the cell, and then on the Home tab, in the Number group, click .
Percent Style
Function details
ABS
Top of Page
For example, you spend an average of $25 on food each week, and you want to cut your weekly food expenditures by 25%. How much can you spend? Or, if you want to increase your weekly food allowance of $25 by 25%, what is your new weekly allowance?
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 Number 25 Formula =A2*(1-B2) B Percentage 25% Description (Result) Decreases 25 by 25% (18.75) Increases 25 by 25% (31.75) Increases 25 by 35% (33.75)
=A2*(1+B2) =A2*(1+35 %)
92
NOTE
When you type a number followed by a percent sign (%), the number is interpreted as a hundredth of its value. For
Calculate percentages
Show All
Let's say you want to calculate a sales tax for different states, compute a grade for a test score, or determine a percent change in sales between two fiscal quarters. There are several ways to calculate percentages.
amount/total = percentage
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
93
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
Sales tax (in decimal form) 0.089 Description (Result) Multiplies 800 by 0.089 to find the amount of sales tax to pay ($71.20)
NOTE
To convert a number in percentage format to a decimal, divide it by 100. For example, the sales tax in this example
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
94
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
Total points possible 50 Description (Result) Divides 42 by 50 to find the percentage of correct answers (0.84 or 84%)
NOTE
You can view the number as a percentage. Select the cell, and then on the Home tab, in the Number group, click .
Percent Style
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
95
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
B 100% minus the discount (in decimal form) 0.75 Description (Result) Divides 15 by 0.75 to find the original price (20)
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
96
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
December earnings 2500 Description (Result) Divides the difference between the second and first numbers by the absolute value of the first number to get the percentage change (0.06746 or 6.75%)
NOTE
You can view the number as a percentage. Select the cell, and then on the Home tab, in the Number group, click .
Percent Style
Function details
ABS
Top of Page
97
For example, you spend an average of $25 on food each week, and you want to cut your weekly food expenditures by 25%. How much can you spend? Or, if you want to increase your weekly food allowance of $25 by 25%, what is your new weekly allowance?
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 Number 25 Formula =A2*(1-B2) B Percentage 25% Description (Result) Decreases 25 by 25% (18.75) Increases 25 by 25% (31.75) Increases 25 by 35% (33.75)
=A2*(1+B2) =A2*(1+35 %)
98
NOTE
When you type a number followed by a percent sign (%), the number is interpreted as a hundredth of its value. For
Let's say you want to find out who has the the smallest error rate in a production run at a factory or the largest salary in your department. There are several ways to calculate the smallest or largest number in a range.
2.
On the Home tab, in the Editing group, click the arrow next to AutoSum or Max (calculates the largest), and then press ENTER.
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
99
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 5 6 7 27 Data 10
Description (Result) Smallest number in the range (0) Largest number in the range (27) Second smallest number in the range (4) Third largest number in the range (9)
Let's say you have six bells, each with a different tone, and you want to find the number of unique sequences in which each bell can be rung once. In this example, you are calculating the factorial of six. In general, use a factorial to count the number of
100
ways in which a group of distinct items can be arranged (also called permutations). To calculate the factorial of a number, use the FACT function.
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 Data 6
Formula =FACT(A2)
Description (Result) Factorial of 6, or 6*5*4*3*2*1 (720) Factorial of 3, or 3*2*1 (6) Factorial of 10 (3628800)
=FACT(3) =FACT(A2+ 4)
101
Let's say you want to help your daughter better understand math concepts by dynamically creating a multiplication table. You can use a two-variable data table.
1.
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
2.
A 1 2 3 1 1 =A1*A
102
3.
Enter a row of values from B3 to the right, for example, 1 through 10.
4.
5.
6.
On the Data tab, in the Data Tools group, click What-If Analysis, and then click Data Table.
7.
8.
9.
Click OK.
10.
Optionally, you can freeze the data table by converting the result to their values.
Round a number
Show All
Let's say you want to round a number to the nearest whole number because decimal values are not significant to you or round a number to multiples of 10 to simplify an approximation of amounts. There are several ways to round a number.
103
Change the number of decimal places displayed, without changing the number
On a worksheet
1. Select the cells that you want to format.
2.
To display more or fewer digits after the decimal point, on the Home tab, in the Number group, click Increase Decimal or Decrease Decimal .
2.
3.
In the Decimal places box, enter the number of decimal places that you want to display.
Top of Page
Round a number up
To do this task, use the ROUNDUP, EVEN, or ODD functions.
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
104
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 Data 20.3
-5.9
12.5493
Rounds 12.5493 up to the nearest hundredth, two decimal places (12.55) Rounds 20.3 up to the nearest even number (22) Rounds 20.3 up to the nearest odd number (21)
Function details
ROUNDUP
EVEN
ODD
Top of Page
Example
105
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 Data 20.3
-5.9
12.5493
Description (Result) Rounds 20.3 down to the nearest whole number ( 20)
Rounds the number down to the nearest hundredth, two decimal places ( 12.54)
Functions details
106
ROUNDDOWN
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 Data 20.3
5.9
107
-5.9
Description (Result) Rounds 20.3 down, because the fractional part is less than . 5 (20) Rounds 5.9 up, because the fractional part is greater than .5 (6) Rounds -5.9 down, because the fractional part is less than -.5 (-6)
Function details
ROUND
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
108
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 Data 1.25
30.452
Description (Result) Rounds the number to the nearest tenth (one decimal place). Because the portion to be rounded is 0.05 or greater, the number is rounded up (result: 1.3) Rounds the number to the nearest hundredth (two decimal places). Because the portion to be rounded, 0.002, is less than 0.005, the number is rounded down (result: 30.45)
Functions details
ROUND
Top of Page
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
109
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 Data 5492820
22230
Description (Result) Rounds the top number to 3 significant digits (5490000) Rounds the bottom number down to 3 significant digits (22200) Rounds the top number up to 5 significant digits (5492900)
Function details
ROUNDUP
ROUNDDOWN
ROUND
LEN, LENB
INT
Top of Page
110
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 4 5 Formula =MROUND(16, 5) =MROUND(-16, -5) =MROUND(2.6, 0.08) =MROUND(5, -2) B Description (Result) Rounds 16 to a nearest multiple of 5 (15) Rounds -16 to a nearest multiple of -5 (-15) Rounds 2.6 to a nearest multiple of 0.08 (2.64)
Function details
111
MROUND
Top of Page
Let's say you want to calculate an extremely small tolerance level for a machined part or the vast distance between two galaxies. To raise a number to a power, use the "^" operator or the POWER function.
Example
The example may be easier to understand if you copy it to a blank worksheet.
1.
2.
NOTE
3.
Press CTRL+C.
4.
5.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
A 1 2 3 Formula =POWER(5, 2) =5^3 B Description (Result) Calculates five squared (25) Calculates five cubed (125)
112
113