MS Excel 2007 Advanced
MS Excel 2007 Advanced
Advanced
Microsoft Excel 2007 Advanced
3
Create scenarios ......................................................................................................................................... 96
Summarize scenarios ................................................................................................................................ 96
Working with Goal seek ............................................................................................................97
EXCEL 2007 - AUDITING .........................................................................................................98
Tracing precedent cells.............................................................................................................................. 98
Tracing dependants of a cell..................................................................................................................... 98
Displaying all formulas within a worksheet ........................................................................................... 98
Using comments .....................................................................................................................100
Inserting comments .................................................................................................................................100
Deleting Comments .................................................................................................................................100
Navigating Comments .............................................................................................................................100
Show/Hide Comments ............................................................................................................................100
EXCEL 2007 - MACROS ........................................................................................................101
Displaying the Developer tab..................................................................................................................101
Recording and running a macro.............................................................................................................101
Lowering your macro security level .......................................................................................................102
Customizing the Quick Access Toolbar ...................................................................................103
Adding Command button ........................................................................................................................103
Removing Command Button ..................................................................................................................103
Resetting Quick Access Toolbar .............................................................................................................103
Changing the Quick Toolbar Macro icon ...............................................................................................103
Removing a macro icon from the quick access toolbar .....................................................................103
Raising your macro security level ..........................................................................................................103
EXCEL 2007 – FUNCTIONS
Getting help with using a particular function.
1. Using Help:
Press F1 Type List of functions Select list of functions alphabetically Select the
desired function
MS Excel has the feature of contextual help, simply type = and function name in a cell and just
click on it.
Figure 1
TODAY function
Returns the serial number of the current date. The serial number is the date-time code used by
Excel for date and time calculations. If the cell format was General before the function was
entered, Excel changes the cell format to Date. If you want to view the serial number, you must
change the cell format to General or Number.
5
The TODAY function is useful when you need to have the current date displayed on a worksheet,
regardless of when you open the workbook. It is also useful for calculating intervals. For
example, if you know that someone was born in 1963, you might use the following formula to
find that person's age as of this year's birthday:
=YEAR(TODAY())-1963
This formula uses the TODAY function as an argument for the YEAR function to obtain the
current year, and then subtracts 1963, returning the person's age.
Note If the TODAY function does not update the date when you expect it to, you might need to
change the settings that control when the workbook or worksheet recalculates. On the File tab,
click Options, and then in the Formulas category under Calculation options, make sure that
Automatic is selected.
Syntax
=TODAY()
Note: Excel stores dates as sequential serial numbers so they can be used in calculations. By
default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448
because it is 39,447 days after January 1, 1900. Microsoft Excel for the Macintosh uses a
different date system as its default.
Example
A B
1 Formula Description
DAY function
Returns the day of a date, represented by a serial number. The day is given as an integer ranging
from 1 to 31.
Syntax
DAY(serial_number)
Serial_number Required. The date of the day you are trying to find. Dates should be
entered by using the DATE function, or as results of other formulas or functions. For
example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates
are entered as text.
Remarks
Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By
default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448
because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a
different date system as its default.
Values returned by the YEAR, MONTH and DAY functions will be Gregorian values regardless of
the display format for the supplied date value. For example, if the display format of the supplied
date is Hijri, the returned values for the YEAR, MONTH and DAY functions will be values
associated with the equivalent Gregorian date.
7
Example
A B
1 Date
2 15-Apr-2008
MONTH function
Returns the month of a date represented by a serial number. The month is given as an integer,
ranging from 1 (January) to 12 (December).
Syntax
MONTH (serial_number)
Serial_number Required. The date of the month you are trying to find. Dates should be
entered by using the DATE function, or as results of other formulas or functions. For
example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates
are entered as text.
Example
A B
1 Date
2 15-Apr-2008
Syntax
YEAR(serial_number)
Serial_number Required. The date of the year you want to find. Dates should be entered by
using the DATE function, or as results of other formulas or functions. For example, use
DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered
as text.
Example
A B
1 Date
2 7/5/2008
3 7/5/10
4 Formula Description (Result)
5 =YEAR(A2) Year of the first date (2008)
6 =YEAR(A3) Year of the second date (2010)
SUMIF function
You use the SUMIF function to sum the values in a range that meet criteria that you specify. For
example, suppose that in a column that contains numbers, you want to sum only the values that
are larger than 5. You can use the following formula:
=SUMIF(B2:B25,">5")
In this example, the criteria is applied the same values that are being summed. If you want, you
can apply the criteria to one range and sum the corresponding values in a different range. For
example, the formula =SUMIF(B2:B5, "John", C2:C5) sums only the values in the range C2:C5,
where the corresponding cells in the range B2:B5 equal "John."
Syntax
9
The SUMIF function syntax has the following arguments:
range Required. 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 Required. The criteria in the form of a number, expression, a cell reference, text, or
a function that defines which cells will be added. For example, criteria can be expressed as
32, ">32", B5, 32, "32", "apples", or TODAY().
Important Any text criteria or any criteria that includes logical or mathematical symbols must
be enclosed in double quotation marks ("). If the criteria is numeric, double quotation marks are
not required.
sum_range Optional. The actual cells to add, if you want to add cells other than those
specified in the range argument. If the sum_range argument is omitted, Excel adds the cells
that are specified in the range argument (the same cells to which the criteria is applied).
Notes
The sum_range argument does not have to be the same size and shape as the range
argument. The actual cells that are added are determined by using theupper leftmost cell in
the sum_range argument as the beginning cell, and then including cells that correspond in
size and shape to the range argument. For example:
A B C
1 Property Value Commission Data
2 100,000 7,000 250,000
3 200,000 14,000
4 300,000 21,000
5 400,000 28,000
6 Formula Description Result
=SUMIF(A2:A5,">160000",B2:B5) Sum of the commissions 63,000
7 for property values over
160,000.
8 =SUMIF(A2:A5,">160000") Sum of the property values 900,000
over 160,000.
9 =SUMIF(A2:A5,300000,B2:B5) Sum of the commissions 21,000
for property values equal to
300,000.
10 =SUMIF(A2:A5,">" & C2,B2:B5) Sum of the commissions 49,000
for property values greater
than the value in C2.
Example 2
A B C
1 Category Food Sales
2 Vegetables Tomatoes 2300
3 Vegetables Celery 5500
4 Fruits Oranges 800
5 Butter 400
6 Vegetables Carrots 4200
7 Fruits Apples 1200
8 Formula Description Result
=SUMIF(A2:A7,"Fruits",C2:C7) Sum of the sales of all 2000
9 foods in the "Fruits"
category.
10 =SUMIF(A2:A7,"Vegetables",C2:C7) Sum of the sales of all 12000
11
foods in the "Vegetables"
category.
11
=SUMIF(B2:B7,"*es",C2:C7) Sum of the sales of all 4300
foods that end in "es"
12 (Tomatoes, Oranges, and
Apples).
=SUMIF(A2:A7,"",C2:C7) Sum of the sales of all 400
foods that do not have a
category specified.
ROUND function
The ROUND function rounds a number to a specified number of digits. For example, if cell A1
contains 23.7825, and you want to round that value to two decimal places, you can use the
following formula:
=ROUND(A1, 2)
Syntax
ROUND(number, num_digits)
num_digits Required. The number of digits to which you want to round the number
argument.
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, the number is rounded to the left of the decimal point.
To round a number to a specific multiple (for example, to round to the nearest 0.5), use the
MROUND function.
Example
A B C
1 Formula Description Result
=ROUND(2.15, 1) Rounds 2.15 to one decimal place 2.2
2
=ROUND(2.149, Rounds 2.149 to one decimal place 2.1
1)
3
=ROUND(-1.475, Rounds -1.475 to two decimal places -1.48
2)
4
=ROUND(21.5, -1) Rounds 21.5 to one decimal place to the left 20
of the decimal point
5
COUNT function
The COUNT function counts the number of cells that contain numbers, and counts numbers
within the list of arguments. Use the COUNT function to get the number of entries in a number
field that is in a range or array of numbers. For example, you can enter the following formula to
count the numbers in the range A1:A20:
=COUNT(A1:A20)
In this example, if five of the cells in the range contain numbers, the result is 5.
Syntax
value1 Required. The first item, cell reference, or range within which you want to count
numbers.
value2, ... Optional. Up to 255 additional items, cell references, or ranges within which you
want to count numbers.
Note: The arguments can contain or refer to a variety of different types of data, but only
numbers are counted.
Remarks
Arguments that are numbers, dates, or a text representation of numbers (for example, a
number enclosed in quotation marks, such as "1") are counted.
13
Logical values and text representations of numbers that you type directly into the list of
arguments are counted.
Arguments that are error values or text that cannot be translated into numbers are not
counted.
If you want to count logical values, text, or error values, use the COUNTA function.
If you want to count only numbers that meet certain criteria, use the COUNTIF function or
the COUNTIFS function.
Example
A B C
1 Data
2 Sales
3 12/8/2008
4
5 19
6 22.24
7 TRUE
8 #DIV/0!
9 Formula Description Result
=COUNT(A2:A8) Counts the number of cells that contain 3
10 numbers in cells A2 through A8.
=COUNT(A5:A8) Counts the number of cells that contain 2
11 numbers in cells A5 through A8.
=COUNT(A2:A8,2) Counts the number of cells that contain 4
12 numbers in cells A2 through A8, and the
value 2
COUNTA function
The COUNTA function counts the number of cells that are not empty in a range.
Syntax
COUNTA(value1, [value2], ...)
value1 Required. The first argument representing the values that you want to count.
value2, ... Optional. Additional arguments representing the values that you want to count,
up to a maximum of 255 arguments.
Remarks
The COUNTA function counts cells containing any type of information, including error values
and empty text (""). For example, if the range contains a formula that returns an empty
string, the COUNTA function counts that value. The COUNTA function does not count empty
cells.
If you do not need to count logical values, text, or error values (in other words, if you want to
count only cells that contain numbers), use the COUNT function.
If you want to count only cells that meet certain criteria, use the COUNTIF function or the
COUNTIFS function.
Example
A B C
1 Data
2 Sales
3 12/8/2008
4
5 19
6 22.24
7 TRUE
8 #DIV/0!
9 Formula Description Result
=COUNTA(A2:A8) Counts the number of nonblank cells in cells 6
10 A2 through A8.
COUNTIF function
The COUNTIF function counts the number of cells within a range that meet a single criterion that
you specify. For example, you can count all the cells that start with a certain letter, or you can
count all the cells that contain a number that is larger or smaller than a number you specify. For
15
example, suppose you have a worksheet that contains a list of tasks in column A, and the first
name of the person assigned to each task in column B. You can use the COUNTIF function to
count how many times a person's name appears in column B and, in that way, determine how
many tasks are assigned to that person. For example:
=COUNTIF(B2:B25,"Nancy")
Syntax
COUNTIF(range, criteria)
range Required. One or more cells to count, including numbers or names, arrays, or
references that contain numbers. Blank and text values are ignored.
criteria Required. A number, expression, cell reference, or text string that defines which
cells will be counted. For example, criteria can be expressed as 32, ">32", B4, "apples", or
"32".
Notes
You can use the wildcard characters — the question mark (?) and the asterisk (*) — in
criteria. A question mark matches any single character, and an asterisk matches any
sequence of characters. If you want to find an actual question mark or asterisk, type a tilde
(~) before the character.
Criteria are case insensitive; for example, the string "apples" and the string "APPLES" will
match the same cells.
Example
Example 1:
A B C
1 Data Data
2 apples 32
3 oranges 54
4 peaches 75
5 apples 86
6 Formula Description Result
=COUNTIF(A2:A5,"apples") Number of cells with 2
7 apples in cells A2
through A5.
8 =COUNTIF(A2:A5,A4) Number of cells with 1
peaches in cells A2
through A5.
9
=COUNTIF(A2:A5,A3)+COUNTIF(A2:A5,A2) Number of cells with 3
oranges and apples
10
in cells A2 through
A5.
11
=COUNTIF(B2:B5,">55") Number of cells with 2
a value greater than
55 in cells B2
12 through B5.
=COUNTIF(B2:B5,"<>"&B4) Number of cells with 3
a value not equal to
75 in cells B2
through B5.
=COUNTIF(B2:B5,">=32")- Number of cells with 3
COUNTIF(B2:B5,">85") a value greater than
or equal to 32 and
less than or equal to
85 in cells B2
through B5.
Example 2: COUNTIF formulas using wildcard characters and handling blank values
A B C
1 Data Data
2 apples Yes
3
4 oranges NO
5 peaches No
6
7 apples yes
8 Formula Description Result
17
=COUNTIF(A2:A7,"*es") Number of cells 4
ending with the letters
"es" in cells A2
9 through A7.
=COUNTIF(A2:A7,"?????es") Number of cells 2
ending with the letters
"les" and having
exactly 7 letters in
10 cells A2 through A7.
=COUNTIF(A2:A7,"*") Number of cells 4
containing any text in
11 cells A2 through A7.
=COUNTIF(A2:A7,"<>"&"*") Number of cells not 2
containing text in cells
12 A2 through A7.
=COUNTIF(B2:B7,"No") / The average number 0.333333333
ROWS(B2:B7) of No votes (including
blank cells) in cells B2
13 through B7.
=COUNTIF(B2:B7,"Yes") / The average number 0.5
(ROWS(B2:B7) -COUNTIF(B2:B7, of Yes votes
"<>"&"*")) (excluding blank cells)
14 in cells B2 through
B7.
PROPER function
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 Required. 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
A B
1 Data
2 this is a TITLE
3 2-cent's worth
4 76BudGet
5 Formula Description (Result)
6 =PROPER(A2) Proper case of first string (This Is A Title)
7 =PROPER(A3) Proper case of second string (2-Cent'S Worth)
8 =PROPER(A4) Proper case of third string (76Budget)
UPPER function
Converts text to uppercase.
Syntax
UPPER(text)
Text Required. The text you want converted to uppercase. Text can be a reference or text
string.
Example
A B
1 Data
2 total
3 Yield
4 Formula Description (Result)
5 =UPPER(A2) Upper case of first string (TOTAL)
6 =UPPER(A3) Upper case of second string (YIELD)
LOWER function
Converts all uppercase letters in a text string to lowercase.
Syntax
LOWER(text)
19
Text Required. The text you want to convert to lowercase. LOWER does not change
characters in text that are not letters.
Example
A B
1 Data
2 E. E. Cummings
3 Apt. 2B
4 Formula Description (Result)
5 =LOWER(A2) Lower case of first string (e. e. cummings)
6 =LOWER(A3) Lower case of last string (apt. 2b)
CONCATENATE function
The CONCATENATE function joins up to 255 text strings into one text string. The joined items can
be text, numbers, cell references, or a combination of those items. For example, if your
worksheet contains a person's first name in cell A1 and the person's last name in cell B1, you
can combine the two values in another cell by using the following formula:
=CONCATENATE(A1," ",B1)
The second argument in this example (" ") is a space character. You must specify any spaces or
punctuation that you want to appear in the results as an argument that is enclosed in quotation
marks.
Syntax
Text2, ... Optional. Additional text items, up to a maximum of 255 items. The items must
be separated by commas.
Note You can also use the ampersand (&) calculation operator instead of the CONCATENATE
function to join text items. For example,
=A1 & B1
Example
A B C
1 Data
2 brook trout Andreas Hauser
3 species Fourth Pine
4 32
5 Formula Description Result
=CONCATENATE("Stream Creates a sentence by Stream
population for ", A2, " ", A3, " concatenating the data in population for
is ", A4, "/mile") column A with other text. brook trout
species is
6 32/mile
=CONCATENATE(B2, " ", C2) Concatenates the string in Andreas
cell B2, a space character, Hauser
and the value in cell C2.
=CONCATENATE(C2, ", ", B2) Concatenates the string in Hauser,
7
cell C2, a string consisting Andreas
of a comma and a space
character, and the value in
cell B2.
=CONCATENATE(B3, " & ", Concatenates the string in Fourth & Pine
C3) cell B3, a string consisting
of a space, an ampersand,
8
another space, and the
value in cell C3.
=B3 & " & " & C3 Concatenates the same Fourth & Pine
items as the previous
example, but by using the
ampersand (&) calculation
operator instead of the
9
CONCATENATE function.
FV function
Returns the future value of an investment based on periodic, constant payments and a constant
interest rate.
Syntax
21
FV(rate,nper,pmt,[pv],[type])
For a more complete description of the arguments in FV and for more information on annuity
functions, see PV.
Pmt Required. The payment made each period; it cannot change over the life of the
annuity. Typically, pmt contains principal and interest but no other fees or taxes. If pmt is
omitted, you must include the pv argument.
Pv Optional. The present value, or the lump-sum amount that a series of future payments is
worth right now. If pv is omitted, it is assumed to be 0 (zero), and you must include the pmt
argument.
Type Optional. The number 0 or 1 and indicates when payments are due. If type is omitted,
it is assumed to be 0.
Remarks
Make sure that you are consistent about the units you use for specifying rate and nper. If
you make monthly payments on a four-year loan at 12 percent annual interest, use
12%/12 for rate and 4*12 for nper. If you make annual payments on the same loan, use
12% for rate and 4 for nper.
For all the arguments, cash you pay out, such as deposits to savings, is represented by
negative numbers; cash you receive, such as dividend checks, is represented by positive
numbers.
Examples
Example 1
A B
1 Data Description
2 6% Annual interest rate
3 10 Number of payments
4 -200 Amount of the payment
5 -500 Present value
1 Payment is due at the beginning of the period (see
6 above)
7 Formula Description (Result)
=FV(A2/12, A3, A4, A5, Future value of an investment with the above terms
8 A6) (2581.40)
Note: The annual interest rate is divided by 12 because it is compounded monthly.
Example 2
A B
1 Data Description
2 12% Annual interest rate
3 12 Number of payments
4 -1000 Amount of the payment
5 Formula Description (Result)
=FV(A2/12, A3, Future value of an investment with the above terms
6 A4) (12,682.50)
Note: The annual interest rate is divided by 12 because it is compounded monthly.
Example 3
A B
1 Data Description
2 11% Annual interest rate
3 35 Number of payments
4 -2000 Amount of the payment
1 Payment is due at the beginning of the year (see
5 above)
6 Formula Description (Result)
=FV(A2/12, A3, A4,, Future value of an investment with the above terms
23
7 A5) (82,846.25)
Note: The annual interest rate is divided by 12 because it is compounded monthly.
Example 4
A B
1 Data Description
2 6% Annual interest rate
3 12 Number of payments
4 -100 Amount of the payment
5 -1000 Present value
1 Payment is due at the beginning of the year (see
6 above)
7 Formula Description (Result)
=FV(A2/12, A3, A4, A5, Future value of an investment with the above terms
8 A6) (2301.40)
Note: The annual interest rate is divided by 12 because it is compounded monthly.
NPV function
Calculates the net present value of an investment by using a discount rate and a series of future
payments (negative values) and income (positive values).
Syntax
NPV(rate,value1,[value2],...)
Rate Required. The rate of discount over the length of one period.
Value1, value2, ... Value1 is required, subsequent values are optional. 1 to 254 arguments
representing the payments and income.
Value1, value2, ... must be equally spaced in time and occur at the end of each
period.
NPV uses the order of value1, value2, ... to interpret the order of cash flows. Be sure
to enter your payment and income values in the correct sequence.
Arguments that are empty cells, logical values, or text representations of numbers,
error values, or text that cannot be translated into numbers are ignored.
If an argument is an array or reference, only numbers in that array or reference are
counted. Empty cells, logical values, text, or error values in the array or reference
are ignored.
Remarks
The NPV investment begins one period before the date of the value1 cash flow and ends
with the last cash flow in the list. The NPV calculation is based on future cash flows. If your
first cash flow occurs at the beginning of the first period, the first value must be added to
the NPV result, not included in the values arguments. For more information, see the
examples below.
If n is the number of cash flows in the list of values, the formula for NPV is:
NPV is similar to the PV function (present value). The primary difference between PV and
NPV is that PV allows cash flows to begin either at the end or at the beginning of the period.
Unlike the variable NPV cash flow values, PV cash flows must be constant throughout the
investment. For information about annuities and financial functions, see PV.
NPV is also related to the IRR function (internal rate of return). IRR is the rate for which NPV
equals zero: NPV(IRR(...), ...) = 0.
Example 1
A B
1 Data Description
2 10% Annual discount rate
3 -10,000 Initial cost of investment one year from today
4 3,000 Return from first year
5 4,200 Return from second year
6 6,800 Return from third year
7 Formula Description (Result)
8 =NPV(A2, A3, A4, A5, A6) Net present value of this investment (1,188.44)
In the preceding example, you include the initial $10,000 cost as one of the values, because the
payment occurs at the end of the first period.
Example 2
25
A B
1 Data Description
8% Annual discount rate. This might represent the rate of
2 inflation or the interest rate of a competing investment.
3 -40,000 Initial cost of investment
4 8,000 Return from first year
5 9,200 Return from second year
6 10,000 Return from third year
7 12,000 Return from fourth year
8 14,500 Return from fifth year
9 Formula Description (Result)
=NPV(A2, Net present value of this investment (1,922.06)
10 A4:A8)+A3
=NPV(A2, A4:A8, - Net present value of this investment, with a loss in the
11 9000)+A3 sixth year of 9000 (-3,749.47)
In the preceding example, you don't include the initial $40,000 cost as one of the values,
because the payment occurs at the beginning of the first period.
PMT function
Calculates the payment for a loan based on constant payments and a constant interest rate.
Syntax
Note For a more complete description of the arguments in PMT, see the PV function.
Pv Required. The present value, or the total amount that a series of future payments is
worth now; also known as the principal.
Fv Optional. The future value, or a cash balance you want to attain after the last payment is
made. If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
Type Optional. The number 0 (zero) or 1 and indicates when payments are due.
Set type equal to If payments are due
0 or omitted At the end of the period
1 At the beginning of the period
Remarks
The payment returned by PMT includes principal and interest but no taxes, reserve
payments, or fees sometimes associated with loans.
Make sure that you are consistent about the units you use for specifying rate and nper. If
you make monthly payments on a four-year loan at an annual interest rate of 12 percent,
use 12%/12 for rate and 4*12 for nper. If you make annual payments on the same loan,
use 12 percent for rate and 4 for nper.
Tip To find the total amount paid over the duration of the loan, multiply the returned PMT value
by nper.
27
Example 1
A B
1 Data Description
2 8% Annual interest rate
3 10 Number of months of payments
4 10000 Amount of loan
5 Formula Description (Result)
=PMT(A2/12, A3, Monthly payment for a loan with the above terms (-
6 A4) 1,037.03)
=PMT(A2/12, A3, Monthly payment for a loan with the above terms, except
A4, 0, 1) payments are due at the beginning of the period (-
7 1,030.16)
Example 2
You can use PMT to determine payments to annuities other than loans.
A B
1 Data Description
2 6% Annual interest rate
3 18 Years you plan on saving
4 50,000 Amount you want to have save in 18 years
5 Formula Description (Result)
=PMT(A2/12, A3*12, Amount to save each month to have 50,000 at the
6 0, A4) end of 18 years (-129.08)
Note The interest rate is divided by 12 to get a monthly rate. The number of years the money
is paid out is multiplied by 12 to get the number of payments.
PV function
Description
Returns the present value of an investment. The present value is the total amount that a series
of future payments is worth now. For example, when you borrow money, the loan amount is the
present value to the lender.
Syntax
Rate Required. The interest rate per period. For example, if you obtain an automobile loan
at a 10 percent annual interest rate and make monthly payments, your interest rate per
month is 10%/12, or 0.83%. You would enter 10%/12, or 0.83%, or 0.0083, into the
formula as the rate.
Nper Required. The total number of payment periods in an annuity. For example, if you get
a four-year car loan and make monthly payments, your loan has 4*12 (or 48) periods. You
would enter 48 into the formula for nper.
Pmt Required. The payment made each period and cannot change over the life of the
annuity. Typically, pmt includes principal and interest but no other fees or taxes. For
example, the monthly payments on a $10,000, four-year car loan at 12 percent are
$263.33. You would enter -263.33 into the formula as the pmt. If pmt is omitted, you must
include the fv argument.
Fv Optional. The future value, or a cash balance you want to attain after the last payment is
made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
For example, if you want to save $50,000 to pay for a special project in 18 years, then
$50,000 is the future value. You could then make a conservative guess at an interest rate
and determine how much you must save each month. If fv is omitted, you must include the
pmt argument.
Type Optional. The number 0 or 1 and indicates when payments are due.
Make sure that you are consistent about the units you use for specifying rate and nper. If
you make monthly payments on a four-year loan at 12 percent annual interest, use
12%/12 for rate and 4*12 for nper. If you make annual payments on the same loan, use
12% for rate and 4 for nper.
CUMIPMT PPMT
CUMPRINC PV
FV RATE
FVSCHEDULE XIRR
29
IPMT XNPV
PMT
An annuity is a series of constant cash payments made over a continuous period. For
example, a car loan or a mortgage is an annuity. For more information, see the description
for each annuity function.
In annuity functions, cash you pay out, such as a deposit to savings, is represented by a
negative number; cash you receive, such as a dividend check, is represented by a positive
number. For example, a $1,000 deposit to the bank would be represented by the argument
-1000 if you are the depositor and by the argument 1000 if you are the bank.
Microsoft Excel solves for one financial argument in terms of the others. If rate is not 0,
then:
If rate is 0, then:
(pmt * nper) + pv + fv = 0
Example
A B
1 Data Description
500 Money paid out of an insurance
2 annuity at the end of every month
3 8% Interest rate earned on the money
paid out
4
20 Years the money will be paid out
5
Formula Description (Result)
6 =PV(A3/12, 12*A4, A2, , Present value of an annuity with the
0) terms above (-59,777.15).
The result is negative because it represents money that you would pay, an outgoing cash flow. If
you are asked to pay (60,000) for the annuity, you would determine this would not be a good
investment because the present value of the annuity (59,777.15) is less than what you are
asked to pay.
Note The interest rate is divided by 12 to get a monthly rate. The years the money is paid out
is multiplied by 12 to get the number of payments.
RATE function
Description
Returns the interest rate per period of an annuity. RATE is calculated by iteration and can have
zero or more solutions. If the successive results of RATE do not converge to within 0.0000001
after 20 iterations, RATE returns the #NUM! error value.
Syntax
Note For a complete description of the arguments nper, pmt, pv, fv, and type, see PV.
Pmt Required. The payment made each period and cannot change over the life of the
annuity. Typically, pmt includes principal and interest but no other fees or taxes. If pmt is
omitted, you must include the fv argument.
Pv Required. The present value — the total amount that a series of future payments is
worth now.
Fv Optional. The future value, or a cash balance you want to attain after the last payment is
made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
Type Optional. The number 0 or 1 and indicates when payments are due.
If RATE does not converge, try different values for guess. RATE usually converges if
guess is between 0 and 1.
Remarks
Make sure that you are consistent about the units you use for specifying guess and nper. If you
make monthly payments on a four-year loan at 12 percent annual interest, use 12%/12 for
31
guess and 4*12 for nper. If you make annual payments on the same loan, use 12% for guess
and 4 for nper.
Example
A B
1 Data Description
2 4 Years of the loan
3 -200 Monthly payment
4 8000 Amount of the loan
5 Formula Description (Result)
=RATE(A2*12, A3, A4) Monthly rate of the loan with the above terms (1%)
6
=RATE(A2*12, A3, Annual rate of the loan with the above terms
A4)*12 (0.09241767 or 9.24%)
7
Note The number of years of the loan is multiplied by 12 to get the number of months
HLOOKUP function
Description
Searches for a value in the top row of a table or an array of values, and then returns a value in
the same column from a row you specify in the table or array. Use HLOOKUP when your
comparison values are located in a row across the top of a table of data, and you want to look
down a specified number of rows. Use VLOOKUP when your comparison values are located in a
column to the left of the data you want to find.
Syntax
Lookup_value Required. The value to be found in the first row of the table. Lookup_value
can be a value, a reference, or a text string.
Table_array Required. A table of information in which data is looked up. Use a reference to
a range or a range name.
The values in the first row of table_array can be text, numbers, or logical values.
If range_lookup is TRUE, the values in the first row of table_array must be placed in
ascending order: ...-2, -1, 0, 1, 2,... , A-Z, FALSE, TRUE; otherwise, HLOOKUP may not
give the correct value. If range_lookup is FALSE, table_array does not need to be
sorted.
Row_index_num Required. The row number in table_array from which the matching value
will be returned. A row_index_num of 1 returns the first row value in table_array, a
row_index_num of 2 returns the second row value in table_array, and so on. If
row_index_num is less than 1, HLOOKUP returns the #VALUE! error value; if row_index_num
is greater than the number of rows on table_array, HLOOKUP returns the #REF! error value.
Range_lookup Optional. A logical value that specifies whether you want HLOOKUP to find
an exact match or an approximate match. If TRUE or omitted, an approximate match is
returned. In other words, if an exact match is not found, the next largest value that is less
than lookup_value is returned. If FALSE, HLOOKUP will find an exact match. If one is not
found, the error value #N/A is returned.
Remark
If HLOOKUP can't find lookup_value, and range_lookup is TRUE, it uses the largest value
that is less than lookup_value.
If lookup_value is smaller than the smallest value in the first row of table_array, HLOOKUP
returns the #N/A error value.
If range_lookup is FALSE and lookup_value is text, you can use the wildcard characters,
question mark (?) and asterisk (*), in lookup_value. 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.
Example
A B C
1 Axles Bearings Bolts
2 4 4 9
3 5 7 10
4 6 8 11
5 Formula Description (Result)
=HLOOKUP("Axles", A1:C4, Looks up Axles in row 1, and returns
33
2, TRUE) the value from row 2 that's in the
6 same column. (4)
=HLOOKUP("Bearings", Looks up Bearings in row 1, and
A1:C4, 3, FALSE) returns the value from row 3 that's
7 in the same column. (7)
=HLOOKUP("B", A1:C4, 3, Looks up B in row 1, and returns the
TRUE) value from row 3 that's in the same
column. Because B is not an exact
match, the next largest value that is
8 less than B is used: Axles. (5)
=HLOOKUP("Bolts", A1:C4, Looks up Bolts in row 1, and returns
4) the value from row 4 that's in the
9 same column. (11)
=HLOOKUP(3, {1, 2, 3, "a", Looks up 3 in the first row of the
"b", "c", "d", "e", "f"}, 2, array constant, and returns the value
10 TRUE) from row 2 in same column. (c)
VLOOKUP function
Description
You can use the VLOOKUP function to search the first column of a range of cells, and then return
a value from any cell on the same row of the range. For example, suppose that you have a list of
employees contained in the range A2:C10. The employees' ID numbers are stored in the first
column of the range, as shown in the following illustration.
Figure 2
If you know the employee's ID number, you can use the VLOOKUP function to return either the
department or the name of that employee. To obtain the name of employee number 38, you can
use the formula =VLOOKUP(38, A2:C10, 3, FALSE). This formula searches for the value 38 in the
first column of the range A2:C10, and then returns the value that is contained in the third
column of the range and on the same row as the lookup value ("Axel Delgado").
The V in VLOOKUP stands for vertical. Use VLOOKUP instead of HLOOKUP when your comparison
values are located in a column to the left of the data that you want to find.
Syntax
lookup_value Required. The value to search in the first column of the table or range. The
lookup_value argument can be a value or a reference. If the value you supply for the
lookup_value argument is smaller than the smallest value in the first column of the
table_array argument, VLOOKUP returns the #N/A error value.
table_array Required. The range of cells that contains the data. You can use a reference to
a range (for example, A2:D8), or a range name. The values in the first column of table_array
are the values searched by lookup_value. These values can be text, numbers, or logical
values. Uppercase and lowercase text are equivalent.
col_index_num Required. The column number in the table_array argument from which the
matching value must be returned. A col_index_num argument of 1 returns the value in the
first column in table_array; a col_index_num of 2 returns the value in the second column in
table_array, and so on.
Greater than the number of columns in table_array, VLOOKUP returns the #REF!
error value.
range_lookup Optional. A logical value that specifies whether you want VLOOKUP to find an
exact match or an approximate match:
Important Ifrange_lookup is either TRUE or is omitted, the values in the first column of
table_array must be placed in ascending sort order; otherwise, VLOOKUP might not return the
correct value.
35
If range_lookup is FALSE, the values in the first column of table_array do not need to be sorted.
If the range_lookup argument is FALSE, VLOOKUP will find only an exact match. If
there are two or more values in the first column of table_array that match the
lookup_value, the first value found is used. If an exact match is not found, the error
value #N/A is returned.
Remarks
When searching text values in the first column of table_array, ensure that the data in the
first column of table_array does not contain leading spaces, trailing spaces, inconsistent
use of straight ( ' or " ) and curly ( ‗ or ―) quotation marks, or nonprinting characters. In these
cases, VLOOKUP might return an incorrect or unexpected value.
When searching number or date values, ensure that the data in the first column of
table_array is not stored as text values. In this case, VLOOKUP might return an incorrect or
unexpected value.
If range_lookup is FALSE and lookup_value is text, you can use the wildcard characters —
the question mark (?) and asterisk (*) — in lookup_value. 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
This example searches the Density column of an atmospheric properties table to find
corresponding values in the Viscosity and Temperature columns. (The values are for air at 0
degrees Celsius at sea level, or 1 atmosphere.)
A B C
1 Density Viscosity Temperature
2 0.457 3.55 500
3 0.525 3.25 400
4 0.606 2.93 300
5 0.675 2.75 250
6 0.746 2.57 200
7 0.835 2.38 150
8 0.946 2.17 100
9 1.09 1.95 50
10 1.29 1.71 0
11 Formula Description Result
=VLOOKUP(1,A2:C10,2) Using an approximate 2.17
match, searches for the
value 1 in column A,
finds the largest value
less than or equal to 1 in
column A which is
12 0.946, and then returns
the value from column B
in the same row.
=VLOOKUP(1,A2:C10,3,TRUE) Using an approximate 100
match, searches for the
value 1 in column A,
finds the largest value
13 less than or equal to 1 in
column A, which is
0.946, and then returns
the value from column C
in the same row.
14
=VLOOKUP(0.7,A2:C10,3,FALSE) Using an exact match, #N/A
searches for the value
0.7 in column A.
Because there is no
exact match in column
15
A, an error is returned.
=VLOOKUP(0.1,A2:C10,2,TRUE) Using an approximate #N/A
match, searches for the
value 0.1 in column A.
Because 0.1 is less than
the smallest value in
column A, an error is
16
returned.
=VLOOKUP(2,A2:C10,2,TRUE) Using an approximate 1.71
match, searches for the
value 2 in column A,
finds the largest value
less than or equal to 2 in
column A, which is 1.29,
and then returns the
37
value from column B in
the same row.
Example 2
This example searches the Item-ID column of a baby products table and matches values in the
Cost and Markup columns to calculate prices and test conditions.
A B C D
1 Item-ID Item Cost Markup
2 ST-340 Stroller $145.67 30%
3 BI-567 Bib $3.56 40%
4 DI-328 Diapers $21.45 35%
5 WI-989 Wipes $5.12 40%
6 AS-469 Aspirator $2.56 45%
7 Formula Description Result
= VLOOKUP("DI-328", Calculates the retail price of $28.96
A2:D6, 3, FALSE) * (1 + diapers by adding the markup
VLOOKUP("DI-328", percentage to the cost.
8 A2:D6, 4, FALSE))
= (VLOOKUP("WI-989", Calculates the sale price of wipes $5.73
A2:D6, 3, FALSE) * (1 + by subtracting a specified discount
VLOOKUP("WI-989", from the retail price.
A2:D6, 4, FALSE))) * (1 -
9 20%)
= IF(VLOOKUP(A2, A2:D6, If the cost of an item is greater Markup
3, FALSE) >= 20, "Markup than or equal to $20.00, displays is 30%
is " & 100 * VLOOKUP(A2, the string "Markup is nn%";
A2:D6, 4, FALSE) &"%", otherwise, displays the string "Cost
"Cost is under $20.00") is under $20.00".
10
= IF(VLOOKUP(A3, A2:D6, If the cost of an item is greater Cost is
3, FALSE) >= 20, "Markup than or equal to $20.00, displays $3.56
is: " & 100 * the string Markup is nn%";
VLOOKUP(A3, A2:D6, 4, otherwise, displays the string "Cost
FALSE) &"%", "Cost is $" & is $n.nn".
VLOOKUP(A3, A2:D6, 3,
FALSE))
11
Example 3
This example searches the ID column of an employee table and matches values in other
columns to calculate ages and test for error conditions.
A B C D E
ID Last First Title Birth
1 name name date
1 Davis Sara Sal 12/8/19
2 es 68
Rep
.
3
2 Fonta Olivier V.P. 2/19/19
na of 52
4
Sal
es
5
3 Leal Karin Sal 8/30/19
a es 63
6 Rep
.
7 4 Patte Micha Sal 9/19/19
8 n el es 58
Rep
.
5 Burke Brian Sal 3/4/195
es 5
Mgr
.
9 6 Sousa Luis Sal 7/2/196
es 3
Rep
.
Formula Description Result
=INT(YEARFRAC(DATE(2004,6,3 For the fiscal year 2004, 49
0), VLOOKUP(5,A2:E7,5, FALSE), finds the age of the
1)) employee with ID equal to
5. Uses the YEARFRAC
1
function to subtract the
0
birth date from the fiscal
year end date and displays
the result as an integer
using the INT function.
39
=IF(ISNA(VLOOKUP(5,A2:E7,2,FA If there is an employee with Burke
LSE)) = TRUE, "Employee not an ID of 5, displays the
found", employee's last name;
VLOOKUP(5,A2:E7,2,FALSE)) otherwise, displays the
message "Employee not
found".
1 The ISNA function returns a
1 TRUE value when the
VLOOKUP function returns
the #NA error value.
=IF(ISNA(VLOOKUP(15,A3:E8,2,F If there is an employee with Employe
ALSE)) = TRUE, "Employee not an ID of 15, displays the e not
found", employee's last name; found
1 VLOOKUP(15,A3:E8,2,FALSE)) otherwise, displays the
2 message "Employee not
found".
The ISNA function returns a
TRUE value when the
VLOOKUP function returns
the #NA error value.
=VLOOKUP(4,A2:E7,3,FALSE) & " For the employee with an ID Michael
" & VLOOKUP(4,A2:E7,2,FALSE) of 4, concatenates the Patten is
& " is a " & values of three cells into a a Sales
VLOOKUP(4,A2:E7,4,FALSE) complete sentence. Rep.
IF function
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
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 Optional. 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 omitted (that is, in the IF function, there is no comma following
the value_if_true argument), the IF function returns the value 0 (zero).
Remarks
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.
Example 1
A B C
1 Data
2 50 23
3 Formula Description Result
=IF(A2<=100,"Within If the number in cell A2 is less than Within
budget","Over budget") or equal to 100, the formula returns budget
"Within budget." Otherwise, the
4 function displays "Over budget."
41
=IF(A2=100,A2+B2,"") If the number in cell A2 is equal to Empty
100, A2 + B2 is calculated and text ("")
returned. Otherwise, empty text ("")
5 is returned.
Example 2
A B C
1 Actual Expenses Predicted Expenses
2 1500 900
3 500 900
4 500 925
5 Formula Description Result
=IF(A2>B2,"Over Checks whether the expenses in Over
6 Budget","OK") row 2 are over budget Budget
=IF(A3>B3,"Over Checks whether the expenses in OK
7 Budget","OK") row 3 are over budget
Example 3
A B C
1 Score
2 45
3 90
4 78
5 Formula Description Result
=IF(A2>89,"A",IF(A2>79,"B", Assigns a letter grade F
6 IF(A2>69,"C",IF(A2>59,"D","F")))) to the score in cell A2
=IF(A3>89,"A",IF(A3>79,"B", Assigns a letter grade A
7 IF(A3>69,"C",IF(A3>59,"D","F")))) to the score in cell A3
=IF(A4>89,"A",IF(A4>79,"B", Assigns a letter grade C
8 IF(A4>69,"C",IF(A4>59,"D","F")))) to the score in cell A4
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.
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.
A B C
1 Score
2 45
3 90
4 78
5 Formula Descripti Resu
on lt
=LOOKUP(A2,{0,60,63,67,70,73,77,80,83,87,90,93,97}, Assigns a F
6 {"F","D-","D","D+","C-","C","C+","B-","B","B+","A- letter
","A","A+"}) grade to
the score
in cell A2
7
=LOOKUP(A3,{0,60,63,67,70,73,77,80,83,87,90,93,97}, Assigns a A-
{"F","D-","D","D+","C-","C","C+","B-","B","B+","A- letter
","A","A+"}) grade to
8
the score
in cell A3
=LOOKUP(A4,{0,60,63,67,70,73,77,80,83,87,90,93,97}, Assigns a C+
43
{"F","D-","D","D+","C-","C","C+","B-","B","B+","A- letter
","A","A+"}) grade to
the score
in cell A4
AND function
This article describes the formula syntax and usage of the ANDfunction in Microsoft Excel.
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 thelogical_test argument of the IF function, you can test many different
conditions instead of just one.
Syntax
1. logical1 Required. The first condition that you want to test that can evaluate to either TRUE
or FALSE.
2. 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
A B C
1 Data
2 50
3 104
4 Formula Description Result
=AND(1<A2, A2<100) Displays TRUE if the number in cell TRUE
A2 is between 1 and 100.
5 Otherwise, it displays FALSE.
=IF(AND(1<A3, Displays the number in cell A3, if it The value
A3<100), A3, "The value is between 1 and 100. Otherwise, it is out of
is out of range.") displays the message "The value is range.
out of range."
6
=IF(AND(1<A2, Displays the number in cell A2, if it 50
A2<100), A2, "The value is between 1 and 100. Otherwise, it
is out of range.") displays a message.
OR function
This article describes the formula syntax and usage of the ORfunction in Microsoft Excel.
Description
Returns TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
Syntax
45
Logical1, logical2, ... Logical1 is required, subsequent logical values are optional. 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
A B
1 Formula Description (Result)
2 =OR(TRUE) One argument is TRUE (TRUE)
3 =OR(1+1=1,2+2=5) All arguments evaluate to FALSE (FALSE)
4 =OR(TRUE,FALSE,TRUE) At least one argument is TRUE (TRUE)
ISERROR
IS functions
This article describes the formula syntax and usage of the ISfunctions in Microsoft Excel.
Description
Each of these functions, referred to collectively as the IS functions, checks the specified value
and returns TRUE or FALSE depending on the outcome. For example, the ISBLANK function
returns the logical value TRUE if the value argument is a reference to an empty cell; otherwise it
returns FALSE.
You can use an IS function to get information about a value before performing a calculation or
other action with it. For example, you can use the ISERROR function in conjunction with the IF
function to perform a different action if an error occurs:
This formula checks to see if an error condition exists in A1. If so, the IF function returns the
message "An error occurred." If no error exists, the IF function performs the calculation A1*2.
Syntax
ISBLANK(value)
ISERR(value)
ISERROR(value)
ISLOGICAL(value)
ISNA(value)
ISNONTEXT(value)
ISNUMBER(value)
ISREF(value)
ISTEXT(value)
value Required. The value that you want tested. The value argument can be a blank (empty
cell), error, logical value, text, number, or reference value, or a name referring to any of
these.
The value arguments of the IS functions are not converted. Any numeric values that are
enclosed in double quotation marks are treated as text. For example, in most other
functions where a number is required, the text value "19" is converted to the number 19.
47
However, in the formula ISNUMBER("19"), "19" is not converted from a text value to a
number value, and the ISNUMBER function returns FALSE.
The IS functions are useful in formulas for testing the outcome of a calculation. When
combined with the IF function, these functions provide a method for locating errors in
formulas (see the following examples).
Example 1
A B C
1 Formula Description Result
2 =ISLOGICAL(TRUE) Checks whether TRUE is a logical value TRUE
3 =ISLOGICAL("TRUE") Checks whether "TRUE" is a logical value FALSE
4 =ISNUMBER(4) Checks whether 4 is a number TRUE
5 =ISREF(G8) Checks whether G8 is a valid reference TRUE
6 =ISREF(XYZ1) Checks whether XYZ1 is a valid reference FALSE
Example 2
A B C
1 Data
2 Gold
3 Region1
4 #REF!
5 330.92
6 #N/A
7 Formula Description Result
8 =ISBLANK(A2) Checks whether cell A2 is blank. FALSE
=ISERROR(A4) Checks whether the value in cell A4, #REF!, is TRUE
9 an error.
=ISNA(A4) Checks whether the value in cell A4, #REF!, is FALSE
10 the #N/A error.
=ISNA(A6) Checks whether the value in cell A6, #N/A, is TRUE
11 the #N/A error.
=ISERR(A6) Checks whether the value in cell A6, #N/A, is FALSE
12 an error.
=ISNUMBER(A5) Checks whether the value in cell A5, 330.92, is TRUE
13 a number.
=ISTEXT(A3) Checks whether the value in cell A3, Region1, TRUE
14 is text.
DSUM function
Description
49
Adds the numbers in a field (column) of records in a list or database that match conditions that
you specify.
Syntax
Database Required. The range of cells that makes up the list or database. A database is a
list of related data in which rows of related information are records, and columns of data
are fields. The first row of the list contains labels for each column.
Field Required. Indicates which column is used in the function. Enter the column label
enclosed between double quotation marks, such as "Age" or "Yield," or a number (without
quotation marks) that represents the position of the column within the list: 1 for the first
column, 2 for the second column, and so on.
Criteria Required. Is the range of cells that contains the conditions that you specify. You
can use any range for the criteria argument, as long as it includes at least one column label
and at least one cell below the column label in which you specify a condition for the
column.
Remarks
You can use any range for the criteria argument, as long as it includes at least one column
label and at least one cell below the column label for specifying the condition.
For example, if the range G1:G2 contains the column label Income in G1 and the amount
$10,000 in G2, you could define the range as MatchIncome and use that name as the criteria
argument in the database functions.
Although the criteria range can be located anywhere on the worksheet, do not place the
criteria range below the list. If you add more information to the list, the new information is
added to the first row below the list. If the row below the list is not blank, Microsoft Excel
cannot add the new information.
Make sure that the criteria range does not overlap the list.
To perform an operation on an entire column in a database, enter a blank line below the
column labels in the criteria range.
Examples
A B C D E F
1 Tree Height Age Yield Profit Height
2 ="=Apple" >10 <16
3 ="=Pear"
4 Tree Height Age Yield Profit
5 Apple 18 20 14 105.00
6 Pear 12 12 10 96.00
7 Cherry 13 14 9 105.00
8 Apple 14 15 10 75.00
9 Pear 9 8 8 76.80
10 Apple 8 9 6 45.00
11 Formula Description
(Result)
=DSUM(A4:E10, The total
12 "Profit", A1:A2) profit from
apple trees.
(225)
13 =DSUM(A4:E10, The total
"Profit", A1:F2) profit from
apple trees
with a height
between 10
and 16. (75)
Criteria examples
Important
Because the equal sign is used to indicate a formula when you type text or a value in a cell,
Microsoft Excel evaluates what you type; however, this may cause unexpected filter results.
To indicate an equality comparison operator for either text or a value, type the criteria as a
string expression in the appropriate cell in the criteria range:
=''=entry''
Where entry is the text or value you want to find. For example:
What you type in the cell What Excel evaluates and displays
51
="=Davolio" =Davolio
="=3000" =3000
When filtering text data, Excel does not distinguish between uppercase and lowercase
characters. However, you can use a formula to perform a case-sensitive search. The
following sections provide examples of complex criteria.
To find rows that meet multiple criteria for one column, type the criteria directly below each
other in separate rows of the criteria range.
In the following data range (A6:C10), the criteria range (B1:B3) displays the rows that contain
either "Davolio" or "Buchanan" in the Salesperson column (A8:C10).
A B C
1 Type Salesperson Sales
2 =Davolio
3 =Buchanan
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple criteria in multiple columns where all criteria must be true
To find rows that meet multiple criteria in multiple columns, type all of the criteria in the same
row of the criteria range.
In the following data range (A6:C10), the criteria range (A1:C2) displays all rows that contain
"Produce" in the Type column and a value greater than $1,000 in the Sales column (A9:C10).
A B C
1 Type Salesperson Sales
2 =Produce >1000
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple criteria in multiple columns where any criteria can be true
To find rows that meet multiple criteria in multiple columns, where any criteria can be true, type
the criteria in different rows of the criteria range.
In the following data range (A6:C10), the criteria range (A1:B3) displays all rows that contain
"Produce" in the Type column or "Davolio" in the Salesperson column (A8:C10).
A B C
1 Type Salesperson Sales
2 =Produce
3 =Davolio
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple sets of criteria where each set includes criteria for multiple columns
53
Boolean logic: ( (Salesperson = "Davolio" AND Sales >3000) OR (Salesperson = "Buchanan"
AND Sales > 1500) )
To find rows that meet multiple sets of criteria, where each set includes criteria for multiple
columns, type each set of criteria in separate rows.
In the following data range (A6:C10), the criteria range (B1:C3) displays the rows that contain
both "Davolio" in the Salesperson column and a value greater than $3,000 in the Sales column,
or displays the rows that contain "Buchanan" in the Salesperson and a value greater than
$1,500 in the Sales column (A9:C10).
A B C
1 Type Salesperson Sales
2 =Davolio >3000
3 =Buchanan >1500
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple sets of criteria where each set includes criteria for one column
Boolean logic: ( (Sales > 6000 AND Sales < 6500 ) OR (Sales < 500) )
To find rows that meet multiple sets of criteria, where each set includes criteria for one column,
include multiple columns with the same column heading.
In the following data range (A6:C10), the criteria range (C1:D3) displays rows that contain values
between 6,000 and 6,500 and values less than 500 in the Sales column (A8:C10).
A B C D
1 Type Salesperson Sales Sales
2 >6000 <6500
3 <500
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Criteria to find text values that share some characters but not others
To find text values that share some characters but not others, do one or more of the following:
Type one or more characters without an equal sign (=) to find rows with a text value in a
column that begin with those characters. For example, if you type the text Dav as a
criterion, Excel finds "Davolio," "David," and "Davis."
Use To find
? (question mark) Any single character
For example, sm?th finds "smith" and "smyth"
* (asterisk) Any number of characters
For example, *east finds "Northeast" and "Southeast"
~ (tilde) followed by ?, *, or ~ A question mark, asterisk, or tilde
For example, fy91~? finds "fy91?"
In the following data range (A6:C10), the criteria range (A1:B3) displays rows with "Me" as the
first characters in the Type column or rows with the second character equal to "u" in the
Salesperson column (A7:C9).
A B C
1 Type Salesperson Sales
2 Me
3 =?u*
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
55
9 produce Buchanan $6328
10 Produce Davolio $6544
Criteria created as the result of a formula
You can use a calculated value that is the result of a formula as your criterion. Remember the
following important points:
Because you are using a formula, enter the formula as you normally would, and do not type
the expression in the following way:
=''=entry''
Do not use a column label for criteria labels; either keep the criteria labels blank or use a
label that is not a column label in the range (in the examples below, Calculated Average
and Exact Match).
If you use a column label in the formula instead of a relative cell reference or a range name,
Excel displays an error value such as #NAME? or #VALUE! in the cell that contains the criterion.
You can ignore this error because it does not affect how the range is filtered.
The formula that you use for criteria must use a relative reference to refer to the
corresponding cell in the first row (in the examples below, C7 and A7).
The following subsections provide specific examples of criteria created as the result of a
formula.
Filtering for values greater than the average of all values in the data range
In the following data range (A6:D10), the criteria range (D1:D2) displays rows that have a value
in the Sales column greater than the average of all the Sales values (C7:C10). In the formula,
"C7" refers to the filtered column (C) of the first row of the data range (7).
A B C D
1 Type Salesperson Sales Calculated Average
2 =C7>AVERAGE($C$7:$C$10)
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Filtering for text by using a case-sensitive search
In the data range (A6:D10), the criteria range (D1:D2) displays rows that contain "Produce" in
the Type column by using the EXACT function to perform a case-sensitive search (A10:C10). In
the formula, "A7" refers to the filtered column (A) of the first row of the data range (7).
A B C D
1 Type Salesperson Sales Exact Match
2 =EXACT(A7, "Produce")
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
DMIN function
This article describes the formula syntax and usage of the DMINfunction in Microsoft Excel.
Description
57
Returns the smallest number in a field (column) of records in a list or database that matches
conditions that you specify.
Syntax
Database Required. The range of cells that makes up the list or database. A database is a
list of related data in which rows of related information are records, and columns of data
are fields. The first row of the list contains labels for each column.
Field Required. Indicates which column is used in the function. Enter the column label
enclosed between double quotation marks, such as "Age" or "Yield," or a number (without
quotation marks) that represents the position of the column within the list: 1 for the first
column, 2 for the second column, and so on.
Criteria Required. The range of cells that contains the conditions that you specify. You can
use any range for the criteria argument, as long as it includes at least one column label and
at least one cell below the column label in which you specify a condition for the column.
Remarks
You can use any range for the criteria argument, as long as it includes at least one column
label and at least one cell below the column label for specifying the condition.
For example, if the range G1:G2 contains the column label Income in G1 and the amount
$10,000 in G2, you could define the range as MatchIncome and use that name as the criteria
argument in the database functions.
Although the criteria range can be located anywhere on the worksheet, do not place the
criteria range below the list. If you add more information to the list, the new information is
added to the first row below the list. If the row below the list is not blank, Microsoft Excel
cannot add the new information.
Make sure that the criteria range does not overlap the list.
To perform an operation on an entire column in a database, enter a blank line below the
column labels in the criteria range.
Examples
A B C D E F
1 Tree Height Age Yield Profit Height
2 ="=Apple" >10 <16
3 ="=Pear"
4 Tree Height Age Yield Profit
5 Apple 18 20 14 105.00
6 Pear 12 12 10 96.00
7 Cherry 13 14 9 105.00
8 Apple 14 15 10 75.00
9 Pear 9 8 8 76.80
10 Apple 8 9 6 45.00
11 Formula Description
(Result)
=DMIN(A4:E10, The minimum
12 "Profit", A1:B2) profit of apple
trees over 10
in height. (75)
Criteria examples
Important
Because the equal sign is used to indicate a formula when you type text or a value in a cell,
Microsoft Excel evaluates what you type; however, this may cause unexpected filter results.
To indicate an equality comparison operator for either text or a value, type the criteria as a
string expression in the appropriate cell in the criteria range:
=''=entry''
Where entry is the text or value you want to find. For example:
What you type in the cell What Excel evaluates and displays
="=Davolio" =Davolio
="=3000" =3000
When filtering text data, Excel does not distinguish between uppercase and lowercase
characters. However, you can use a formula to perform a case-sensitive search. The
following sections provide examples of complex criteria.
59
Multiple criteria in one column
To find rows that meet multiple criteria for one column, type the criteria directly below each
other in separate rows of the criteria range.
In the following data range (A6:C10), the criteria range (B1:B3) displays the rows that contain
either "Davolio" or "Buchanan" in the Salesperson column (A8:C10).
A B C
1 Type Salesperson Sales
2 =Davolio
3 =Buchanan
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple criteria in multiple columns where all criteria must be true
To find rows that meet multiple criteria in multiple columns, type all of the criteria in the same
row of the criteria range.
In the following data range (A6:C10), the criteria range (A1:C2) displays all rows that contain
"Produce" in the Type column and a value greater than $1,000 in the Sales column (A9:C10).
A B C
1 Type Salesperson Sales
2 =Produce >1000
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple criteria in multiple columns where any criteria can be true
To find rows that meet multiple criteria in multiple columns, where any criteria can be true, type
the criteria in different rows of the criteria range.
In the following data range (A6:C10), the criteria range (A1:B3) displays all rows that contain
"Produce" in the Type column or "Davolio" in the Salesperson column (A8:C10).
A B C
1 Type Salesperson Sales
2 =Produce
3 =Davolio
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple sets of criteria where each set includes criteria for multiple columns
To find rows that meet multiple sets of criteria, where each set includes criteria for multiple
columns, type each set of criteria in separate rows.
In the following data range (A6:C10), the criteria range (B1:C3) displays the rows that contain
both "Davolio" in the Salesperson column and a value greater than $3,000 in the Sales column,
or displays the rows that contain "Buchanan" in the Salesperson and a value greater than
$1,500 in the Sales column (A9:C10).
A B C
61
1 Type Salesperson Sales
2 =Davolio >3000
3 =Buchanan >1500
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple sets of criteria where each set includes criteria for one column
Boolean logic: ( (Sales > 6000 AND Sales < 6500 ) OR (Sales < 500) )
To find rows that meet multiple sets of criteria, where each set includes criteria for one column,
include multiple columns with the same column heading.
In the following data range (A6:C10), the criteria range (C1:D3) displays rows that contain values
between 6,000 and 6,500 and values less than 500 in the Sales column (A8:C10).
A B C D
1 Type Salesperson Sales Sales
2 >6000 <6500
3 <500
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Criteria to find text values that share some characters but not others
To find text values that share some characters but not others, do one or more of the following:
Type one or more characters without an equal sign (=) to find rows with a text value in a
column that begin with those characters. For example, if you type the text Dav as a
criterion, Excel finds "Davolio," "David," and "Davis."
Use To find
? (question mark) Any single character
For example, sm?th finds "smith" and "smyth"
* (asterisk) Any number of characters
For example, *east finds "Northeast" and "Southeast"
~ (tilde) followed by ?, *, or ~ A question mark, asterisk, or tilde
For example, fy91~? finds "fy91?"
In the following data range (A6:C10), the criteria range (A1:B3) displays rows with "Me" as the
first characters in the Type column or rows with the second character equal to "u" in the
Salesperson column (A7:C9).
A B C
1 Type Salesperson Sales
2 Me
3 =?u*
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
63
Criteria created as the result of a formula
You can use a calculated value that is the result of a formula as your criterion. Remember the
following important points:
Because you are using a formula, enter the formula as you normally would, and do not type
the expression in the following way:
=''=entry''
Do not use a column label for criteria labels; either keep the criteria labels blank or use a
label that is not a column label in the range (in the examples below, Calculated Average
and Exact Match).
If you use a column label in the formula instead of a relative cell reference or a range name,
Excel displays an error value such as #NAME? or #VALUE! in the cell that contains the criterion.
You can ignore this error because it does not affect how the range is filtered.
The formula that you use for criteria must use a relative reference to refer to the
corresponding cell in the first row (in the examples below, C7 and A7).
The following subsections provide specific examples of criteria created as the result of a
formula.
Filtering for values greater than the average of all values in the data range
In the following data range (A6:D10), the criteria range (D1:D2) displays rows that have a value
in the Sales column greater than the average of all the Sales values (C7:C10). In the formula,
"C7" refers to the filtered column (C) of the first row of the data range (7).
A B C D
1 Type Salesperson Sales Calculated Average
2 =C7>AVERAGE($C$7:$C$10)
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Filtering for text by using a case-sensitive search
In the data range (A6:D10), the criteria range (D1:D2) displays rows that contain "Produce" in
the Type column by using the EXACT function to perform a case-sensitive search (A10:C10). In
the formula, "A7" refers to the filtered column (A) of the first row of the data range (7).
A B C D
1 Type Salesperson Sales Exact Match
2 =EXACT(A7, "Produce")
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
DMAX function
This article describes the formula syntax and usage of the DMAXfunction in Microsoft Excel.
Description
Returns the largest number in a field (column) of records in a list or database that matches
conditions you that specify.
Syntax
Database Required. The range of cells that makes up the list or database. A database is a
list of related data in which rows of related information are records, and columns of data
are fields. The first row of the list contains labels for each column.
Field Required. Indicates which column is used in the function. Enter the column label
enclosed between double quotation marks, such as "Age" or "Yield," or a number (without
65
quotation marks) that represents the position of the column within the list: 1 for the first
column, 2 for the second column, and so on.
Criteria Required. The range of cells that contains the conditions that you specify. You can
use any range for the criteria argument, as long as it includes at least one column label and
at least one cell below the column label in which you specify a condition for the column.
Remarks
You can use any range for the criteria argument, as long as it includes at least one column
label and at least one cell below the column label for specifying the condition.
For example, if the range G1:G2 contains the column label Income in G1 and the amount
$10,000 in G2, you could define the range as MatchIncome and use that name as the criteria
argument in the database functions.
Although the criteria range can be located anywhere on the worksheet, do not place the
criteria range below the list. If you add more information to the list, the new information is
added to the first row below the list. If the row below the list is not blank, Microsoft Excel
cannot add the new information.
Make sure that the criteria range does not overlap the list.
To perform an operation on an entire column in a database, enter a blank line below the
column labels in the criteria range.
Examples
A B C D E F
1 Tree Height Age Yield Profit Height
2 ="=Apple" >10 <16
3 ="=Pear"
4 Tree Height Age Yield Profit
5 Apple 18 20 14 105.00
6 Pear 12 12 10 96.00
7 Cherry 13 14 9 105.00
8 Apple 14 15 10 75.00
9 Pear 9 8 8 76.80
10 Apple 8 9 6 45.00
11 Formula Description
(Result)
=DMAX(A4:E10, The
"Profit", A1:A3) maximum
12 profit of
apple and
pear trees.
(105)
Important
Because the equal sign is used to indicate a formula when you type text or a value in a cell,
Microsoft Excel evaluates what you type; however, this may cause unexpected filter results.
To indicate an equality comparison operator for either text or a value, type the criteria as a
string expression in the appropriate cell in the criteria range:
=''=entry''
Where entry is the text or value you want to find. For example:
What you type in the cell What Excel evaluates and displays
="=Davolio" =Davolio
="=3000" =3000
When filtering text data, Excel does not distinguish between uppercase and lowercase
characters. However, you can use a formula to perform a case-sensitive search. The
following sections provide examples of complex criteria.
To find rows that meet multiple criteria for one column, type the criteria directly below each
other in separate rows of the criteria range.
In the following data range (A6:C10), the criteria range (B1:B3) displays the rows that contain
either "Davolio" or "Buchanan" in the Salesperson column (A8:C10).
A B C
1 Type Salesperson Sales
2 =Davolio
3 =Buchanan
4
5
6 Type Salesperson Sales
67
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple criteria in multiple columns where all criteria must be true
To find rows that meet multiple criteria in multiple columns, type all of the criteria in the same
row of the criteria range.
In the following data range (A6:C10), the criteria range (A1:C2) displays all rows that contain
"Produce" in the Type column and a value greater than $1,000 in the Sales column (A9:C10).
A B C
1 Type Salesperson Sales
2 =Produce >1000
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple criteria in multiple columns where any criteria can be true
To find rows that meet multiple criteria in multiple columns, where any criteria can be true, type
the criteria in different rows of the criteria range.
In the following data range (A6:C10), the criteria range (A1:B3) displays all rows that contain
"Produce" in the Type column or "Davolio" in the Salesperson column (A8:C10).
A B C
1 Type Salesperson Sales
2 =Produce
3 =Davolio
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple sets of criteria where each set includes criteria for multiple columns
To find rows that meet multiple sets of criteria, where each set includes criteria for multiple
columns, type each set of criteria in separate rows.
In the following data range (A6:C10), the criteria range (B1:C3) displays the rows that contain
both "Davolio" in the Salesperson column and a value greater than $3,000 in the Sales column,
or displays the rows that contain "Buchanan" in the Salesperson and a value greater than
$1,500 in the Sales column (A9:C10).
A B C
1 Type Salesperson Sales
2 =Davolio >3000
3 =Buchanan >1500
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple sets of criteria where each set includes criteria for one column
Boolean logic: ( (Sales > 6000 AND Sales < 6500 ) OR (Sales < 500) )
69
To find rows that meet multiple sets of criteria, where each set includes criteria for one column,
include multiple columns with the same column heading.
In the following data range (A6:C10), the criteria range (C1:D3) displays rows that contain values
between 6,000 and 6,500 and values less than 500 in the Sales column (A8:C10).
A B C D
1 Type Salesperson Sales Sales
2 >6000 <6500
3 <500
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Criteria to find text values that share some characters but not others
To find text values that share some characters but not others, do one or more of the following:
Type one or more characters without an equal sign (=) to find rows with a text value in a
column that begin with those characters. For example, if you type the text Dav as a
criterion, Excel finds "Davolio," "David," and "Davis."
Use To find
? (question mark) Any single character
For example, sm?th finds "smith" and "smyth"
* (asterisk) Any number of characters
For example, *east finds "Northeast" and "Southeast"
~ (tilde) followed by ?, *, or ~ A question mark, asterisk, or tilde
For example, fy91~? finds "fy91?"
In the following data range (A6:C10), the criteria range (A1:B3) displays rows with "Me" as the
first characters in the Type column or rows with the second character equal to "u" in the
Salesperson column (A7:C9).
A B C
1 Type Salesperson Sales
2 Me
3 =?u*
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Criteria created as the result of a formula
You can use a calculated value that is the result of a formula as your criterion. Remember the
following important points:
Because you are using a formula, enter the formula as you normally would, and do not type
the expression in the following way:
=''=entry''
Do not use a column label for criteria labels; either keep the criteria labels blank or use a
label that is not a column label in the range (in the examples below, Calculated Average
and Exact Match).
If you use a column label in the formula instead of a relative cell reference or a range name,
Excel displays an error value such as #NAME? or #VALUE! in the cell that contains the criterion.
You can ignore this error because it does not affect how the range is filtered.
The formula that you use for criteria must use a relative reference to refer to the
corresponding cell in the first row (in the examples below, C7 and A7).
The following subsections provide specific examples of criteria created as the result of a
formula.
Filtering for values greater than the average of all values in the data range
71
In the following data range (A6:D10), the criteria range (D1:D2) displays rows that have a value
in the Sales column greater than the average of all the Sales values (C7:C10). In the formula,
"C7" refers to the filtered column (C) of the first row of the data range (7).
A B C D
1 Type Salesperson Sales Calculated Average
2 =C7>AVERAGE($C$7:$C$10)
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Filtering for text by using a case-sensitive search
In the data range (A6:D10), the criteria range (D1:D2) displays rows that contain "Produce" in
the Type column by using the EXACT function to perform a case-sensitive search (A10:C10). In
the formula, "A7" refers to the filtered column (A) of the first row of the data range (7).
A B C D
1 Type Salesperson Sales Exact Match
2 =EXACT(A7, "Produce")
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
DCOUNT function
This article describes the formula syntax and usage of the DCOUNTfunction in Microsoft Excel.
Description
Counts the cells that contain numbers in a field (column) of records in a list or database that
match conditions that you specify.
The field argument is optional. If field is omitted, DCOUNT counts all records in the database
that match the criteria.
Syntax
Database Required. The range of cells that makes up the list or database. A database is a
list of related data in which rows of related information are records, and columns of data
are fields. The first row of the list contains labels for each column.
Field Required. Indicates which column is used in the function. Enter the column label
enclosed between double quotation marks, such as "Age" or "Yield," or a number (without
quotation marks) that represents the position of the column within the list: 1 for the first
column, 2 for the second column, and so on.
Criteria Required. The range of cells that contains the conditions that you specify. You can
use any range for the criteria argument, as long as the argument includes at least one
column label and at least one cell below the column label in which you specify a condition
for the column.
Remarks
You can use any range for the criteria argument, as long as it includes at least one column
label and at least one cell below the column label for specifying the condition.
For example, if the range G1:G2 contains the column label Income in G1 and the amount
$10,000 in G2, you could define the range as MatchIncome and use that name as the criteria
argument in the database functions.
Although the criteria range can be located anywhere on the worksheet, do not place the
criteria range below the list. If you add more information to the list, the new information is
added to the first row below the list. If the row below the list is not blank, Microsoft Excel
cannot add the new information.
Make sure that the criteria range does not overlap the list.
73
To perform an operation on an entire column in a database, enter a blank line below the
column labels in the criteria range.
Examples
A B C D E F
1 Tree Height Age Yield Profit Height
2 ="=Apple" >10 <16
3 ="=Pear"
4 Tree Height Age Yield Profit
5 Apple 18 20 14 105.00
6 Pear 12 12 10 96.00
7 Cherry 13 14 9 105.00
8 Apple 14 15 10 75.00
9 Pear 9 8 8 76.80
10 Apple 8 9 6 45.00
11 Formula Description
(Result)
=DCOUNT(A4:E10, This
"Age", A1:F2) function
looks at the
records of
apple trees
12 between a
height of 10
and 16 and
counts how
many of the
Age fields in
those
records
contain
numbers.
(1)
Important
Because the equal sign is used to indicate a formula when you type text or a value in a cell,
Microsoft Excel evaluates what you type; however, this may cause unexpected filter results.
To indicate an equality comparison operator for either text or a value, type the criteria as a
string expression in the appropriate cell in the criteria range:
=''=entry''
Where entry is the text or value you want to find. For example:
What you type in the cell What Excel evaluates and displays
="=Davolio" =Davolio
="=3000" =3000
When filtering text data, Excel does not distinguish between uppercase and lowercase
characters. However, you can use a formula to perform a case-sensitive search.The
following sections provide examples of complex criteria.
To find rows that meet multiple criteria for one column, type the criteria directly below each
other in separate rows of the criteria range.
In the following data range (A6:C10), the criteria range (B1:B3) displays the rows that contain
either "Davolio" or "Buchanan" in the Salesperson column (A8:C10).
A B C
1 Type Salesperson Sales
2 =Davolio
3 =Buchanan
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple criteria in multiple columns where all criteria must be true
75
To find rows that meet multiple criteria in multiple columns, type all of the criteria in the same
row of the criteria range.
In the following data range (A6:C10), the criteria range (A1:C2) displays all rows that contain
"Produce" in the Type column and a value greater than $1,000 in the Sales column (A9:C10).
A B C
1 Type Salesperson Sales
2 =Produce >1000
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple criteria in multiple columns where any criteria can be true
To find rows that meet multiple criteria in multiple columns, where any criteria can be true, type
the criteria in different rows of the criteria range.
In the following data range (A6:C10), the criteria range (A1:B3) displays all rows that contain
"Produce" in the Type column or "Davolio" in the Salesperson column (A8:C10).
A B C
1 Type Salesperson Sales
2 =Produce
3 =Davolio
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple sets of criteria where each set includes criteria for multiple columns
To find rows that meet multiple sets of criteria, where each set includes criteria for multiple
columns, type each set of criteria in separate rows.
In the following data range (A6:C10), the criteria range (B1:C3) displays the rows that contain
both "Davolio" in the Salesperson column and a value greater than $3,000 in the Sales column,
or displays the rows that contain "Buchanan" in the Salesperson and a value greater than
$1,500 in the Sales column (A9:C10).
A B C
1 Type Salesperson Sales
2 =Davolio >3000
3 =Buchanan >1500
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Multiple sets of criteria where each set includes criteria for one column
Boolean logic: ( (Sales > 6000 AND Sales < 6500 ) OR (Sales < 500) )
To find rows that meet multiple sets of criteria, where each set includes criteria for one column,
include multiple columns with the same column heading.
In the following data range (A6:C10), the criteria range (C1:D3) displays rows that contain values
between 6,000 and 6,500 and values less than 500 in the Sales column (A8:C10).
A B C D
1 Type Salesperson Sales Sales
2 >6000 <6500
77
3 <500
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Criteria to find text values that share some characters but not others
To find text values that share some characters but not others, do one or more of the following:
Type one or more characters without an equal sign (=) to find rows with a text value in a
column that begin with those characters. For example, if you type the text Dav as a
criterion, Excel finds "Davolio," "David," and "Davis."
Use To find
? (question mark) Any single character
For example, sm?th finds "smith" and "smyth"
* (asterisk) Any number of characters
For example, *east finds "Northeast" and "Southeast"
~ (tilde) followed by ?, *, or ~ A question mark, asterisk, or tilde
For example, fy91~? finds "fy91?"
In the following data range (A6:C10), the criteria range (A1:B3) displays rows with "Me" as the
first characters in the Type column or rows with the second character equal to "u" in the
Salesperson column (A7:C9).
A B C
1 Type Salesperson Sales
2 Me
3 =?u*
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Criteria created as the result of a formula
You can use a calculated value that is the result of a formula as your criterion. Remember the
following important points:
Because you are using a formula, enter the formula as you normally would, and do not type
the expression in the following way:
=''=entry''
Do not use a column label for criteria labels; either keep the criteria labels blank or use a
label that is not a column label in the range (in the examples below, Calculated Average
and Exact Match).
If you use a column label in the formula instead of a relative cell reference or a range name,
Excel displays an error value such as #NAME? or #VALUE! in the cell that contains the criterion.
You can ignore this error because it does not affect how the range is filtered.
The formula that you use for criteria must use a relative reference to refer to the
corresponding cell in the first row (in the examples below, C7 and A7).
The following subsections provide specific examples of criteria created as the result of a
formula.
Filtering for values greater than the average of all values in the data range
In the following data range (A6:D10), the criteria range (D1:D2) displays rows that have a value
in the Sales column greater than the average of all the Sales values (C7:C10). In the formula,
"C7" refers to the filtered column (C) of the first row of the data range (7).
A B C D
1 Type Salesperson Sales Calculated Average
2 =C7>AVERAGE($C$7:$C$10)
79
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Filtering for text by using a case-sensitive search
In the data range (A6:D10), the criteria range (D1:D2) displays rows that contain "Produce" in
the Type column by using the EXACT function to perform a case-sensitive search (A10:C10). In
the formula, "A7" refers to the filtered column (A) of the first row of the data range (7).
A B C D
1 Type Salesperson Sales Exact Match
2 =EXACT(A7, "Produce")
3
4
5
6 Type Salesperson Sales
7 Beverages Suyama $5122
8 Meat Davolio $450
9 produce Buchanan $6328
10 Produce Davolio $6544
Using nested functions
You can use a function as an argument for another function. This is called nesting functions. For
example, the function AVERAGE(SUM(A1:A10), SUM(B1:B15)) sums two columns of numbers
and returns the average of the two sums.
For example, consider the variation of our formula that outputs a description based on the value
in cell A1:
What if you wanted to return a different string for values greater than, say, 10,000? In other
words, if the condition A1 > 1000 proves to be true, you want to run another test that checks to
see if A1 > 10000. You can handle this scenario by nesting a second IF() function inside the first
as the value_if_true argument:
=IF(A1 >= 1000, IF(A1 >= 10000, ―Really big!!‖, ―Big!‖), ―Not big‖)
If A1 > 1000 returns TRUE, the formula evaluates the nested IF(), which returns Really big!! if A1
> 10000 is TRUE, and returns Big! if it‘s FALSE; if A1 > 1000 returns FALSE, the formula returns
Not big.
Note: Ideally we can put maximum 255 arguments in a function, however the levels of nested
are limited to 64 only.
81
One input Data Table command
Setting Up a One-Input Data Table
The problem with modifying formula variables is that you see only a single result at one time. If
you‘re interested in studying the effect a range of values has on the formula, you need to set up
a data table. In the investment analysis worksheet, for example, suppose that you want to see
the future value of the investment with the annual deposit varying between $7,000 and
$13,000. You could just enter these values in a row or column and then create the appropriate
formulas. Setting up a data table, however, is much easier, as the following procedure shows:
1. Add to the worksheet the values you want to input into the formula. You have two choices for
the placement of these values:
• If you want to enter the values in a row, start the row one cell up and one cell to the right of
the formula.
• If you want to enter the values in a column, start the column one cell down and one cell to the
left of the cell containing the formula, as shown in Figure 14.2. 2. Select the range that includes
the input values and the formula. (In Figure 14.2, this is B9:C16.)
4. How you fill in this dialog box depends on how you set up your data table:
• If you entered the input values in a row, use the Row Input Cell text box to enter the cell
address of the input cell.
• If the input values are in a column, enter the input cell‘s address in the Column
Input Cell text box. In the investment analysis example, you enter C4 in the
Figure 4
You also can set up data tables that take two input variables. This option enables you to see the
effect on an investment‘s future value when you enter different values for, say, the annual
deposit and the interest rate. The following steps show you how to set up a twoinput data table:
1. Enter one set of values in a column below the formula and the second set of values to
the right of the formula in the same row
2. Select the range that includes the input values and the formula.
83
3. Choose Data, Table to display the Table dialog box.
4. In the Row Input Cell text box, enter the cell address of the input cell that corresponds
5. In the Column Input Cell text box, enter the cell address of the input cell you want to
6. Click OK. Excel runs through the various input combinations and then displays the
Figure 5
EXCEL 2007 - A FIRST LOOK AT PIVOT TABLES
Quick start: Create a PivotTable report
By using a PivotTable report, you can summarize, analyze, explore, and present a summary of
your worksheet data or an external data source. A PivotTable report is especially useful when
you have a long list of figures to sum, and aggregated data or subtotals would help you look at
the data from different perspectives and compare figures of similar data.
For example, the following PivotTable report shows how the total third-quarter Golf department
sales in cell F3 compare to sales for another sport, or quarter, or to the total sales of all
departments.
Figure 6
2. The source values for Qtr3 Golf summary in the PivotTable report
4. The summary of the source values in C2 and C8 from the source data
Important Although you can also create a PivotTable report for an external data source, this
quick start article describes how to create one for worksheet data.
How?
To use worksheet data as the data source, click a cell in the range of cells that contains
the data.
85
To use data in a Microsoft Excel table as the data source, click a cell inside the Excel
table.
Note Make sure that the range has column headings or that headers are displayed in the table,
and that there are no blank rows in the range or table.
Tip To create a PivotChart that is based on the PivotTable report at the same time, click the
arrow below PivotTable, and then click PivotChart.
Figure 7
2. In the Create PivotTable dialog box, make sure that Select a table or range is selected, and
then in the Table/Range box, verify the range of cells.
Figure 8
Excel automatically determines the range for the PivotTable report, but you can replace it by
typing a different range or a name that you defined for the range.
For data in another worksheet or workbook, include the workbook and worksheet name by using
the following syntax [workbookname]sheetname!range.
Tip You can also click Collapse Dialog to temporarily hide the dialog box, select the range on
the worksheet, and then click Expand Dialog .
4. Click OK.
Excel adds an empty PivotTable report to the specified location and displays the PivotTable Field
List so that you can add fields, create a layout, and customize the PivotTable report.
Note If you created a PivotChart at the same time, it is displayed on top of the associated
PivotTable report. A PivotChart and its associated PivotTable report must always be in the same
workbook.
To place a field in the default area of the layout section, select the check box next to the
field name in the field section.
By default, nonnumeric fields are added to the Row Labels area, numeric fields are added to the
Values area, and Online Analytical Processing (OLAP) date and time hierarchies are added to the
Column Labels area.
87
Figure 9
The field section contains the field names of the fields you can add to the Layout section
The layout section contains the Report Filter area, the Column Labels area, the Row Labels
area, and the Values area.
To place a field in a specific area of the layout section, right-click the field name in the field
section, and then select Add to Report Filter, Add to Column Label, Add to Row Label, or
Add to Values.
To drag a field to the area that you want, click and hold the field name in the field section,
and then drag it to an area in the layout section.
Tip You can use the PivotTable Field List to rearrange the fields later as needed by right-clicking
the fields in the layout section, and then selecting the area that you want, or by dragging the fields
between the areas in the layout section.
If you add rows to the range of source data, you can include those rows in the PivotTable
report by changing the source data (PivotTable Tools, Options tab, Data group, Change
Source Data button). If the source data is in an Excel table, additional rows are
automatically displayed when you refresh the PivotTable report.
Figure 10
89
Pivot table chart
What is a PivotChart report
A PivotChart report provides a graphical representation of the data in a PivotTable report, which
in this case is called the associated PivotTable report. Like a PivotTable report, a PivotChart
report is interactive. When you create a PivotChart report, PivotChart report filters are displayed
in the chart area so that you can sort and filter the underlying data of the PivotChart report.
Changes that you make to the field layout and data in the associated PivotTable report are
immediately reflected in the PivotChart report.
A PivotChart report displays data series, categories, data markers, and axes just as standard
charts do. You can also change the chart type and other options such as the titles, the legend
placement, the data labels, and the chart location.
Figure 11
You can automatically create a PivotChart report when you first create a PivotTable report, or
you can create a PivotChart report from an existing PivotTable report.
When you create a PivotChart report from a PivotTable report, the layout of the PivotChart
report, that is, the position of its fields, is determined initially by the layout of the PivotTable
report. When you create the PivotChart report first, you determine the chart layout by dragging
fields from the PivotTable Field List to specific areas on the chart sheet.
Note The Totals and Subtotals of an associated PivotTable report are ignored in a PivotChart
report.
The following PivotTable and PivotChart reports of sales data illustrate the relationship between
the two.
Figure 12
If you are familiar with standard charts, you will find that most operations are the same in
PivotChart reports. However, there are some differences:
Row/Column orientation Unlike a standard chart, you cannot switch the row/column orientation
of a PivotChart report by using the Select Data Source dialog box. However, you can pivot the
Row and Column labels of the associated PivotTable report to achieve the same effect.
Chart types You can change a PivotChart report to any chart type except an xy (scatter), stock,
or bubble chart.
Source data Standard charts are linked directly to worksheet cells. PivotChart reports are based
on the data source of the associated PivotTable report. Unlike a standard chart, you cannot
change the chart data range in the Select Data Source dialog box of a PivotChart report.
Formatting Most formatting — including chart elements that you add, layout, and style — is
preserved when you refresh a PivotChart report. However, trendlines, data labels, error bars, and
other changes to data sets are not preserved. Standard charts do not lose this formatting once it
is applied.
91
Although you cannot directly resize the data labels in a PivotChart report, you can increase the
font size of the text to effectively resize the labels.
Working with the source data of a PivotTable or PivotChart
report
When you create a PivotTable or a PivotChart report, you can use any of several different types
of source data.
Using a named range To make the report easier to update, name the source range, and use the
name when you create the report. If the named range expands to include more data, you can
refresh the report to include the new data.
Excel tables Excel tables are already in list format and are good candidates for PivotTable
source data. When you refresh the PivotTable report, new and updated data from the Excel table
is automatically included in the refresh operation.
Including totals Excel automatically creates subtotals and grand totals in a PivotTable report. If
the source data contains automatic subtotals and grand totals that you created by using the
Subtotals command in the Outline group on the Data tab, use that same command to remove
the subtotals and grand totals before you create the report.
Office Data Connection files If you use an Office Data Connection (ODC) file (.odc) to retrieve
external data for your report, you can input the data directly into a PivotTable report. We
recommend that you retrieve external data for your reports by using ODC files.
OLAP source data When you retrieve source data from an OLAP database or a cube file, the
data is returned to Excel only as a PivotTable report or a PivotTable report that has been
converted to worksheet functions.
Non-OLAP source data This is the underlying data for a PivotTable report or a PivotChart report
that comes from a source other than an OLAP database. For example, data from relational
databases or text files.
93
when you use an existing PivotTable report as the source for a new report in the same
workbook, both reports share the same copy of the data. Because you reuse the same storage
area, the size of the workbook file is reduced and less data is kept in memory.
Location requirements To use a PivotTable report as the source for another report, both reports
must be in the same workbook. If the source PivotTable report is in a different workbook, copy
the source report to the workbook location where you want the new report to appear. PivotTable
reports and PivotChart reports in different workbooks are separate, each with its own copy of the
data in memory and in the workbook files.
Changes affect both reports When you refresh the data in the new report, Excel also updates
the data in the source report, and vice versa. When you group or ungroup items in one report,
both reports are affected. When you create calculated fields or calculated items in one report,
both reports are affected.
PivotChart reports You can base a new PivotTable report or PivotChart report on another
PivotTable report, but you cannot base it directly on another PivotChart report. However, Excel
creates an associated PivotTable report from the same data whenever you create a PivotChart
report; therefore, you can base a new report on the associated report. Changes to a PivotChart
report affect the associated PivotTable report, and vice versa.
To include additional data or different data, you can redefine the source data for the report. If
the data is substantially different with many new or additional fields, it may be easier to create a
new report.
Displaying new data brought in by refresh Refreshing a report can also change the data that is
available for display. For reports based on worksheet lists, Excel retrieves new fields within the
source range or named range that you specified. For reports based on external data, Excel
retrieves new data that meets the criteria for the underlying query or data that becomes
available in an OLAP cube. You can view any new fields in the Field List and add the fields to the
report.
Changing OLAP cubes that you create Reports based on OLAP data always have access to all of
the data in the cube. If you created an offline cube file that contains a subset of the data in a
server cube, you can use the Offline OLAP command to modify your cube file so that it contains
different data from the server.
EXCEL 2007 – ANALYSIS
Creating named Scenarios from defined cell ranges
Figure 13
95
Figure 14
Create scenarios
1. Start Office Excel 2007. Either open a file that includes some formulas that you would like
to use for your analysis, or start from a new worksheet, and then type in your data and
formulas.
2. Decide which values in the worksheet you will change and which will display the results. For
example, you might want to see what happens when you change several variables that
affect the budget and then display the result as an amount over or under budget.
3. To create a new scenario, on the Data tab, in the Data Tools group, click What-If Analysis,
and then click Scenario Manager
4. Click Add.
5. In the Scenario name box, type a name for the new scenario.
6. In the Changing cells box, enter the references for the cells that you want to change. To add
a cell to the list, press CTRL and then click the cell.
Note: To preserve the original values for the changing cells, first create a scenario that
contains the original cell values. Then, create the scenarios in which you change the values.
7. Under Protection, select the options that you want, and then click OK.
8. Next, in the Scenario Values dialog box, type the values that you want for the changing cells,
and then click OK.
9. If you want to create additional scenarios, click Add again, and then repeat steps 5 through
9. When you finish creating scenarios, click OK.
10. Double-click a scenario on the list in Scenario Manager to view it on the worksheet.
Summarize scenarios
1. On the Data tab, in the Data Tools group, click What-If Analysis, and then click Scenario
Manager.
2. To summarize the data in the scenarios, click Summary.
3. Decide whether you want a summary or PivotTable report.
4. Enter the cells that display the results, and then click OK. Excel 2007 creates a new
worksheet that summarizes the data in your scenarios. You can also merge the data from
scenarios on different worksheets.
Working with Goal seek
If you know the result that you want from a formula, but not the input value the formula needs
to get that result, you can use the Goal Seek feature. For example, use Goal Seek to change the
interest rate in cell B3 until the payment value in B4 equals ($900.00).
Figure 15
1. On the Data tab, in the Data Tools group, click What-If Analysis, and then click Goal Seek.
2. In the Set cell box, enter the reference for the cell that contains the formula you want to
resolve. (In the example, this is cell B4.)
3. In the To value box, type the result you want. (In the example, this is -900.)
4. In the By changing cell box, enter the reference for the cell that contains the value you want
to adjust. (In the example, this is cell B3.)
Note This cell must be referenced by the formula in the cell you specified in the Set cell box.
97
EXCEL 2007 - AUDITING
Tracing precedent cells
Select formula Formula bar Trace precedents in formula auditing group
Figure 16
Figure 17
Deleting Comments
Select comments containing cellReview TabDelete in Comments Group
Navigating Comments
Review TabNavigation Buttons in Comments Group
Show/Hide Comments
Review TabShow/hide Comments in Comments Group
Figure 18
EXCEL 2007 - MACROS
Displaying the Developer tab
Office button General Show Developer Tab
View Tab Macro in Macro Group Record MacroGive a macro Name Give a Keyboard
Shortcut
Figure 19
(Perform activities)
101
Figure 20
2. Running a Macro
Figure 21
103