Excel Function SP
Excel Function SP
FUNCTIONS
Discover how functions in Excel help you save time. If you are new to functions in Excel, we recommend you to read our
introduction to Formulas and Functions first.
1 Count and Sum: The most used functions in Excel are the functions that count and sum. You can count and sum based on
one criteria or multiple criteria.
2 Logical: Learn how to use Excel's logical functions, such as IF, AND, OR and NOT.
3 Cell References: Cell references in Excel are very important. Understand the difference between relative, absolute and
mixed reference, and you are on your way to success.
4 Date & Time: To enter a date in Excel, use the "/" or "-" characters. To enter a time, use the ":" (colon).
5 Text: Excel has many functions to offer when it comes to manipulating text strings.
6 Lookup & Reference: Learn all about Excel's lookup & reference functions, such as VLOOKUP, HLOOKUP, MATCH,
INDEX and CHOOSE.
7 Financial: This chapter illustrates Excel's most popular financial functions.
8 Statistical: An overview of some very useful statistical functions in Excel.
9 Round: This chapter illustrates three functions to round numbers in Excel. ROUND, ROUNDUP and ROUNDDOWN.
10 Formula Errors: This chapter teaches you how to deal with some common formula errors in Excel.
11 Array Formulas: This chapter helps you understand array formulas in Excel. Single cell array formulas perform multiple
calculations in one cell.
Functions +
Start learning today and become an Excel pro! You can find related examples and functions on the right side of each
chapter. Below you can find an overview.
1 Count and Sum: Countif | Count Blank/Nonblank Cells | Count Characters | Count Cells with Text | Sum | Running
Total | Sumif | Sumproduct
2 Logical: If | Comparison Operators | Or | Roll the Dice | Ifs | Contains Specific Text | Switch | If Cell is Blank
3 Cell References: Copy Exact Formula | 3D-reference | External References | Hyperlinks | Percent Change
4 Date & Time: DateDif | Today's Date | Calculate Age | Time Difference | Weekdays | Days until Birthday | Time
Sheet | Last Day of the Month | Holidays | Quarter | Day of the Year
5 Text: Separate Strings | Count Words | Text to Columns | Find | Search | Change Case | Remove Spaces | Compare
Text | Substitute vs Replace | Text | Concatenate | Substring
6 Lookup & Reference: Vlookup | Tax Rates | Index and Match | Two-way Lookup | Offset | Case-sensitive Lookup | Left
Lookup | Locate Maximum Value | Indirect | Two-column Lookup | Closest Match | Compare Two Columns | Xlookup
7 Financial: PMT | Loans with Different Durations | Investment or Annuity | Compound Interest | CAGR | Loan
Amortization Schedule | NPV | IRR | Depreciation
8 Statistical: Average | Negative Numbers to Zero | Random Numbers | Rank | Percentiles and Quartiles | Box and Whisker
Plot | AverageIf | Forecast | Absolute Value | MaxIfs and MinIfs | Weighted Average | Standard Deviation | Frequency
9 Round: Chop off Decimals | Nearest Multiple | Even and Odd
10 Formula Errors: IfError | IsError | Aggregate | Circular Reference | Formula Auditing | Floating Point Errors
11 Array Formulas: Count Errors | Count Unique Values | Count with Or Criteria | Sum Every Nth Row | Sum Largest
Numbers | Sum Range with Errors | Sum with Or Criteria | Most Frequently Occurring Word | System of Linear Equations
Countif
To count cells based on one criteria (for example, greater than 9), use the following COUNTIF function.
Note: visit our page about the COUNTIF function for many more examples.
Countifs
To count cells based on multiple criteria (for example, green and greater than 9), use the following COUNTIFS function.
Sum
To sum a range of cells, use the SUM function.
Note: visit our page about the SUM function for many more examples.
Sumif
To sum cells based on one criteria (for example, greater than 9), use the following SUMIF function (two arguments).
To sum cells based on one criteria (for example, green), use the following SUMIF function (three arguments, last argument
is the range to sum).
Note: visit our page about the SUMIF function for many more examples.
Sumifs
To sum cells based on multiple criteria (for example, circle and red), use the following SUMIFS function (first argument is
the range to sum).
General note: in a similar way, you can use the AVERAGEIF function to average cells based on one criteria and the
AVERAGEIFS function to average cells based on multiple criteria.
Countif
Numeric Criteria | Text Tricks | Count Booleans | Count Errors | And Criteria | Or Criteria | More about Countif | Count
Magic
The powerful COUNTIF function in Excel counts cells based on one criteria. This page contains many easy to follow
COUNTIF examples.
Numeric Criteria
Use the COUNTIF function in Excel to count cells that are equal to a value, count cells that are greater than or equal to a
value, etc.
1. The COUNTIF function below counts the number of cells that are equal to 20.
3. The COUNTIF function below counts the number of cells that are greater than or equal to 10.
Explanation: the & operator joins the 'greater than or equal to' symbol and the value in cell C1.
5. The COUNTIF function below counts the number of cells that are not equal to 7.
6. The COUNTIF functions below count the number of cells that are equal to 3 or 7.
Text Tricks
Use the COUNTIF function in Excel and a few tricks to count cells that contain specific text. Always enclose text in double
quotation marks.
1. The COUNTIF function below counts the number of cells that contain exactly star.
2. The COUNTIF function below counts the number of cells that contain exactly star + 1 character. A question mark (?)
matches exactly one character.
3. The COUNTIF function below counts the number of cells that contain exactly star + a series of zero or more characters.
An asterisk (*) matches a series of zero or more characters.
4. The COUNTIF function below counts the number of cells that contain star in any way.
5. The COUNTIF function below counts the number of cells that contain text.
Count Booleans
Use the COUNTIF function in Excel to count Boolean values (TRUE or FALSE).
1. The COUNTIF function below counts the number of cells that contain the Boolean TRUE.
2. The COUNTIF function below counts the number of cells that contain the Boolean FALSE.
Count Errors
Use the COUNTIF function in Excel to count specific errors.
1. The COUNTIF function below counts the number of cells that contain the #NAME? error.
2. The array formula below counts the total number of errors in a range of cells.
Note: finish an array formula by pressing CTRL + SHIFT + ENTER. Excel adds the curly braces {}. Visit our page
about Counting Errors for detailed instructions on how to create this array formula.
And Criteria
Counting with And criteria in Excel is easy. The COUNTIFS function (with the letter S at the end) in Excel counts cells
based on two or more criteria.
1. For example, to count the number of rows that contain Google and Stanford, simply use the COUNTIFS function.
Or Criteria
Counting with Or criteria in Excel can be tricky.
1. The COUNTIF functions below count the number of cells that contain Google or Facebook (one column). No rocket
science so far.
2. However, if you want to count the number of rows that contain Google or Stanford (two columns), you cannot simply use
the COUNTIF function twice (see the picture below).
Note: rows that contain Google and Stanford are counted twice, but they should only be counted once. 4 is the answer we
are looking for.
3. The array formula below does the trick.
Note: finish an array formula by pressing CTRL + SHIFT + ENTER. Excel adds the curly braces {}. Visit our page
about Counting with Or Criteria for detailed instructions on how to create this array formula.
More about Countif
The COUNTIF function is a great function. Let's take a look at a few more cool examples.
1. The COUNTIF function below uses a named range. The named range Ages refers to the range A1:A6.
2. The COUNTIF function below counts the number of cells that are less than the average of the ages (32.2).
3. To count cells between two numbers, use the COUNTIFS function (with the letter S at the end).
4. Use the COUNTIF function to count how many times each value occurs in the named range Ages.
Tip: use COUNTIF and conditional formatting to find and highlight duplicates in Excel.
Count Magic
The COUNTIF function can't count how many times a specific word occurs in a cell or range of cells. All we need is a little
magic!
1. The formula below counts how many times the word "dog" occurs in cell A1.
2. The formula below counts how many times the word "dog" occurs in the range A1:A2.
Note: visit our page about counting words to learn more about these formulas.
2. The COUNTA function below counts the number of nonblank cells in the range A1:A7. COUNTA stands for count all.
3. The COUNTIFS function below counts the number of blank cells in the range B1:B7 with one additional criteria (blue).
Explanation: the COUNTIFS function (with the letter S at the end) in Excel counts cells based on two or more criteria. Use
an empty string (two double quotes with nothing in between) to find blank cells.
4. The COUNTIFS function below counts the number of nonblank cells in the range B1:B7 with one additional criteria
(pink).
Count Characters
Learn how to count the number of characters in a cell or range of cells and how to count how many times a specific
character occurs in a cell or range of cells.
1. The LEN function in Excel counts the number of characters in a cell.
Note: as you can imagine, this formula can get quite long.
3. The array formula below counts the number of characters in a range of cells.
Note: finish an array formula by pressing CTRL + SHIFT + ENTER. Excel adds the curly braces {}. The array constant
{9;4;6;5} is used as an argument for the SUM function, giving a result of 24. Maybe this is one step too far for you at this
stage, but it shows you one of the many other powerful features Excel has to offer.
4. Use LEN and SUBSTITUTE to count how many times a specific character (in this example, the character a) occurs in a
cell.
Explanation: the SUBSTITUTE function replaces the character a (second argument) with an empty string (third argument).
LEN(SUBSTITUTE(A1,"a","")) equals 8 (the length of the string without the character a). If we subtract this number from
9 (total number of characters in cell A1), we get the number of occurrences of the character a in cell A1.
5. The array formula below counts how many times a specific character (in this example, the character a) occurs in a range
of cells.
Note: finish an array formula by pressing CTRL + SHIFT + ENTER. Excel adds the curly braces {}. The array constant
{1;1;2;1} is used as an argument for the SUM function, giving a result of 5. The SUBSTITUTE function is case-sensitive.
The A in Alaska is not counted.
6. The array formula below counts both lower and upper case occurrences of a specific character (in this example, the
character a).
1b. You can also create an array formula to count cells with text.
Note: visit our page about array formulas to learn more about single cell array formulas.
1c. You can also use the SUMPRODUCT function to count cells with text.
Note: visit our page about the SUMPRODUCT function to learn more about this function.
2a. Numbers, Booleans (TRUE or FALSE), blanks and errors are not counted as text.
2b. The formula below counts cells with text and counts cells with Booleans.
3a. Enter a space into cell A4. The COUNTIF function at step 1a and step 2a also counts cells with a space character.
3b. The COUNTIFS function below counts cells with text and excludes cells with a space character.
Note: the COUNTIFS function in Excel counts cells based on two or more criteria.
Sum
Sum Range | Sum Entire Column | Sum Non-contiguous Cells | AutoSum | Sum Every Nth Row | Sum Largest Numbers |
Sum Range with Errors
Use the SUM function in Excel to sum a range of cells, an entire column or non-contiguous cells. To create awesome SUM
formulas, combine the SUM function with other Excel functions.
Sum Range
Most of the time, you'll use the SUM function in Excel to sum a range of cells.
Note: you can also use the SUM function in Excel to sum an entire row. For example, =SUM(5:5) sums all values in the 5th
row.
AutoSum
Use AutoSum or press ALT + = to quickly sum a column or row of numbers.
1. First, select the cell below the column of numbers (or next to the row of numbers) you want to sum.
2. On the Home tab, in the Editing group, click AutoSum (or press ATL + =).
3. Press Enter.
Note: the formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
To enter an array formula, finish by pressing CTRL + SHIFT + ENTER.
Running Total
This example teaches you how to create a running total (cumulative sum) in Excel. A running total changes each time new
data is added to a list.
1. Select cell B9 and enter a simple SUM function.
Explanation: the first cell (B$2) in the range reference is a mixed reference. We fixed the reference to row 2 by adding a $
symbol in front of the row number. The second cell (B2) in the range reference is a normal relative reference.
3. Select cell C2, click on the lower right corner of cell C2 and drag it down to cell C7.
Explanation: when we drag the formula down, the mixed reference (B$2) stays the same, while the relative reference (B2)
changes to B3, B4, B5, etc.
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
4. For example, take a look at the formula in cell C3.
6. At step 2, enter the IF function shown below (and drag it down to cell C7) to only display a cumulative sum if data has
been entered.
Sumif
Numeric Criteria | Text Criteria | Date Criteria | And Criteria | Or Criteria
The powerful SUMIF function in Excel sums cells based on one criteria. This page contains many easy to follow SUMIF
examples.
Numeric Criteria
Use the SUMIF function in Excel to sum cells based on numbers that meet specific criteria.
1. The SUMIF function below (two arguments) sums values in the range A1:A5 that are less than or equal to 10.
2. The following SUMIF function gives the exact same result. The & operator joins the 'less than or equal to' symbol and
the value in cell C1.
3. The SUMIF function below (three arguments, last argument is the range to sum) sums values in the range B1:B5 if the
corresponding cells in the range A1:A5 contain the value 25.
4. The following SUMIF function gives the exact same result (second argument refers to cell D1).
Text Criteria
Use the SUMIF function in Excel to sum cells based on text strings that meet specific criteria. Always enclose text in
double quotation marks.
1. The SUMIF function below sums values in the range B1:B5 if the corresponding cells in the range A1:A5 contain exactly
circle.
2. The SUMIF function below sums values in the range B1:B5 if the corresponding cells in the range A1:A5 do not contain
exactly triangle.
3. The SUMIF function below sums values in the range B1:B5 if the corresponding cells in the range A1:A5 contain exactly
circle + 1 character. A question mark (?) matches exactly one character.
4. The SUMIF function below sums values in the range B1:B5 if the corresponding cells in the range A1:A5 contain a series
of zero or more characters + le. An asterisk (*) matches a series of zero or more characters.
5. The SUMIF functions below sum values in the range B1:B5 if the corresponding cells in the range A1:A5 contain exactly
triangle or circle8.
Date Criteria
Use the SUMIF function in Excel to sum cells based on dates that meet specific criteria.
1. The SUMIF function below sums the sales after January 20th, 2018.
Note: the DATE function in Excel accepts three arguments: year, month and day.
2. The SUMIF function below sums today's sales.
Note: the SUMIFS function in Excel sums cells based on two or more criteria (first argument is the range to sum, followed
by two or more range/criteria pairs). Adjust the dates to sum the sales in a specific month, year, etc.
And Criteria
Summing with And criteria in Excel is easy.
1. For example, to sum the cells that meet the following criteria: Google and Stanford (two criteria ranges), simply use the
SUMIFS function (with the letter S at the end).
Or Criteria
Summing with Or criteria in Excel can be tricky.
1. The formula below sums the cells that meet the following criteria: Google or Facebook (one criteria range). No rocket
science so far.
2. However, if you want to sum the cells that meet the following criteria: Google or Stanford (two criteria ranges), you
cannot simply use the SUMIF function twice (see the picture below).
Note: cells that meet the criteria Google and Stanford are added twice, but they should only be added once. 10 is the answer
we are looking for.
3. The array formula below does the trick.
Note: finish an array formula by pressing CTRL + SHIFT + ENTER. Excel adds the curly braces {}. Visit our page
about Summing with Or Criteria for detailed instructions on how to create this array formula.
Sumproduct
Basic Use | Advanced Use
To calculate the sum of the products of corresponding numbers in one or more ranges, use Excel's powerful
SUMPRODUCT function.
Basic Use
1. For example, the SUMPRODUCT function below calculates the total amount spent.
Explanation: the SUMPRODUCT function performs this calculation: (2 * 1000) + (4 * 250) + (4 * 100) + (2 * 50) = 3500.
2. The ranges must have the same dimensions or Excel will display the #VALUE! error.
3. The SUMPRODUCT function treats any entries that are not numeric as if they were zeros.
4. If you supply a single range, the SUMPRODUCT function produces the exact same result as the SUM function.
Advanced Use
The SUMPRODUCT function is an extremely versatile function and can produce the same result as many built-in functions
in Excel and even array formulas!
1a. For example, the COUNTIF function below counts the number of cells that contain exactly star.
1b. The SUMPRODUCT function below produces the exact same result.
1d. The SUMPRODUCT function is not perfect! You cannot use wildcard characters (? and *) when you use the
SUMPRODUCT function.
2a. The array formula below counts the number of characters in a range of cells.
Note: finish an array formula by pressing CTRL + SHIFT + ENTER. Excel adds the curly braces {}.
2b. The SUMPRODUCT function below produces the exact same result.
Note: the array constant {9;4;6;5} is used as an argument for the SUMPRODUCT function, giving a result of 24. The
SUMPRODUCT function handles arrays natively so you don't have to finish by pressing CTRL + SHIFT + ENTER. This is
one of the biggest advantages of the SUMPRODUCT function because the curly braces {} confuse many Excel beginners!
3a. The array formula below sums the sales in 2018.
3b. The SUMPRODUCT function below produces the exact same result.
Logical Functions
If | And | Or | Not
Learn how to use Excel's logical functions, such as IF, AND, OR and NOT.
If
The IF function checks whether a condition is met, and returns one value if true and another value if false.
Explanation: if the score is greater than or equal to 60, the IF function returns Pass, else it returns Fail. Visit our page about
the IF function for many more examples.
And
The AND Function returns TRUE if all conditions are true and returns FALSE if any of the conditions are false.
Explanation: the AND function returns TRUE if the first score is greater than or equal to 60 and the second score is greater
than or equal to 90, else it returns FALSE.
Or
The OR function returns TRUE if any of the conditions are TRUE and returns FALSE if all conditions are false.
Explanation: the OR function returns TRUE if at least one score is greater than or equal to 60, else it returns FALSE. Visit
our page about the OR function for many more examples.
Not
The NOT function changes TRUE to FALSE, and FALSE to TRUE.
Explanation: in this example, the NOT function reverses the result of the OR function (see
If
Simple If Examples | And/Or Criteria | Nested If | More about If
The IF function is one of the most used functions in Excel. This page contains many easy to follow IF examples.
Simple If Examples
The IF function checks whether a condition is met, and returns one value if true and another value if false.
Explanation: if the price is greater than 500, the IF function returns High, else it returns Low.
Note: you can use the following comparison operators: = (equal to), > (greater than), < (less than), >= (greater than or equal
to), <= (less than or equal to) and <> (not equal to).
2. Always enclose text in double quotation marks.
3a. The formula below calculates the progress between two points in time.
3b. You can use the IF function to display an empty string if the end value hasn't been entered yet (see row 5).
Explanation: if the end value is not empty (<> means not equal to), the IF function calculates the progress between the start
and end value, else it displays an empty string (two double quotes with nothing in between).
And/Or Criteria
Use the IF function in combination with the AND function and the OR function and become an Excel expert.
1. For example, take a look at the IF function in cell D2 below.
Explanation: the AND function returns TRUE if the first score is greater than or equal to 60 and the second score is greater
than or equal to 90, else it returns FALSE. If TRUE, the IF function returns Pass, if FALSE, the IF function returns Fail.
Explanation: the OR function returns TRUE if at least one score is greater than or equal to 60, else it returns FALSE. If
TRUE, the IF function returns Pass, if FALSE, the IF function returns Fail.
Explanation: the AND function above has two arguments separated by a comma (Table, Green or Blue). The AND function
returns TRUE if Product equals "Table" and Color equals "Green" or "Blue". If TRUE, the IF function reduces the price by
50%, if FALSE, the IF function reduces the price by 10%.
Nested If
The IF function in Excel can be nested, when you have multiple conditions to meet. The FALSE value is being replaced by
another IF function to make a further test.
Explanation: if the score equals 1, the nested IF formula returns Bad, if the score equals 2, the nested IF formula returns
Good, if the score equals 3, the nested IF formula returns Excellent, else it returns Not Valid. If you have Excel 2016 or
later, simply use the IFS function.
2. For example, take a look at the nested IF formula in cell C2 below.
Explanation: if the score is less than 60, the nested IF formula returns F, if the score is greater than or equal to 60 and less
than 70, the formula returns D, if the score is greater than or equal to 70 and less than 80, the formula returns C, if the score
is greater than or equal to 80 and less than 90, the formula returns B, else it returns A.
More about If
The IF function is a great function. Let's take a look at a few more cool examples.
1. For example, use IF and AND to test if a value is between two numbers.
Explanation: the AND function returns TRUE if the person is older than 12 and younger than 20, else it returns FALSE. If
TRUE, the IF function returns Yes, if FALSE, the IF function returns No.
2. You can combine IF with AVERAGE, SUM and other Excel functions. The sky is the limit!
Explanation: the AND function returns TRUE if the input value is greater than 100 and the average of the values in
the named range Data1 is greater than 100, else it returns FALSE. If TRUE, the IF function returns the sum of Data2, if
FALSE, the IF function returns 0.
Confused? You can always use the Evaluate Formula tool to step through your IF formula. This Excel tool helps you
understand a formula.
4. On the Formulas tab, in the Formula Auditing group, click Evaluate Formula.
Note: try it yourself. Download the Excel file and choose one of the IF formulas explained on this page. You can use this
tool to step through all kinds of formulas.
Comparison Operators
Equal to | Greater than | Less than | Greater than or equal to | Less than or equal to | Not equal to
Use comparison operators in Excel to check if two values are equal to each other, if one value is greater than another value,
if one value is less than another value, etc.
Equal to
The equal to operator (=) returns TRUE if two values are equal to each other.
1. For example, take a look at the formula in cell C1 below.
Explanation: the formula returns TRUE because the value in cell A1 is equal to the value in cell B1. Always start a formula
with an equal sign (=).
Explanation: if the two values (numbers or text strings) are equal to each other, the IF function returns Yes, else it returns
No.
Greater than
The greater than operator (>) returns TRUE if the first value is greater than the second value.
1. For example, take a look at the formula in cell C1 below.
Explanation: the formula returns TRUE because the value in cell A1 is greater than the value in cell B1.
Explanation: this OR function returns TRUE if at least one value is greater than 50, else it returns FALSE.
Less than
The less than operator (<) returns TRUE if the first value is less than the second value.
1. For example, take a look at the formula in cell C1 below.
Explanation: the formula returns TRUE because the value in cell A1 is less than the value in cell B1.
Explanation: this AND function returns TRUE if both values are less than 80, else it returns FALSE.
Explanation: the formula returns TRUE because the value in cell A1 is greater than or equal to the value in cell B1.
2. The COUNTIF function below uses the greater than or equal to operator.
Explanation: this COUNTIF function counts the number of cells that are greater than or equal to 10.
Less than or equal to
The less than or equal to operator (<=) returns TRUE if the first value is less than or equal to the second value.
1. For example, take a look at the formula in cell C1 below.
Explanation: the formula returns TRUE because the value in cell A1 is less than or equal to the value in cell B1.
2. The SUMIF function below uses the less than or equal to operator.
Explanation: this SUMIF function sums values in the range A1:A5 that are less than or equal to 10.
Not Equal to
The not equal to operator (<>) returns TRUE if two values are not equal to each other.
1. For example, take a look at the formula in cell C1 below.
Explanation: the formula returns TRUE because the value in cell A1 is not equal to the value in cell B1.
Explanation: if the two values (numbers or text strings) are not equal to each other, the IF function returns No, else it returns
Yes.
Or
The OR function in Excel returns TRUE if any of the conditions are true and returns FALSE if all conditions are false.
Combine the OR function with other functions and become an Excel expert.
1. For example, take a look at the OR function in cell D2 below.
Explanation: the OR function returns TRUE if the first score is greater than 70 or the second score is equal to 100, else it
returns FALSE.
Explanation: the OR function returns TRUE or FALSE (see previous example). If TRUE, the IF function returns Pass, if
FALSE, the IF function returns Fail.
Explanation: the OR function returns TRUE if at least one score is greater than or equal to 90, else it returns FALSE. The
OR function can test up to 255 conditions. The only way for the OR function to return FALSE is if all the conditions are
FALSE (row 6).
4. The array formula below uses the OR function to return TRUE if any cell in the range A1:E6 is greater than or equal to
90.
Explanation: finish an array formula by pressing CTRL + SHIFT + ENTER. Excel adds the curly braces {}. The value in
cell D4 is greater than or equal to 90. As a result, the array formula returns TRUE.
Explanation: the AND Function returns TRUE if all conditions are true and returns FALSE if any of the conditions are
false. The AND function above has two arguments separated by a comma (Table, Green or Blue). The AND function
returns TRUE if Product equals "Table" and Color equals "Green" or "Blue".
Explanation: the WEEKDAY function in Excel returns a number from 1 (Sunday) to 7 (Saturday) representing the day of
the week of a date. As a result, the OR function returns TRUE if the date falls on a weekend.
7. Don't confuse the OR function with the XOR (Exclusive OR) function.
Explanation: the XOR function returns TRUE if an odd number of conditions are true, and FALSE otherwise. With two
conditions (see example above) the XOR function returns TRUE if one condition is true (row 2) and returns FALSE if both
conditions are false (row 3, 4 and 6) or both conditions are true! (row 5).
1. At the moment, each cell contains the letter l (as in lion). With a Wingdings font style, these l's look like dots.
3. Enter the formula shown below into the yellow cells. If we roll 2, 3, 4, 5 or 6, these cells should contain a dot.
4. Enter the formula shown below into the red cells. If we roll 4, 5 or 6, these cells should contain a dot.
5. Enter the formula shown below into the blue cells. If we roll 6, these cells should contain a dot.
6. Enter the formula shown below into the gray cell. If we roll 1, 3 or 5, this cell should contain a dot.
8. Change the font color of cell C2 and cell G2 to green (so the numbers are not visible).
Result.
Ifs
Use the IFS function in Excel 2016 or later when you have multiple conditions to meet. The IFS function returns a value
corresponding to the first TRUE condition.
Note: if you don't have Excel 2016 or later, you can nest the IF function.
1a. If the value in cell A1 equals 1, the IFS function returns Bad.
1b. If the value in cell A1 equals 2, the IFS function returns Good.
1c. If the value in cell A1 equals 3, the IFS function returns Excellent.
1d. If the value in cell A1 equals another value, the IFS function returns No Valid Score.
Note: instead of TRUE, you can also use 1=1 or something else that is always TRUE.
2b. If the value in cell A1 is greater than or equal to 60 and less than 70, the IFS function returns D.
2c. If the value in cell A1 is greater than or equal to 70 and less than 80, the IFS function returns C.
2d. If the value in cell A1 is greater than or equal to 80 and less than 90, the IFS function returns B.
2e. If the value in cell A1 is greater than or equal to 90, the IFS function returns A.
Note: to slightly change the boundaries, you might want to use "<=" instead of "<" in your own function.
Explanation: "duck" found at position 10, "donkey" found at position 1, cell A4 does not contain the word "horse" and
"goat" found at position 12.
2. Add the ISNUMBER function. The ISNUMBER function returns TRUE if a cell contains a number, and FALSE if not.
Explanation: cell A2 contains the word "duck", cell A3 contains the word "donkey", cell A4 does not contain the word
"horse" and cell A5 contains the word "goat".
3. You can also check if a cell contains specific text, without displaying the substring. Make sure to enclose the substring in
double quotation marks.
4. To perform a case-sensitive search, replace the SEARCH function with the FIND function.
Explanation: the formula in cell C3 returns FALSE now. Cell A3 does not contain the word "donkey" but contains the word
"Donkey".
5. Add the IF function. The formula below (case-insensitive) returns "Found" if a cell contains specific text, and "Not
Found" if not.
6. You can also use IF and COUNTIF in Excel to check if a cell contains specific text. However, the COUNTIF function is
always case-insensitive.
Switch
This example teaches you how to use the SWITCH function in Excel 2016 or later instead of the IFS function.
1a. For example, the IFS function below finds the correct states.
Explanation: cell A2 contains the string 85-UT. The RIGHT function extracts the 2 rightmost characters from this string
(UT). As a result, the IFS function returns the correct state (Utah). If the 2 rightmost characters are not equal to UT, TX or
OH, the IFS function returns a question mark. Instead of TRUE, you can also use 1=1 or something else that is always
TRUE.
1b. The SWITCH function below produces the exact same result but is much easier to read.
Explanation: if the first argument (RIGHT(A2,2) in this example) equals UT, the SWITCH function returns Utah. If TX,
Texas. If OH, Ohio. The last argument (a question mark in this example) is always the default value (if there's no match).
2. Why not always use the SWITCH function in Excel? There are many examples where you cannot use the SWITCH
function instead of the IFS function.
Explanation: because we use"<" and ">=" symbols in this IFS function, we cannot use the SWITCH function.
If Cell is Blank
If Blank | If Not Blank | Highlight Blank Cells
Use the IF function and an empty string in Excel to check if a cell is blank. Use IF and ISBLANK to produce the exact same
result.
If Blank
Remember, the IF function in Excel checks whether a condition is met, and returns one value if true and another value if
false.
1. The IF function below returns Yes if the input value is equal to an empty string (two double quotes with nothing in
between), else it returns No.
Note: if the input cell contains a space, it looks blank. However, if this is the case, the input value is not equal to an empty
string and the IF function above will return No.
Note: the ISBLANK function returns TRUE if a cell is empty and FALSE if not. If the input cell contains a space or a
formula that returns an empty string, it looks blank. However, if this is the case, the input cell is not empty and the formula
above will return No.
If Not Blank
In Excel, <> means not equal to.
1. The IF function below multiplies the input value by 2 if the input value is not equal to an empty string (two double quotes
with nothing in between), else it returns an empty string.
2. Use IF, NOT and ISBLANK to produce the exact same result.
4. Select Blanks from the drop-down list, select a formatting style and click OK.
Result.
Note: visit our page about conditional formatting to learn much more about this cool Excel feature.
Cell References
Relative Reference | Absolute Reference | Mixed Reference
Cell references in Excel are very important. Understand the difference between relative, absolute and mixed reference, and
you are on your way to success.
Relative Reference
By default, Excel uses relative references. See the formula in cell D2 below. Cell D2 references (points to) cell B2 and cell
C2. Both references are relative.
1. Select cell D2, click on the lower right corner of cell D2 and drag it down to cell D5.
Cell D3 references cell B3 and cell C3. Cell D4 references cell B4 and cell C4. Cell D5 references cell B5 and cell C5. In
other words: each cell references its two neighbors on the left.
Absolute Reference
See the formula in cell E3 below.
1. To create an absolute reference to cell H3, place a $ symbol in front of the column letter and row number ($H$3) in the
formula of cell E3.
The reference to cell H3 is fixed (when we drag the formula down and across). As a result, the correct lengths and widths in
inches are calculated.
Mixed Reference
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
2. We want to copy this formula to the other cells quickly. Drag cell F2 across one cell, and look at the formula in cell G2.
Do you see what happens? The reference to the price should be a fixed reference to column B. Solution: place a $ symbol in
front of the column letter ($B2) in the formula of cell F2. In a similar way, when we drag cell F2 down, the reference to the
reduction should be a fixed reference to row 6. Solution: place a $ symbol in front of the row number (B$6) in the formula
of cell F2.
Result:
Note: we don't place a $ symbol in front of the row number of $B2 (this way we allow the reference to change from $B2
(Jeans) to $B3 (Shirts) when we drag the formula down). In a similar way, we don't place a $ symbol in front of the column
letter of B$6 (this way we allow the reference to change from B$6 (Jan) to C$6 (Feb) and D$6 (Mar) when we drag the
formula across).
When you copy this formula to cell B3 (select cell A3, press CTRL + c, select cell B3, press CTRL + v), the formula
will automatically reference the values in column B.
If you don't want this but instead want to copy the exact formula (without changing the cell references), execute
the following easy steps.
Result:
Both cell A3 and cell B3 contain the exact same formula now.
3D-reference
A 3D-reference in Excel refers to the same cell or range on multiple worksheets. First, we'll look at the alternative.
1. On the Company sheet, select cell B2 and type an equal sign =
Result.
4. This is quite a lot of work. Instead of doing this, use the following 3D-reference: North:South!B2 as the argument for the
SUM function.
5. If you add worksheets between North and South, this worksheet is automatically included in the formula in cell B2.
External References
Create External Reference | Alert | Edit Links
An external reference in Excel is a reference to a cell or range of cells in another workbook. Below you can find the
workbooks of three divisions (North, Mid and South).
2. In the Company workbook, select cell B2 and type the equal sign =
4. Click North.
6. Type a +
Result:
Edit Links
On the Data tab, in the Queries & Connections group, click Edit Links to launch the Edit Links dialog box.
1. If you didn't update the links, you can still update the links here. Select a workbook and click Update Values to update the
links to this workbook. Note how the Status changes to OK.
2. If you don't want to display the alert and update the links automatically, Click Startup Prompt, select the third option, and
click OK.
Hyperlinks
Existing File or Web Page | Place in This Document | Hyperlink Function
Use the 'Insert Hyperlink' dialog box in Excel to create a hyperlink to an existing file, a web page or a place in this
document. You can also use the HYPERLINK function.
3a. To create a hyperlink to an existing file, select a file (use the Look in drop-down list, if necessary).
3b. To create a hyperlink to a web page, type the Text to display, the Address, and click OK.
Result:
Note: if you want to change the text that appears when you hover over the link, click ScreenTip.
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
4. Type the Text to display, the cell reference, and click OK.
Result:
Note: if you want to change the text that appears when you hover over the hyperlink, click ScreenTip.
Hyperlink Function
You can also use the HYPERLINK function in Excel to create hyperlinks. The HYPERLINK function has two arguments.
Note: instead of creating a hyperlink to a web page, create a hyperlink to an existing file. For example, replace the first
argument with "C:\Reports\sales2020.docx" and the second argument with "Open Report".
Percent Change
The percent change formula is used very often in Excel. For example, to calculate the Monthly Change and Total Change.
1a. Select cell C3 and enter the formula shown below.
1b. Select cell C3. On the Home tab, in the Number group, apply a Percentage format.
1c. Select cell C3, click on the lower right corner of cell C3 and drag it down to cell C13.
2a. In a similar way, we can calculate the Total Change. This time we fix the reference to cell B2. Select cell D3 and enter
the formula shown below.
2b. Select cell D3. On the Home tab, in the Number group, apply a Percentage format.
2c. Select cell D3, click on the lower right corner of cell D3 and drag it down to cell D13.
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
Explanation: when we drag the formula down, the absolute reference ($B$2) stays the same, while the relative reference
(B3) changes to B4, B5, B6, etc.
Note: Dates are in US Format. Months first, Days second. This type of format depends on your windows regional settings.
Learn more about Date and Time formats.
Year, Month, Day
To get the year of a date, use the YEAR function.
Note: use the MONTH and DAY function to get the month and day of a date.
Date Function
1. To add a number of days to a date, use the following simple formula.
2. To add a number of years, months and/or days, use the DATE function.
Note: the DATE function accepts three arguments: year, month and day. Excel knows that 6 + 2 = 8 = August has 31 days
and rolls over to the next month (23 August + 9 days = 1 September).
Note: use the MINUTE and SECOND function to return the minute and second.
Time Function
To add a number of hours, minutes and/or seconds, use the TIME function.
DateDif
To get the number of days, weeks or years between two dates in Excel, use the DATEDIF function. The DATEDIF function
has three arguments.
1. Fill in "d" for the third argument to get the number of days between two dates.
2. Fill in "m" for the third argument to get the number of months between two dates.
3. Fill in "y" for the third argument to get the number of years between two dates.
4. Fill in "yd" for the third argument to ignore years and get the number of days between two dates.
5. Fill in "md" for the third argument to ignore months and get the number of days between two dates.
6. Fill in "ym" for the third argument to ignore years and get the number of months between two dates.
Important note: the DATEDIF function returns the number of complete days, months or years. This may give unexpected
results when the day/month number of the second date is lower than the day/month number of the first date. See the
example below.
The difference is 6 years. Almost 7 years! Use the following formula to return 7 years.
Today's Date
Today and Now | Static Date and Time
To enter today's date in Excel, use the TODAY function. To enter the current date and time, use the NOW function. To
enter the current date and time as a static value, use keyboard shortcuts.
Today and Now
1. To enter today's date in Excel, use the TODAY function.
Note: the TODAY function takes no arguments. This date will update automatically when you open the workbook on
another date.
2. To enter the current date and time, use the NOW function.
Note: the NOW function takes no arguments. This time will update automatically whenever the sheet is recalculated. This
happens when you make a change to any cell or when you open the workbook. Press F9 to manually recalculate the
workbook.
3. To enter the current time only, use NOW()-TODAY() and apply a time format.
Note: dates are stored as numbers in Excel and count the number of days since January 0, 1900. Times are handled
internally as numbers between 0 and 1. Visit our page about date and time formats for more information.
Static Date and Time
1. To enter the current date as a static value, press CTRL + ; (semicolon).
Note: this date will not change when you open the workbook on another date.
2. To enter the current time as a static value, press CTRL + SHIFT + ; (semicolon).
Note: this time will not change when you make a change to a cell or when you open the workbook.
3. To enter the current date and time as a static value, simply press CTRL + ; (semicolon), enter a space and press CTRL +
SHIFT + ; (semicolon).
Calculate Age
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
To calculate the age of a person in Excel, use DATEDIF and TODAY. The DATEDIF function has three arguments.
1. Enter the date of birth into cell A2.
Note: fill in "y" for the third argument to get the number of complete years between the date of birth and today's date.
Note: the DATE function accepts three arguments: year, month and day.
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
Note: fill in "ym" for the third argument to ignore years and get the number of months between two dates. Fill in "md" for
the third argument to ignore months and get the number of days between two dates. Use the & operator to join strings.
Time Difference
Simple Formula | Time Difference Formula | Time Difference in Hours as Decimal Value
Calculating the difference between two times in Excel can be tricky. Times are handled internally as numbers between 0
and 1.
Simple Formula
Let's start with a simple formula that calculates the difference between two times in the same day.
Note: AM is used for times in the night and morning. PM is used for times in the afternoon and evening. Change the Time
format to display a time with or without AM/PM.
2. Change the number format of the values in cell A2, B2 and C2 to General.
Note: times are handled internally as numbers between 0 and 1. For example, 6:00 AM is represented as 0.25 (quarter
through the day).
The simple formula shown above doesn't work if the start time is before midnight and the end time is after midnight.
2. To clearly see this, change the number format of the values in cell A2, B2 and C2 to General.
Explanation: if the end time is greater than or equal to the start time, simply subtract the start time from the end time. If not,
add 1 (full day) to the end time to represent a time on the next day and subtract the start time.
Weekdays
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
2. You can also use the TEXT function to display the day of the week.
3. Or create a custom date format (dddd) to display the day of the week.
Networkdays function
1. The NETWORKDAYS function returns the number of weekdays (weekends excluded) between two dates.
2. If you supply a list of holidays, the NETWORKDAYS function returns the number of workdays (weekends and holidays
excluded) between two dates.
3. Dates are stored as numbers in Excel and count the number of days since January 0, 1900. Instead of supplying a list,
supply an array constant of the numbers that represent these dates. To achieve this, select E1:E2 in the formula and press
F9.
Workday function
The WORKDAY function is (almost) the opposite of the NETWORKDAYS function. It returns the date before or after a
specified number of weekdays (weekends excluded).
Note: the WORKDAY function returns the serial number of the date. Apply a Date format to display the date.
The calendar below helps you understand the WORKDAY function.
Again, if you supply a list of holidays, the WORKDAY function returns the date before or after a specified number of
workdays (weekends and holidays excluded).
3. The most difficult part in order to get the number of days until your birthday is to find your next birthday. The formula
below does the trick.
Explanation: The DATE function accepts three arguments: year, month and day. We used the DATEDIF function to find
the number of complete years ("y") between Date of Birth and Today. DATEDIF(A2,B2,"y") equals 38. If 38 complete
years have passed since your date of birth (in other words, you have already celebrated your 38th birthday), your next
birthday will be 38 + 1 = 39 years after your date of birth.
4. Next, we use the DATEDIF function to find the number of days ("d") between Today and Next Birthday.
Time Sheet
This example teaches you how to create a simple timesheet calculator in Excel. Cells that contain formulas are colored light
yellow. If you are in a hurry, simply download the Excel file.
1. To automatically calculate the next 4 days and dates when you enter a start date, use the formulas below.
3. Right click, click Format Cells, and select the right Time format. Use the circled format for cell K12, K13 and K14.
4. To automatically calculate the hours worked each day, the total hours and the overtime hours, use the formulas below.
Note: the EOMONTH function returns the serial number of the date. Apply a Date format to display the date.
2. For example, get the date of the last day of the next month.
3. For example, get the date of the last day of the current month - 8 months = 6 - 8 = -2 = October (-2 + 12 = 10), 2015!
Holidays
This example teaches you how to get the date of a holiday for any year (2020, 2021, etc). If you are in a hurry, simply
download the Excel file.
Before you start: the CHOOSE function returns a value from a list of values, based on a position number. For example,
=CHOOSE(3,"Car","Train","Boat","Plane") returns Boat. The WEEKDAY function returns a number from 1 (Sunday) to 7
(Saturday) representing the day of the week of a date.
1. This is what the spreadsheet looks like. If you enter a year into cell C2, Excel returns all the holidays for that year. Of
course, New Year's Day, Independence Day, Veteran's Day and Christmas Day are easy.
2. All other holidays can be described in a similar way: the xth day in a month (except Memorial day which is slightly
different). Let's take a look at Thanksgiving Day. If you understand Thanksgiving Day, you understand all holidays.
Thanksgiving is celebrated the 4th Thursday in November.
Explanation: DATE(C2,11,1) reduces to 11/1/2020. WEEKDAY(DATE(C2,11,1)) reduces to 1 (Sunday). Now the formula
reduces to 11/1/2020 + 21 + CHOOSE(1,4,3,2,1,0,6,5) = 11/1/2020 + 21 + 4 = 11/26/2020. We needed the 4 extra days
because it takes 4 days until the first Thursday in November. From there, it takes another 21 days (3 weeks) until the 4rd
Thursday in November. It doesn't matter on which day November 1 falls, the CHOOSE function correctly adds the number
of days until the first Thursday in November (notice the pattern in the list of values). From there, it always takes another 21
days until the 4rd Thursday in November. Therefore, this formula works for every year.
3. Let's take a look at Martin Luther King Jr. Day. This formula is almost the same. Martin Luther King Jr. Day is
celebrated the 3rd Monday in January. The first DATE function reduces to the first of January this time. The base position
(0) in the list of values for the CHOOSE function is located at the second spot now (we are looking for a Monday)
The calendar below helps you understand Martin Luther King Jr. Day 2020.
Explanation: DATE(C2,1,1) reduces to 1/1/2020. WEEKDAY(DATE(C2,1,1)) reduces to 4 (Wednesday). Now the formula
reduces to 1/1/2020 + 14 + CHOOSE(4,1,0,6,5,4,3,2) = 1/1/2020 + 14 + 5 = 1/20/2020. We needed the 5 extra days because
it takes 5 days until the first Monday in January.
Quarter
An easy formula that returns the quarter for a given date. There's no built-in function in Excel that can do this.
1. Enter the formula shown below.
Explanation: ROUNDUP(x,0) always rounds x up to the nearest integer. The MONTH function returns the month number
of a date. In this example, the formula reduces to =ROUNDUP(5/3,0), =ROUNDUP(1.666667,0), 2. May is in Quarter 2.
Explanation: now it's not difficult to see that the first three values (months) in column B are rounded up to 1 (Quarter 1), the
next three values (months) in column B are rounded up to 2 (Quarter 2), etc.
2. Use the DATE function below to return January 1, 2016. The DATE function accepts three arguments: year, month and
day.
Explanation: dates and times are stored as numbers in Excel and count the number of days since January 0, 1900. June 23,
2016 is the same as 42544. January 1, 2016 is the same as 42370. Subtracting these numbers and adding 1 gives the day of
the year. 42544 - 42370 + 1 = 174 + 1 = 175.
Text Functions
Join Strings | Left | Right | Mid | Len | Find | Substitute
Excel has many functions to offer when it comes to manipulating text strings.
Join Strings
To join strings, use the & operator.
Note: instead of using the & operator, use the CONCATENATE function in Excel.
Left
To extract the leftmost characters from a string, use the LEFT function.
Right
To extract the rightmost characters from a string, use the RIGHT function.
Mid
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
To extract a substring, starting in the middle of a string, use the MID function.
Len
To get the length of a string, use the LEN function.
Find
To find the position of a substring in a string, use the FIND function.
Note: string "am" found at position 3. Visit our page about the FIND function for more examples.
Substitute
To replace existing text with new text in a string, use the SUBSTITUTE function.
Separate Strings
This example teaches you how to separate strings in Excel.
The problem we are dealing with is that we need to tell Excel where we want to separate the string. In case of Smith, Mike
the comma is at position 6 while in case of Williams, Janet the comma is at position 9.
Explanation: to find the position of the comma, use the FIND function (position 6). To get the length of a string, use the
LEN function (11 characters). =RIGHT(A2,LEN(A2)-FIND(",",A2)-1) reduces to =RIGHT(A2,11-6-1). =RIGHT(A2,4)
extracts the 4 rightmost characters and gives the desired result (Mike).
Explanation: to find the position of the comma, use the FIND function (position 6). =LEFT(A2,FIND(",", A2)-1) reduces to
=LEFT(A2,6-1). =LEFT(A2,5) extracts the 5 leftmost characters and gives the desired result (Smith).
Count Words
First, let's count the total number of words in a cell or range of cells. Finally, let's count how many times a specific word
occurs in a cell or range of cells.
1. The TRIM function below returns a string with only regular spaces.
5. To count the total number of words in cell A1, subtract the length of the string without spaces (formula from step 4) from
the length of the string with only regular spaces (formula from step 2) and add 1.
Conclusion: to count the total number of words in a cell, simply count the number of spaces and add 1 to this result. 1 space
means 2 words, 2 spaces means 3 words, etc.
6. To count the total number of words in the range A1:A2, add the SUMPRODUCT function and replace A1 with A1:A2.
Note: visit our page about the SUMPRODUCT function to learn more about this Excel function.
Finally, let's count how many times a specific word occurs in a cell or range of cells. This trick is pretty cool.
7. The LEN function below returns the length of the original text in cell A1.
8. The SUBSTITUTE function below returns the string without the word "dog".
10. Subtract the length of the string without the word "dog" (formula from step 9) from the length of the original text in cell
A1 (formula from step 7).
Conclusion: after removing the word "dog" from the original text, 12 characters are missing.
11. We know the length of the word "dog" (3), so the word "dog" occurs 12 / 3 = 4 times in cell A1.
12. To count how many times the word "dog" occurs in the range A1:A2, add the SUMPRODUCT function and replace A1
with A1:A2.
13. Use the COUNTIF function in Excel to count the number of cells that contain a specific word.
Note: an asterisk (*) matches a series of zero or more characters. Visit our page about the COUNTIF function to learn more
about this great Excel function.
Text to Columns
To separate the contents of one Excel cell into separate columns, you can use the 'Convert Text to Columns Wizard'. For
example, when you want to separate a list of full names into last and first names.
1. Select the range with full names.
2. On the Data tab, in the Data Tools group, click Text to Columns.
4. Clear all the check boxes under Delimiters except for the Comma and Space check box.
5. Click Finish.
Note: This example has commas and spaces as delimiters. You may have other delimiters in your data. Experiment by
checking and unchecking the different check boxes. You get a live preview of how your data will be separated.
Result:
Find
Use the FIND function in Excel to find the position of a substring in a string. The FIND function is case-sensitive.
1. The FIND function below finds the string "ro" at position 4.
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
2. The FIND function below finds the string "Excel" at position 11.
3. The FIND function is case-sensitive. The FIND function below returns the #VALUE! error because it cannot find the
string "excel".
The FIND function has a 3rd optional argument. You can use this argument to indicate the position, counting from the left,
at which you want to start searching.
5. The FIND function below starts searching at position 6 and finds the string "o" at position 7.
Search
Use the SEARCH function in Excel to find the position of a substring in a string. The SEARCH function is case-insensitive
and supports wildcards.
1. The SEARCH function below finds the string "ro" at position 4.
2. The SEARCH function is case-insensitive. The SEARCH function below finds the string "excel", "Excel", "EXCEL",
"EXcel", etc.
The SEARCH function supports wildcard characters. A question mark (?) matches exactly one character. An asterisk (*)
matches a series of zero or more characters.
3. The SEARCH function below finds the string "2019", "2018", "2017", etc.
4. The SEARCH function below finds the string "Microsoft Excel 2019", "Microsoft Word 2019", "Microsoft Access
2019", etc.
The SEARCH function has a 3rd optional argument. You can use this argument to indicate the position, counting from the
left, at which you want to start searching.
6. The SEARCH function below starts searching at position 6 and finds the string "o" at position 7.
Change Case
To change the case of text in Excel, use LOWER, UPPER or PROPER. If you're not a formula hero, use Flash Fill
to change case in Excel.
1. Use the LOWER function in Excel to change the case of text to lowercase.
Note: double click the lower right corner of cell B1 to quickly copy this formula to the other cells.
2. Use the UPPER function in Excel to change the case of text to uppercase.
3. Use the PROPER function in Excel to change the first letter of each word to uppercase and all other letters to lowercase.
If you're not a formula hero, use Flash Fill to change the case of text in Excel. In the example below, we are looking for a
mix of proper case and uppercase.
4. First, tell Excel what you want to do by entering the correct city (proper case) and state abbreviation (uppercase) into cell
B1.
5. On the Data tab, in the Data Tools group, click Flash Fill (or press CTRL + E).
Result:
Note: Flash Fill is not perfect and sometimes needs a little help. Visit our page about Flash Fill to learn more about this
great Excel tool.
Remove Spaces
The TRIM function in Excel removes leading spaces, extra spaces and trailing spaces. Use the SUBSTITUTE function
to remove all spaces or non-breaking spaces.
1. The TRIM function below removes 2 leading spaces, 3 extra spaces and 2 trailing spaces.
Note: the TRIM function does not remove single spaces between words.
Explanation: the LEN function counts 2 spaces, 2 characters, 4 spaces, 3 characters and 2 spaces.
Note: the SUBSTITUTE function substitutes spaces (second argument) with empty strings (third argument).
Text imported from other applications may contain ASCII characters. The CLEAN function removes the first 32 non-
printable ASCII characters (codes 0 through 31).
5. Simply combine CLEAN and TRIM to remove non-printable characters and spaces.
6. The CLEAN function removes line breaks. To enter a line break, press ALT + ENTER.
7. You can also use the SUBSTITUTE function to remove a line break, CHAR(10), and replace it with something else. For
example, a comma and a space.
The CLEAN function doesn't remove all ASCII characters. Simply use the SUBSTITUTE function to remove other ASCII
characters.
9. Next, use SUBSTITUTE and CHAR to return the text string without this character.
10. If your text contains non-breaking spaces, CHAR(160), the TRIM function doesn't work.
11. You can use the SUBSTITUTE function to substitute non-breaking spaces, CHAR(160) with normal spaces,
CHAR(32). Don't forget to add a TRIM function to remove the extra spaces.
Compare Text
This example shows two ways to compare text in Excel. One is case-sensitive and one is case-insensitive.
1. Use the EXACT function (case-sensitive).
Substitute vs Replace
This example shows the difference between SUBSTITUTE and REPLACE in Excel.
1a. If you know the text to be replaced, use the SUBSTITUTE function.
1b. The SUBSTITUTE function has a 4th optional argument. You can use this argument to indicate which occurrence you
want to substitute.
2. If you know the position of the text to be replaced, use the REPLACE function.
Text
When joining text and a number, use the TEXT function in Excel to format that number. This page contains many easy to
follow TEXT function examples.
1a. For example, without using the TEXT function this would be the result.
Note: #,## is used to add comma's to large numbers. Always enclose the format code (second argument) in double quotation
marks.
Note: use 0 to display the nearest integer value. Use 0.0 for one decimal place. Use 0.00 for two decimal places, etc.
Note: use less/more m's, d's and y's to change the appearance of the date.
4. For example, use the TEXT function to only display the day of the week. This time we simply use the TEXT function
without adding text.
6. Use the TEXT function to display a fraction and add the TRIM function to remove the leading space.
Simply use the 'Format Cells' dialog box to find the right format code.
7a. For example, enter a time into cell A1 and select cell A1.
7b. Right click, and then click Format Cells (or press CTRL + 1).
7c. Select the Custom category and click a format code. Next, click in the Type box, select the format code and press CTRL
+ c to copy this code.
Note: Excel gives you a life preview of how the time will be formatted (under Sample).
7e. Paste (CTRL + v) the format code into your TEXT function. Don't forget to enclose the format code in double quotation
marks.
Concatenate
Use the CONCATENATE function in Excel to concatenate (join) strings. Instead of using CONCATENATE, simply use
the & operator.
1. The CONCATENATE function below concatenates the string in cell A1 and the string in cell B1.
3. The CONCATENATE function below concatenates the string in cell A1, the string " and " (enclose text in double
quotation marks) and the string in cell B1.
5. The CONCATENATE function below concatenates the string in cell A1, a space and the string in cell B1.
The CONCAT function in Excel 2016 or later produces the exact same result as the CONCATENATE function. Simply
replace CONCATENATE with CONCAT in the formulas shown above.
7. The CONCAT function can also join a range of strings. If you don't need a delimiter (space, comma, dash, etc.) this can
be useful.
The TEXTJOIN function in Excel 2016 or later joins a range of strings using a delimiter (first argument).
8. First, take a look at all the extra spaces in column E below when you drag the CONCATENATE function in cell E2 down
to cell E11.
9. The beauty of the TEXTJOIN function is that it can ignore empty cells (if the second argument is set to TRUE).
10. When using the CONCATENATE function, use the TEXT function to format numbers.
Note: use 0 to display the nearest integer value. Use 0.0 for one decimal place. Use 0.00 for two decimal places, etc. Visit
our page about the TEXT function for many more examples.
11. Use CHAR(10) to insert a line break.
Note: don't forget to enable text wrapping. On the Home tab, in the Alignment group, click Wrap Text.
12. Let's take a look at one more cool example that uses the TEXTJOIN function. First, the IF function below finds all
members of Team 1.
Explanation: the IF function checks each cell in the named range Teams. If equal to the value in cell E3, it returns the name
from the named range Names, else it returns an empty string (two double quotes with nothing in between).
13. The IF function returns an array constant stored in Excel's memory. Select the formula in the formula bar and press F9
to see this array constant.
14. Add the powerful TEXTJOIN function to concatenate these names. Use a comma and space as the delimiter (first
argument) and set the second argument to TRUE to ignore the empty strings. Finish an array formula by pressing CTRL +
SHIFT + ENTER.
Note: Excel adds the curly braces {}. Mia, James and Sophia are in Team 1. Double click the lower right corner of cell F3
to quickly copy this formula to the other cells.
Substring
Mid | Left | Right | Substring between parentheses | Substring containing specific text | Flash Fill
There's no SUBSTRING function in Excel. Use MID, LEFT, RIGHT, FIND, LEN, SUBSTITUTE, REPT, TRIM and MAX
in Excel to extract substrings.
Mid
To extract a substring, starting in the middle of a string, use the MID function in Excel.
Explanation: the MID function starts at position 7 (O) and extracts 6 characters.
Left
To extract the leftmost characters from a string, use the LEFT function in Excel.
To extract a substring (of any length) before the dash, add the FIND function.
Explanation: the FIND function finds the position of the dash. Subtract 1 from this result to extract the correct number of
leftmost characters. The formula shown above reduces to LEFT(A1,4-1).
Right
To extract the rightmost characters from a string, use the RIGHT function in Excel.
To extract a substring (of any length) after the dash, add LEN and FIND.
Explanation: the LEN function returns the length of the string. The FIND function finds the position of the dash. Subtract
these values to extract the correct number of rightmost characters. The formula shown above reduces to RIGHT(A1,6-4).
Explanation: the FIND function finds the position of the opening parenthesis. Add 1 to find the start position of the
substring. The formula shown above reduces to MID(A1,6+1,2). This MID function always extracts 2 characters.
2. Replace the 2 (third argument) with a formula that returns the length of the substring.
Explanation: subtract the position of the opening parenthesis and the value 1 from the position of the closing parenthesis to
find the correct length of the substring.
1. First, use SUBSTITUTE and REPT to substitute a single space with 100 spaces (or any other large number).
2. To MID function below starts 50 (1/2 * large number) positions before the position of the @ symbol and extracts 100
(large number) characters.
3. Use the TRIM function to remove the leading and the trailing spaces.
Note: at step 2, the MID function starts 50 positions before the position of the @ symbol. If the email address is the first
word in the sentence (cell A3), this results in a negative start position. In this case, the MAX function (see formula above)
returns 1.
Flash Fill
If you're not a formula hero, use Flash Fill in Excel to automatically extract substrings.
Note: Excel does not insert formulas, if you change the text strings in column A, Excel will not update the numbers in
Column B.
Explanation: the VLOOKUP function looks for the ID (104) in the leftmost column of the range $E$4:$G$7 and returns the
value in the same row from the third column (third argument is set to 3). The fourth argument is set to FALSE to return an
exact match or a #N/A error if not found.
Note: when we drag the VLOOKUP function down, the absolute reference ($E$4:$G$7) stays the same, while the relative
reference (A2) changes to A3, A4, A5, etc. Visit our page about the VLOOKUP function for much more information and
many examples.
Hlookup
In a similar way, you can use the HLOOKUP (Horizontal lookup) function.
Match
The MATCH function returns the position of a value in a given range.
Explanation: Yellow found at position 3 in the range E4:E7. The third argument is optional. Set this argument to 0 to return
the position of the value that is exactly equal to lookup_value (A2) or a #N/A error if not found. Use INDEX and
MATCH in Excel and impress your boss.
Index
The INDEX function below returns a specific value in a two-dimensional range.
Explanation: 92 found at the intersection of row 3 and column 2 in the range E4:F7.
Explanation: 97 found at position 3 in the range E4:E7. Use INDEX and MATCH in Excel and impress your boss.
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
Choose
The CHOOSE function returns a value from a list of values, based on a position number.
Vlookup
Exact Match | Approximate Match | Vlookup Looks Right | First Match | Vlookup is Case-insensitive | Multiple Criteria |
#N/A error | Multiple Lookup Tables | Index and Match | Xlookup
The VLOOKUP function is one of the most popular functions in Excel. This page contains many easy to follow VLOOKUP
examples.
Exact Match
Most of the time you are looking for an exact match when you use the VLOOKUP function in Excel. Let's take a look at the
arguments of the VLOOKUP function.
1. The VLOOKUP function below looks up the value 53 (first argument) in the leftmost column of the red table (second
argument).
2. The value 4 (third argument) tells the VLOOKUP function to return the value in the same row from the fourth column of
the red table.
Note: the Boolean FALSE (fourth argument) tells the VLOOKUP function to return an exact match. If the VLOOKUP
function cannot find the value 53 in the first column, it will return a #N/A error.
3. Here's another example. Instead of returning the salary, the VLOOKUP function below returns the last name (third
argument is set to 3) of ID 79.
Approximate Match
Let's take a look at an example of the VLOOKUP function in approximate match mode (fourth argument set to TRUE).
1. The VLOOKUP function below looks up the value 85 (first argument) in the leftmost column of the red table (second
argument). There's just one problem. There's no value 85 in the first column.
2. Fortunately, the Boolean TRUE (fourth argument) tells the VLOOKUP function to return an approximate match. If the
VLOOKUP function cannot find the value 85 in the first column, it will return the largest value smaller than 85. In this
example, this will be the value 80.
3. The value 2 (third argument) tells the VLOOKUP function to return the value in the same row from the second column of
the red table.
Note: always sort the leftmost column of the red table in ascending order if you use the VLOOKUP function in approximate
match mode (fourth argument set to TRUE).
2. If you change the column index number (third argument) to 3, the VLOOKUP function looks up the first name and
returns the salary.
Note: in this example, the VLOOKUP function cannot lookup the first name and return the ID. The VLOOKUP function
only looks to the right. No worries, you can use INDEX and MATCH in Excel to perform a left lookup.
First Match
If the leftmost column of the table contains duplicates, the VLOOKUP function matches the first instance. For example,
take a look at the VLOOKUP function below.
Explanation: the VLOOKUP function returns the salary of Mia Clark, not Mia Reed.
Vlookup is Case-insensitive
The VLOOKUP function in Excel performs a case-insensitive lookup. For example, the VLOOKUP function below looks
up MIA (cell G2) in the leftmost column of the table.
Explanation: the VLOOKUP function is case-insensitive so it looks up MIA or Mia or mia or miA, etc. As a result, the
VLOOKUP function returns the salary of Mia Clark (first instance). Use INDEX, MATCH and EXACT in Excel to perform
a case-sensitive lookup.
Multiple Criteria
Do you want to look up a value based on multiple criteria? Use INDEX and MATCH in Excel to perform a two-column
lookup.
Note: the array formula above looks up the salary of James Clark, not James Smith, not James Anderson.
#N/A error
If the VLOOKUP function cannot find a match, it returns a #N/A error.
1. For example, the VLOOKUP function below cannot find the value 28 in the leftmost column.
2. If you like, you can use the IFNA function to replace the #N/A error with a friendly message.
Note: the IFNA function was introduced in Excel 2013. If you're using Excel 2010 or Excel 2007, simply replace IFNA
with IFERROR. Remember, the IFERROR function catches other errors as well. For example, the #NAME? error if you
accidentally misspell the word VLOOKUP.
Explanation: the bonus depends on the market (UK or USA) and the sales amount. The second argument of the VLOOKUP
function does the trick. If UK, the VLOOKUP function uses Table1, if USA, the VLOOKUP function uses Table2. Set the
fourth argument of the VLOOKUP function to TRUE to return an approximate match.
3. Press Enter.
4. Select cell E4, click on the lower right corner of cell E4 and drag it down to cell E10.
Note: for example, Walker receives a bonus of $1,500. Because we're using named ranges, we can easily copy this
VLOOKUP function to the other cells without worrying about cell references.
Xlookup
If you have Excel 365, use XLOOKUP instead of VLOOKUP. The XLOOKUP function is easier to use and has some
additional advantages.
Tax Rates
This example teaches you how to calculate the tax on an income using the VLOOKUP function in Excel. The following tax
rates apply to individuals who are residents of Australia.
0 - $18,200 Nil
$180,001 and over $54,232 plus 45c for each $1 over $180,000
Example: if income is 39000, tax equals 3572 + 0.325 * (39000 - 37000) = 3572 + 650 = $4222
2. When you set the fourth argument of the VLOOKUP function to TRUE, the VLOOKUP function returns an exact match
or if not found, it returns the largest value smaller than lookup_value (A2). That's exactly what we want!
Explanation: Excel cannot find 39000 in the first column of Rates. However, it can find 37000 (the largest value smaller
than 39000). As a result, it returns 3572 (col_index_num, the third argument, is set to 2).
3. Now, what's left is the remainder of the equation, + 0.325 * (39000 - 37000). This is easy. We can return 0.325 by setting
col_index_num to 3 and return 37000 by setting col_index_num to 1. The complete formula below does the trick.
Note: when you set the fourth argument of the VLOOKUP function to TRUE, the first column of the table must be sorted in
ascending order.
Explanation: 53 (first argument) found at position 5 in the range B3:B9 (second argument). In this example, we use the
MATCH function to return an exact match so we set the third argument to 0.
Index
The INDEX function below returns a specific value in a one-dimensional range.
Explanation: the INDEX function returns the 5th value (second argument) in the range E3:E9 (first argument).
Explanation: the MATCH function returns position 5. The INDEX function needs position 5. It's a perfect combination. If
you like, you can also use the VLOOKUP function. It's up to you. However, you'll need INDEX and MATCH to perform
advanced lookups, as we will see next.
Two-way Lookup
The INDEX function can also return a specific value in a two-dimensional range. For example, use INDEX and MATCH in
Excel to perform a two-way-lookup.
Case-sensitive Lookup
By default, the VLOOKUP function performs a case-insensitive lookup. However, you can use INDEX, MATCH and
EXACT in Excel to perform a case-sensitive lookup.
Note: the formula correctly looks up the salary of MIA Reed, not Mia Clark.
Left Lookup
The VLOOKUP function only looks to the right. No worries, you can use INDEX and MATCH in Excel to perform a left
lookup.
Note: when we drag this formula down, the absolute references ($E$4:$E$7 and $G$4:$G$7) stay the same, while the
relative reference (A2) changes to A3, A4, A5, etc.
Two-column Lookup
Do you want to look up a value based on multiple criteria? Use INDEX and MATCH in Excel to perform a two-column
lookup.
Note: the array formula above looks up the salary of James Clark, not James Smith, not James Anderson.
Closest Match
To find the closest match to a target value in a data column, use INDEX, MATCH, ABS and MIN in Excel.
Two-way Lookup
To lookup a value in a two-dimensional range, use INDEX and MATCH in Excel. Below you can find the sales of different
ice cream flavors in each month.
1. To find the position of Feb in the range A2:A13, use the MATCH function. The result is 2.
2. To find the position of Chocolate in the range B1:D1, use the MATCH function. The result is 1.
3. Use these results and the INDEX function to find the sales of Chocolate in February.
Explanation: 217 found at the intersection of row 2 and column 1 in the range B2:D13.
Offset
The OFFSET function in Excel returns a cell or range of cells that is a specified number of rows and columns from a cell or
range of cells.
1. The OFFSET function below returns the cell that is 3 rows below and 2 columns to the right of cell A2. The OFFSET
function returns a cell because the height and width are both set to 1.
Result:
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
2. The OFFSET function below returns the 1 x 2 range that is 8 rows below and 1 column to the right of cell A2. The SUM
function calculates the sum of this range.
Result:
The last 2 arguments of the OFFSET function are optional. When height and width are omitted, the new reference has the
same height and width as the starting reference (first argument). As always, we will use easy examples to make things more
clear.
3. The OFFSET function below returns the cell that is 12 rows below and 0 columns to the right of cell A2.
Result:
4. The OFFSET function below returns the range that is 4 rows below and 0 columns to the right of the range B2:C2. The
SUM function calculates the sum of this range.
Result:
Note: to return a range (without calculating the sum), select a range of the same size before you insert the OFFSET function
and finish by pressing CTRL + SHIFT + ENTER. If you want to return a cell or range of cells that is a specified number of
rows above or columns to the left, enter a negative number.
Case-sensitive Lookup
By default, the VLOOKUP function performs a case-insensitive lookup. However, you can use INDEX, MATCH and
EXACT in Excel to perform a case-sensitive lookup.
1. For example, the simple VLOOKUP function below returns the salary of Mia Clark. However, we want to lookup the
salary of MIA Reed (see cell G2).
2. The EXACT function in Excel returns TRUE if two strings are exactly the same. The EXACT function below returns
FALSE.
Explanation: The range (array constant) created by the EXACT function is stored in Excel's memory, not in a range. The
array constant looks as follows:
{FALSE;FALSE;FALSE;FALSE;FALSE;TRUE;FALSE}
5. All we need is a function that finds the position of TRUE in this array constant. MATCH function to the rescue! Finish
by pressing CTRL + SHIFT + ENTER.
Explanation: TRUE (first argument) found at position 6 in the array constant (second argument). In this example, we use the
MATCH function to return an exact match so we set the third argument to 0. The formula bar indicates that this is an array
formula by enclosing it in curly braces {}. Do not type these yourself.
6. Use the INDEX function (two arguments) to return a specific value in a one-dimensional range. In this example, the
salary at position 6 (second argument) in the range D3:D9 (first argument).
Note: the formula correctly looks up the salary of MIA Reed, not Mia Clark. The formula bar indicates that this is an array
formula by enclosing it in curly braces {}.
Left Lookup
The VLOOKUP function only looks to the right. To look up a value in any column and return the corresponding value to
the left, simply use INDEX and MATCH.
1. The MATCH function returns the position of a value in a given range.
2. Use this result and the INDEX function to return the 4th value in the range $E$4:$E$7.
Note: when we drag this formula down, the absolute references ($E$4:$E$7 and $G$4:$G$7) stay the same, while the
relative reference (A2) changes to A3, A4, A5, etc.
2. Second, we use the MATCH function to find the row number of the maximum value.
Explanation: the MATCH function reduces to =MATCH(12,A:A,0), 7. The MATCH function returns the position of the
maximum value in column A. Set the third argument to 0 to return an exact match.
Explanation: the ADDRESS function reduces to =ADDRESS(7,1), $A$7. The first argument specifies the row number. The
second argument specifies the column number.
Indirect
Cell Reference | Range Reference | Named Range | Worksheet Reference
Use the INDIRECT function in Excel to convert a text string into a valid reference. You can use the & operator to create
text strings.
Cell Reference
Use the INDIRECT function in Excel to convert a text string into a valid cell reference.
Explanation: =INDIRECT(A1) reduces to =INDIRECT("D1"). The INDIRECT function converts the text string "D1" into a
valid cell reference. In other words, =INDIRECT("D1") reduces to =D1.
2. The simple INDIRECT function below produces the exact same result.
3. Do we really need the INDIRECT function? Yes. Without using the INDIRECT function, this would be the result.
4. Use the & operator to join the string "D" with the value in cell A1.
Explanation: the formula above reduces to =INDIRECT("D1"). Again, =INDIRECT("D1") reduces to =D1.
Range Reference
Use the INDIRECT function in Excel to convert a text string into a valid range reference. For example, use SUM and
INDIRECT.
Explanation: the formula above reduces to =SUM(INDIRECT("D3:D6")). The INDIRECT function converts the text string
"D3:D6" into a valid range reference. In other words, =SUM(INDIRECT("D3:D6")) reduces to =SUM(D3:D6).
Named Range
Use the INDIRECT function in Excel to convert a text string into a valid named range.
1. For example, the AVERAGE function below uses the named range Scores.
Explanation: =AVERAGE("Scores") returns an error because Excel cannot calculate the average of a text string!
Worksheet Reference
Use the INDIRECT function in Excel to create a dynamic worksheet reference.
Note: cell A1 on Sheet1 contains the value 10. Cell A1 on Sheet2 contains the value 20. Cell A1 on Sheet3 contains the
value 30.
2. On the Summary sheet, enter the INDIRECT function shown below. Use the & operator to join the sheet name in cell A1
with "!A1".
Explanation: the formula above reduces to =INDIRECT("Sheet1!A1"). The INDIRECT function converts the text string
"Sheet1!A1" into a valid worksheet reference. In other words, =INDIRECT("Sheet1!A1") reduces to =Sheet1!A1.
3. If your sheet names contain spaces or other special characters, enclose the sheet name in single quotation marks. Modify
the INDIRECT function as shown below.
Two-column Lookup
This example teaches you how to perform a two-column lookup in Excel. See the example below. We want to look up the
salary of James Clark, not James Smith, not James Anderson.
1. To join strings, use the & operator.
2. The MATCH function returns the position of a value in a given range. Insert the MATCH function shown below.
Note: The formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
They will disappear when you edit the formula.
Explanation: The range (array constant) A2:A8&B2:B8 is stored in Excel's memory, not in a range. The array constant
looks as follows:
{"JamesSmith";"JamesAnderson";"JamesClark";"JohnLewis";"JohnWalker";"MarkReed";"RichardLopez"}
This array constant is used as an argument for the MATCH function, giving a result of 3 (JamesClark found at position 3).
4. Use this result and the INDEX function to return the 3rd value in the range C2:C8.
Closest Match
To find the closest match to a target value in a data column, use INDEX, MATCH, ABS and MIN in Excel. Use
the VLOOKUP function in Excel to find an approximate match.
1. The ABS function in Excel returns the absolute value of a number.
Explanation: C3-F2 equals -39. The ABS function removes the minus sign (-) from a negative number, making it positive.
The ABS function has no effect on 0 (zero) or positive numbers.
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
2. To calculate the differences between the target value and the values in the data column, replace C3 with C3:C9.
Explanation: the range (array constant) created by the ABS function is stored in Excel's memory, not in a range. The array
constant looks as follows:
{39;14;37;16;22;16;17}
3. To find the closest match, add the MIN function and finish by pressing CTRL + SHIFT + ENTER.
Note: the formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
The array constant is used as an argument for the MIN function, giving a result of 14.
4. All we need is a function that finds the position of the value 14 in the array constant. MATCH function to the rescue!
Finish by pressing CTRL + SHIFT + ENTER.
Explanation: 14 (first argument) found at position 2 in the array constant (second argument). In this example, we use the
MATCH function to return an exact match so we set the third argument to 0.
5. Use the INDEX function (two arguments) to return a specific value in a one-dimensional range. In this example, the
name at position 2 (second argument) in the range B3:B9 (first argument).
Before we start: do you want to compare two columns by highlighting the unique values in each column? Visit our page
about comparing two lists.
Display Duplicates
Let's start by comparing two columns and displaying the duplicates.
1. Display the duplicates in the first column (these values also occur in the second column).
Explanation: the MATCH function in cell C1 returns the number 5 (letter A found at position 5 in the range B1:B7). As a
result, the ISERROR function returns FALSE and the IF function returns the value in cell A1. The MATCH function in cell
C4 returns a #N/A error (no letter D in the range B1:B7). As a result, the ISERROR function returns TRUE and the IF
function returns an empty string.
Note: at step 1, we matched each value in the first column with the range in the second column. At step 2, we match each
value in the second column with the range in the first column.
1. Display the unique values in the first column (these values do not occur in the second column).
Note: take a look at the second picture on this page to see that we swapped the last 2 arguments of the IF function.
2. You can also display the unique values in the second column.
Note: take a look at the third picture on this page to see that we swapped the last 2 arguments of the IF function.
1. The IF function in cell C1 below returns Match because the value in cell A1 is equal to the value in cell B1.
3. Do you want to compare two columns by highlighting the differences in each row? Visit our page about Row
Differences.
Xlookup
Exact Match | Not Found | Approximate Match | Left Lookup | Multiple Values
If you have Excel 365, use XLOOKUP instead of VLOOKUP. The XLOOKUP function is easier to use and has some
additional advantages.
Exact Match
By default, the XLOOKUP function in Excel 365 performs an exact match.
1. The XLOOKUP function below looks up the value 53 (first argument) in the range B3:B9 (second argument).
2. Next, it simply returns the value in the same row from the range E3:E9 (third argument).
3. Here's another example. Instead of returning the salary, the XLOOKUP function below returns the last name (replace
E3:E9 with D3:D9) of ID 79.
Not Found
If the XLOOKUP function cannot find a match, it returns a #N/A error.
1. For example, the XLOOKUP function below cannot find the value 28 in the range B3:B9.
2. Use the fourth argument of the XLOOKUP function to replace the #N/A error with a friendly message.
Approximate Match
Let's take a look at an example of the XLOOKUP function in approximate match mode.
1. The XLOOKUP function below looks up the value 85 (first argument) in the range B3:B7 (second argument). There's
just one problem. There's no value 85 in this range.
2. Fortunately, the value -1 (fifth argument) tells the XLOOKUP function to find the next smaller value. In this example, the
value 80.
3. Next, it simply returns the value in the same row from the range C3:C7 (third argument).
Note: use 1 instead of -1 for the fifth argument to find the next larger value. In this example, the value 90. The XLOOKUP
function also works with unsorted data. In this example, there's no need to sort the scores in ascending order.
Left Lookup
Instead of using INDEX and MATCH in Excel to perform a left lookup, simply use the XLOOKUP function. For example,
take a look at the XLOOKUP function below.
Explanation: the XLOOKUP function looks up the last name and returns the ID.
Multiple Values
The XLOOKUP function in Excel 365 can return multiple values.
1. First, the XLOOKUP function below looks up the ID and returns the first name (nothing new).
2. Replace C6:C12 with C6:E12 to return the first name, last name and salary.
Note: the XLOOKUP function, entered into cell C3, fills multiple cells. Wow! This behavior in Excel 365 is called spilling.
Financial Functions
PMT | RATE | NPER | PV | FV
To illustrate Excel's most popular financial functions, we consider a loan with monthly payments, an annual interest rate of
6%, a 20-year duration, a present value of $150,000 (amount borrowed) and a future value of 0 (that's what you hope to
achieve when you pay off a loan).
We make monthly payments, so we use 6%/12 = 0.5% for Rate and 20*12 = 240 for Nper (total number of periods). If we
make annual payments on the same loan, we use 6% for Rate and 20 for Nper.
PMT
Select cell A2 and insert the PMT function.
Note: the last two arguments are optional. For loans, Fv can be omitted (the future value of a loan equals 0, however, it's
included here for clarification). If Type is omitted, it is assumed that payments are due at the end of the period.
Tip: when working with financial functions in Excel, always ask yourself the question, am I making a payment (negative) or
am I receiving money (positive)? We pay off a loan of $150,000 (positive, we received that amount) and we make monthly
payments of $1,074.65 (negative, we pay). Visit our page about the PMT function for many more examples.
RATE
If Rate is the only unknown variable, we can use the RATE function to calculate the interest rate.
NPER
Or the NPER function. If we make monthly payments of $1,074.65 on a 20-year loan, with an annual interest rate of 6%, it
takes 240 months to pay off this loan.
We already knew this, but we can change the monthly payment now to see how this affects the total number of periods.
Conclusion: if we make monthly payments of $2,074.65, it takes less than 90 months to pay off this loan.
PV
Or the PV (Present Value) function. If we make monthly payments of $1,074.65 on a 20-year loan, with an annual interest
rate of 6%, how much can we borrow? You already know the answer.
FV
And we finish this chapter with the FV (Future Value) function. If we make monthly payments of $1,074.65 on a 20-year
loan, with an annual interest rate of 6%, do we pay off this loan? Yes.
But, if we make monthly payments of only $1,000.00, we still have debt after 20 years.
PMT
PMT examples | PPMT and IPMT
The PMT function in Excel calculates the payment for a loan based on constant payments and a constant interest rate. This
page contains many easy to follow PMT examples.
PMT examples
Consider a loan with an annual interest rate of 6%, a 20-year duration, a present value of $150,000 (amount borrowed) and a
future value of 0 (that's what you hope to achieve when you pay off a loan).
Note: if the fifth argument is omitted, it is assumed that payments are due at the end of the period. We pay off a loan of
$150,000 (positive, we received that amount) and we make annual payments of $13,077.68 (negative, we pay).
Note: we make quarterly payments, so we use 6%/4 = 1.5% for Rate and 20*4 = 80 for Nper (total number of periods).
Note: we make monthly payments, so we use 6%/12 = 0.5% for Rate and 20*12 = 240 for Nper (total number of periods).
Consider an investment with an annual interest rate of 8% and a present value of 0. How much money should you deposit at
the end of each year to have $1,448.66 in the account in 10 years?
4. The PMT function below calculates the annual deposit.
Explanation: in 10 years time, you pay 10 * $100 (negative) = $1000, and you'll receive $1,448.66 (positive) after 10 years.
The higher the interest, the faster your money grows.
Consider an annuity with an annual interest rate of 6% and a present value of $83,748.46 (purchase value). How much
money can you withdraw at the end of each month for the next 20 years?
5. The PMT function below calculates the monthly withdrawal.
Explanation: you need a one-time payment of $83,748.46 (negative) to pay this annuity. You'll receive 240 * $600
(positive) = $144,000 in the future. This is another example that money grows over time.
Note: we make monthly payments, so we use 5%/12 for Rate and 2*12 for Nper (total number of periods).
2. The PPMT function in Excel calculates the principal part of the payment. The second argument specifies the payment
number.
Explanation: the PPMT function above calculates the principal part of the 5th payment.
3. The IPMT function in Excel calculates the interest part of the payment. The second argument specifies the payment
number.
Explanation: the IPMT function above calculates the interest part of the 5th payment.
4. It takes 24 months to pay off this loan. Create a loan amortization schedule (see picture below) to clearly see how the
principal part increases and the interest part decreases with each payment.
Note: the principal part and the interest part always add up to the payment amount.
Note: we make monthly payments, so we use 6%/12 = 0.5% for Rate and 20*12 = 240 for Nper (total number of periods).
2. Next, select the range A2:D2 and drag it down two rows.
Result:
The monthly payment over 30 years ($899,33) looks good in contrast to the $966,45 and $1,074.65. Right?
The monthly payment over 30 years ($899,33) suddenly does not look so attractive anymore. Conclusion: the longer the
duration of the loan, the more interest you pay.
Investment or Annuity
Investment | Annuity
This example teaches you how to calculate the future value of an investment or the present value of an annuity.
Tip: when working with financial functions in Excel, always ask yourself the question, am I making a payment (negative) or
am I receiving money (positive)?
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
Investment
Assume that at the end of every year, you deposit $100 into a savings account. At an annual interest rate of 8%, how much
will your investment be worth after 10 years?
In 10 years time, you pay 10 * $100 (negative) = $1000, and you'll receive $1,448.66 (positive) after 10 years. The higher
the interest, the faster your money grows.
Note: the last two arguments are optional. If omitted, Pv = 0 (no present value). If Type is omitted, it is assumed that
payments are due at the end of the period.
Annuity
Assume you want to purchase an annuity that will pay $600 a month, for the next 20 years. At an annual interest rate of 6%,
how much does the annuity cost?
You need a one-time payment of $83,748.46 (negative) to pay this annuity. You'll receive 240 * $600 (positive) = $144,000
in the future. This is another example that money grows over time.
Note: we receive monthly payments, so we use 6%/12 = 0.5% for Rate and 20*12 = 240 for Nper. The last two arguments
are optional. If omitted, Fv = 0 (no future value). If Type is omitted, it is assumed that payments are due at the end of the
period. This annuity does not take into account life expectancy, inflation etc.
Compound Interest
What's compound interest and what's the formula for compound interest in Excel? This example gives you the answers to
these questions.
1. Assume you put $100 into a bank. How much will your investment be worth after 1 year at an annual interest rate of 8%?
The answer is $108.
2. Now this interest ($8) will also earn interest (compound interest) next year. How much will your investment be worth
after 2 years at an annual interest rate of 8%? The answer is $116.64.
3. How much will your investment be worth after 5 years? Simply drag the formula down to cell A6.
4. All we did was multiplying 100 by 1.08, 5 times. So we can also directly calculate the value of the investment after 5
years.
Note: there is no special function for compound interest in Excel. However, you can easily create a compound interest
calculator to compare different rates and different durations.
5. Assume you put $100 into a bank. How much will your investment be worth after 5 years at an annual interest rate of
8%? You already know the answer.
7. Assume you put $10,000 into a bank. How much will your investment be worth after 10 years at an annual interest rate of
5% compounded monthly? The answer is $16,470.
Note: the compound interest formula always works. If you're interested, download the Excel file and try it yourself!
CAGR
There's no CAGR function in Excel. However, simply use the RRI function in Excel to calculate the compound annual
growth rate (CAGR) of an investment over a period of years.
1. The RRI function below calculates the CAGR of an investment. The answer is 8%.
Note: the RRI function has three arguments (number of years = 5, start = 100, end = 147).
2. The CAGR measures the growth of an investment as if it had grown at a steady rate on an annually compounded basis.
We can check this.
Note: again, number of years or n = 5, start = 100, end = 147, CAGR = 8%.
3. Knowing this, we can easily create a CAGR formula that calculates the compound annual growth rate of an investment in
Excel.
A2 = A1 * (1 + CAGR)n
end = start * (1 + CAGR)n
end/start = (1 + CAGR)n
(end/start)1/n = (1 + CAGR)
CAGR = (end/start)1/n - 1
4. The CAGR formula below does the trick.
Note: in other words, to calculate the CAGR of an investment in Excel, divide the value of the investment at the end by the
value of the investment at the start. Next, raise this result to the power of 1 divided by the number of years. Finally, subtract
1 from this result.
2. Use the PPMT function to calculate the principal part of the payment. The second argument specifies the payment
number.
3. Use the IPMT function to calculate the interest part of the payment. The second argument specifies the payment number.
5. Select the range A7:E7 (first payment) and drag it down one row. Change the balance formula.
6. Select the range A8:E8 (second payment) and drag it down to row 30.
It takes 24 months to pay off this loan. See how the principal part increases and the interest part decreases with each
payment.
NPV
Net Present Value | Understanding the NPV function
The correct NPV formula in Excel uses the NPV function to calculate the present value of a series of future cash flows and
subtracts the initial investment.
1. We expect a profit of $0 at the end of the first period, a profit of $50 at the end of the second period and a profit of $150
at the end of the third period.
Explanation: this is the rate of return of the best alternative investment. For example, you could also put your money in a
high-yield savings account at an interest rate of 15%.
3. The NPV formula below calculates the net present value of project X.
Explanation: a positive net present value indicates that the project’s rate of return exceeds the discount rate. In other words,
it's better to invest your money in project X than to put your money in a high-yield savings account at an interest rate of
15%.
4. The NPV formula below calculates the net present value of project Y.
Explanation: the net present value of project Y is higher than the net present value of project X. Therefore, project Y is a
better investment.
1. For example, project A requires an initial investment of $100 (cell B5). We expect a profit of $0 at the end of the first
period, a profit of $0 at the end of the second period and a profit of $152.09 at the end of the third period.
Explanation: a net present value of 0 indicates that the project generates a rate of return equal to the discount rate. In other
words, both options, investing your money in project A or putting your money in a high-yield savings account at an interest
rate of 15%, yield an equal return.
2. We can check this. Assume you put $100 into a bank. How much will your investment be worth after 3 years at an annual
interest rate of 15%? The answer is $152.09.
Note: the internal rate of return of project A equals 15%. The internal rate of return is the discount rate that makes the net
present value equal to zero. Visit our page about the IRR function to learn more about this topic.
3. The NPV function simply calculates the present value of a series of future cash flows.
4. We can check this. First, we calculate the present value (pv) of each cash flow. Next, we sum these values.
Explanation: $152.09 in 3 years is worth $100 right now. $50 in 2 years is worth 37.81 right now. $25 in 1 year is worth
$21.74 right now. Would you trade $159.55 for $100 right now? Of course, so project B is a good investment.
5. The NPV formula below calculates the net present value of project B.
Explanation: project B is a good investment because the net present value ($159.55 - $100) is greater than 0.
IRR
Simple IRR example | Present Values | IRR rule
Use the IRR function in Excel to calculate a project's internal rate of return. The internal rate of return is the discount rate
that makes the net present value equal to zero.
Simple IRR example
For example, project A requires an initial investment of $100 (cell B5).
1. We expect a profit of $0 at the end of the first period, a profit of $0 at the end of the second period and a profit of $152.09
at the end of the third period.
Note: the discount rate equals 10%. This is the rate of return of the best alternative investment. For example, you could also
put your money in a savings account at an interest rate of 10%.
2. The correct NPV formula in Excel uses the NPV function to calculate the present value of a series of future cash flows
and subtracts the initial investment.
Explanation: a positive net present value indicates that the project’s rate of return exceeds the discount rate. In other words,
it's better to invest your money in project A than to put your money in a savings account at an interest rate of 10%.
3. The IRR function below calculates the internal rate of return of project A.
4. The internal rate of return is the discount rate that makes the net present value equal to zero. To clearly see this, replace
the discount rate of 10% in cell B2 with 15%.
Explanation: a net present value of 0 indicates that the project generates a rate of return equal to the discount rate. In other
words, both options, investing your money in project A or putting your money in a high-yield savings account at an interest
rate of 15%, yield an equal return.
5. We can check this. Assume you put $100 into a bank. How much will your investment be worth after 3 years at an annual
interest rate of 15%? The answer is $152.09.
Conclusion: you can compare the performance of a project to a savings account with an interest rate equal to the IRR.
Present Values
For example, project B requires an initial investment of $100 (cell B5). We expect a profit of $25 at the end of the first
period, a profit of $50 at the end of the second period and a profit of $152.09 at the end of the third period.
1. The IRR function below calculates the internal rate of return of project B.
2. Again, the internal rate of return is the discount rate that makes the net present value equal to zero. To clearly see this,
replace the discount rate of 15% in cell B2 with 39%.
Explanation: a net present value of 0 indicates that the project generates a rate of return equal to the discount rate. In other
words, both options, investing your money in project B or putting your money in a high-yield savings account at an interest
rate of 39%, yield an equal return.
3. We can check this. First, we calculate the present value (pv) of each cash flow. Next, we sum these values.
Explanation: instead of investing $100 in project B, you could also put $17.95 in a savings account for 1 year, $25.77 in a
savings account for 2 years and $56.28 in a savings account for three years, at an annual interest rate equal to the IRR
(39%).
IRR rule
The IRR rule states that if the IRR is greater than the required rate of return, you should accept the project. IRR values are
frequently used to compare investments.
1. The IRR function below calculates the internal rate of return of project X.
Conclusion: if the required rate of return equals 15%, you should accept this project because the IRR of this project equals
29%.
2. The IRR function below calculates the internal rate of return of project Y.
Conclusion: in general, a higher IRR indicates a better investment. Therefore, project Y is a better investment than project
X.
3. The IRR function below calculates the internal rate of return of project Z.
Conclusion: a higher IRR isn't always better. Project Z has a higher IRR than project Y but the cash flows are much lower.
Depreciation
SLN | SYD | DB | DDB | VDB
Excel offers five different depreciation functions. We consider an asset with an initial cost of $10,000, a salvage value
(residual value) of $1000 and a useful life of 10 periods (years). Below you can find the results of all five functions. Each
function will be explained separately in the next 5 paragraphs.
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
Most assets lose more value in the beginning of their useful life. The SYD, DB, DDB and VDB functions have this
property.
SLN
The SLN (Straight Line) function is easy. Each year the depreciation value is the same.
The SLN function performs the following calculation. Deprecation Value = (10,000 - 1,000) / 10 = 900.00. If we subtract
this value 10 times, the asset depreciates from 10,000 to 1000 in 10 years (see first picture, bottom half).
SYD
The SYD (Sum of Years' Digits) function is also easy. As you can see below, this function also requires the period number.
The SYD function performs the following calculations. A useful life of 10 years results in a sum of years of 10 + 9 + 8 + 7
+ 6 + 5 + 4 + 3 + 2 + 1 = 55. The asset loses 9000 in value. Depreciation value period 1 = 10/55 * 9000 = 1,636.36.
Deprecation value period 2 = 9/55 * 9000 = 1,472,73, etc. If we subtract these values, the asset depreciates from 10,000 to
1000 in 10 years (see first picture, bottom half).
DB
The DB (Declining Balance) function is a bit more complicated. It uses a fixed rate to calculate the depreciation values.
The DB function performs the following calculations. Fixed rate = 1 - ((salvage / cost) ^ (1 / life)) = 1 -
(1000/10,000)^(1/10) = 1 - 0.7943282347 = 0.206 (rounded to 3 decimal places). Depreciation value period 1 = 10,000 *
0.206 = 2,060.00. Deprecation value period 2 = (10,000 - 2,060.00) * 0.206 = 1635.64, etc. If we subtract these values, the
asset depreciates from 10,000 to 995.88 in 10 years (see first picture, bottom half).
Note: the DB function has a fifth optional argument. You can use this argument to indicate the number of months to go in
the first year (If omitted, it is assumed to be 12). For example, set this argument to 9 if you purchase your asset at the
beginning of the second quarter in year 1 (9 months to go in the first year). Excel uses a slightly different formula to
calculate the deprecation value for the first and last period (the last period represents an 11th year with only 3 months).
DDB
The DDB (Double Declining Balance) function is easy again. However, sometimes you don't reach the salvage value when
you use this function.
The DDB function performs the following calculations. A useful life of 10 years results in a rate of 1/10 = 0.1. Because this
function is called Double Declining Balance we double this rate (factor = 2). Depreciation value period 1 = 10,000 * 0.2 =
2,000.00. Deprecation value period 2 = (10,000 - 2,000.00) * 0.2 = 1600.00, etc. As said earlier, sometimes you don't reach
the salvage value when you use this function. In this example, if we subtract the depreciation values, the asset depreciates
from 10,000 to 1073.74 in 10 years (see first picture, bottom half). However, read on to fix this.
Note: the DDB function has a fifth optional argument. You can use this argument to use a different factor.
VDB
The VDB (Variable Declining Balance) function uses the DDB (Double Declining Balance) method by default. The 4th
argument indicates the starting period, the 5th argument indicates the ending period.
The VDB function performs the same calculations as the DDB function. However, it switches to Straight Line calculation
(yellow values) to make sure you reach the salvage value (see first picture, bottom half). It only switches to Straight Line
calculation when Depreciation Value, Straight Line is higher than Depreciation Value, DDB. In period 8, Depreciation
Value, DDB = 419.43. We still have 2097.15 - 1000 (see first picture, bottom half) to depreciate. If we use the Straight Line
method this results in 3 remaining depreciation values of 1097.15 / 3 = 365.72. Depreciation Value, Straight Line is not
higher so we do not switch. In period 9, Depreciation Value, DDB = 335.54. We still have 1677.72 - 1000 (see first picture,
bottom half) to depreciate. If we use Straight line method this results in 2 remaining depreciation values of 677.72 / 2 =
338.86. Depreciation Value, Straight Line is higher so we switch to Straight Line calculation.
Note: the VDB function is much more versatile than the DDB function. It can calculate the depreciation value of multiple
periods. In this example, =VDB(Cost,Salvage,Life,0,3) reduces to 2000 + 1600 + 1280 = 4880. It contains a 6th and 7th
optional argument. You can use the 6th argument to use a different factor. If you set the 7th argument to TRUE it does not
switch to Straight Line calculation (the same as DDB).
Statistical Functions
Average | Averageif | Median | Mode | Standard Deviation | Min | Max | Large | Small
This chapter gives an overview of some very useful statistical functions in Excel.
Average
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
Note: visit our page about the AVERAGE function for many more examples.
Averageif
To average cells based on one criteria, use the AVERAGEIF function. For example, to calculate the average excluding
zeros.
Note: visit our page about the AVERAGEIF function for many more examples.
Median
To find the median (or middle number), use the MEDIAN function.
Check:
Mode
To find the most frequently occurring number, use the MODE function.
Standard Deviation
To calculate the standard deviation, use the STEDV function.
Note: standard deviation is a number that tells you how far numbers are from their mean. Learn more about this topic on our
page about standard deviation.
Min
To find the minimum value, use the MIN function.
Max
To find the maximum value, use the MAX function.
Large
To find the third largest number, use the following LARGE function.
Check:
Small
To find the second smallest number, use the following SMALL function.
Check:
Tip: Excel can generate most of these results with the click of a button. Our Descriptive Statistics example shows you how.
Average
Average | AverageA | Average Top 3 | AverageIf | Weighted Average | Moving Average
The AVERAGE function in Excel calculates the average (arithmetic mean) of a group of numbers. The AVERAGE
function ignores logical values, empty cells and cells that contain text.
Average
Instead of using the AVERAGE function, use SUM and COUNT.
1. For example, the AVERAGE function below calculates the average of the numbers in cells A1 through A3.
3. The following AVERAGE function calculates the average of the numbers in cells A1 through A3 and the number 8.
4. The AVERAGE function ignores logical values (TRUE or FALSE), empty cells and cells that contain text.
AverageA
The AVERAGEA function also returns the average (arithmetic mean) of a group of numbers. However, the logical value
FALSE and cells that contain text evaluate to 0 and the logical value TRUE evaluates to 1. The AVERAGEA function also
ignores empty cells.
2. You can use the normal AVERAGE function to check this result.
Average Top 3
Use AVERAGE and LARGE in Excel to calculate the average of the top 3 numbers in a data set.
1. First, the AVERAGE function below calculates the average of the numbers in cells A1 through A6.
2. For example, to find the third largest number, use the following LARGE function.
Explanation: the LARGE function returns the array constant {20,15,10}. This array constant is used as an argument for the
AVERAGE function, giving a result of 15.
AverageIf
To calculate the average of cells that meet one criteria, use the AVERAGEIF function in Excel.
Weighted Average
To calculate a weighted average in Excel, use SUMPRODUCT and SUM.
Moving Average
Use the Analysis Toolpak to calculate the moving average of a time series in Excel.
Note: a moving average is used to smooth out irregularities (peaks and valleys) to easily recognize trends.
3. Click the lower right corner of cell C1 and drag the formula down.
Result:
4. To change the negative numbers to zero but leave the positive numbers unchanged, instead of =A1-B1, use
=MAX(0,A1-B1) and drag the function down.
Result:
Explanation: the MAX function returns the maximum of two values. If the result of the formula is negative, the
function returns 0.
Random Numbers
Rand | RandBetween | RandArray
Excel has two very useful functions when it comes to generating random numbers. RAND and RANDBETWEEN.
Rand
The RAND function generates a random decimal number between 0 and 1.
2. Type RAND() and press Enter. The RAND function takes no arguments.
3. To generate a list of random numbers, select cell A1, click on the lower right corner of cell A1 and drag it down.
Note that cell A1 has changed. That is because random numbers change every time a cell on the sheet is calculated.
4. If you don't want this, simply copy the random numbers and paste them as values.
5. Select cell C1 and look at the formula bar. This cell holds a value now and not the RAND function.
RandBetween
The RANDBETWEEN function generates a random whole number between two boundaries.
3. If you want to generate random decimal numbers between 50 and 75, modify the RAND function as follows:
RandArray
If you have Excel 365, you can use the magic RANDARRAY function.
1. By default, the RANDARRAY function generates random decimal numbers between 0 and 1. The array below consists
of 5 rows and 2 columns.
Note: this dynamic array function, entered into cell A1, fills multiple cells. Wow! This behavior in Excel 365 is called
spilling.
2. The RANDARRAY function below generates an array of integers, 10 rows by 1 column, between 20 and 80.
Note: the Boolean TRUE (fifth argument) tells the RANDARRAY function to return an array of integers. Use FALSE to
return an array of decimal numbers between 20 and 80.
Rank
The RANK function in Excel returns the rank of a number in a list of numbers. Use RANK.AVG to return the average rank
if more than one number has the same rank.
1. If the third argument is omitted (or 0), Excel ranks the largest number first, second largest number second, etc.
Note: when we drag the RANK function down, the absolute reference ($A$1:$A$9) stays the same, while the relative
reference (A1) changes to A2, A3, A4, etc.
2. If the third argument is 1, Excel ranks the smallest number first, second smallest number second, etc.
3. The RANK.AVG function in Excel returns the average rank if more than one number has the same rank.
Note: The second argument of the PERCENTILE function must be a decimal number between 0 and 1. Excel uses a slightly
different algorithm to calculate percentiles and quartiles than you find in most statistics books. If you're interested,
download the Excel file.
2. Use the PERCENTILE function shown below to calculate the 90th percentile. Excel returns the value 61.7. This means
that 90% (18 out of 20) of the scores are lower or equal to 61.7
3. Use the QUARTILE function shown below to calculate the 1st quartile. Excel returns the value 11.25. This means that
25% (5 out of 20) of the scores are lower or equal to 11.25
Note: The second argument of the QUARTILE function must be a number between 0 and 4. PERCENTILE(A1:A20,0.25)
gives the exact same result. It's up to you which function you would like to use for quartiles. Below you can find an
overview.
This example teaches you how to create a box and whisker plot in Excel. A box and whisker plot shows the minimum value,
first quartile, median, third quartile and maximum value of a data set.
Simple Box and Whisker Plot
1. For example, select the range A1:A7.
Note: you don't have to sort the data points from smallest to largest, but it will help you understand the box and whisker
plot.
2. On the Insert tab, in the Charts group, click the Statistic Chart symbol.
Result:
Explanation: the middle line of the box represents the median or middle number (8). The x in the box represents the mean
(also 8 in this example). The median divides the data set into a bottom half {2, 4, 5} and a top half {10, 12, 15}. The bottom
line of the box represents the median of the bottom half or 1st quartile (4). The top line of the box represents the median of
the top half or 3rd quartile (12). The whiskers (vertical lines) extend from the ends of the box to the minimum value (2) and
maximum value (15).
Outliers
1. For example, select the range A1:A11.
Note: the median or middle number (8) divides the data set into two halves: {1, 2, 2, 4, 5} and {10, 12, 15, 18, 35}. The 1st
quartile (Q1) is the median of the first half. Q1 = 2. The 3rd quartile (Q3) is the median of the second half. Q3 = 15.
2. On the Insert tab, in the Charts group, click the Statistic Chart symbol.
Result:
Explanation: the interquartile range (IQR) is defined as the distance between the 1st quartile and the 3rd quartile. In this
example, IQR = Q3 - Q1 = 15 - 2 = 13. A data point is considered an outlier if it exceeds a distance of 1.5 times the IQR
below the 1st quartile (Q1 - 1.5 * IQR = 2 - 1.5 * 13 = -17.5) or 1.5 times the IQR above the 3rd quartile (Q3 + 1.5 * IQR =
15 + 1.5 * 13 = 34.5). Therefore, in this example, 35 is considered an outlier. As a result, the top whisker extends to the
largest value (18) within this range.
4. Change the last data point to 34.
Result:
Explanation: all data points are between -17.5 and 34.5. As a result, the whiskers extend to the minimum value (2) and
maximum value (34).
2. On the Insert tab, in the Charts group, click the Statistic Chart symbol.
Result:
Explanation: Excel uses the QUARTILE.EXC function to calculate the 1st quartile (Q1), 2nd quartile (Q2 or median) and 3rd
quartile (Q3). This function interpolates between two values to calculate a quartile. In this example, n = 8 (number of data
points).
4. Q1 = 1/4*(n+1)th value = 1/4*(8+1)th value = 2 1/4th value = 4 + 1/4 * (5-4) = 4 1/4. You can verify this number by
using the QUARTILE.EXC function or looking at the box and whisker plot.
5. Q2 = 1/2*(n+1)th value = 1/2*(8+1)th value = 4 1/2th value = 8 + 1/2 * (10-8) = 9. This makes sense, the median is the
average of the middle two numbers.
6. Q3 = 3/4*(n+1)th value = 3/4*(8+1)th value = 6 3/4th value = 12 + 3/4 * (15-12) = 14 1/4. Again, you can verify this
number by using the QUARTILE.EXC function or looking at the box and whisker plot.
AverageIf
The AVERAGEIF function in Excel calculates the average of cells that meet one criteria. AVERAGEIFS calculates the
average of cells that meet multiple criteria.
1. For example, the AVERAGEIF function below (two arguments) calculates the average of all values in the range A1:A7
that are greater than 0.
2. The AVERAGEIF function below (three arguments, last argument is the range to average) calculates the average of all
values in the range B1:B7 if the corresponding cells in the range A1:A7 contain exactly Apple.
3. The AVERAGEIF function below calculates the average of all values in the range B1:B7 if the corresponding cells in the
range A1:A7 do not contain exactly Banana.
4. The AVERAGEIF function below calculates the average of all values in the range B1:B7 if the corresponding cells in the
range A1:A7 contain a series of zero or more characters + berry. An asterisk (*) matches a series of zero or more characters.
5. The AVERAGEIF function below calculates the average of all values in the range B1:B7 if the corresponding cells in the
range A1:A7 contain exactly 4 characters. A question mark (?) matches exactly one character.
The AVERAGEIFS function (with the letter S at the end) in Excel calculates the average of cells that meet multiple criteria.
6. The AVERAGEIFS function below calculates the average of all values in the range A1:A7 that are greater than or equal
to 500 and less than or equal to 1000.
Note: first argument is the range to average, followed by two or more range/criteria pairs.
7. The AVERAGEIFS function below calculates the average of all values in the range C1:C7 if the corresponding cells in
the range A1:A7 contain exactly Apple and the corresponding cells in the range B1:B7 contain exactly Red.
Note: again, the first argument is the range to average, followed by two or more range/criteria pairs.
Forecast
FORECAST.LINEAR | FORECAST.ETS | Forecast Sheet
The FORECAST (or FORECAST.LINEAR) function in Excel predicts a future value along a linear trend.
The FORECAST.ETS function in Excel predicts a future value using Exponential Triple Smoothing, which
takes into account seasonality.
Note: the FORECAST function is an old function. Microsoft Excel recommends using the new
FORECAST.LINEAR function which produces the exact same result.
FORECAST.LINEAR
1. The FORECAST.LINEAR function below predicts a future value along a linear trend.
Explanation: when we drag the FORECAST.LINEAR function down, the absolute references ($B$2:$B$11
and $A$2:$A$11) stay the same, while the relative reference (A12) changes to A13 and A14.
2. Enter the value 89 into cell C11, select the range A1:C14 and insert a scatter plot with straight lines and
markers.
Note: when you add a trendline to an Excel chart, Excel can display the equation in a chart. This equation
predicts the same future values.
FORECAST.ETS
The FORECAST.ETS function in Excel 2016 or later is a great function which can detect a seasonal pattern.
1. The FORECAST.ETS function below predicts a future value using Exponential Triple Smoothing.
Note: the last 3 arguments are optional. The fourth argument indicates the length of the seasonal pattern. The
default value of 1 indicates seasonality is detected automatically.
2. Enter the value 49 into cell C13, select the range A1:C17 and insert a scatter plot with straight lines and
markers.
3. You can use the FORECAST.ETS.SEASONALITY function to find the length of the seasonal pattern.
After seeing the chart, you probably already know the answer.
Conclusion: in this example, when using the FORECAST.ETS function, you can also use the value 4 for the
fourth argument.
Forecast Sheet
Use the Forecast Sheet tool in Excel 2016 or later to automatically create a visual forecast worksheet.
1. Select the range A1:B13 shown above.
3. Specify when the forecast ends, set a confidence interval (95% by default), detect seasonality
automatically or manually set the length of the seasonal pattern, etc.
4. Click Create.
This tool uses the FORECAST.ETS function and calculates the same future values. The lower and upper
confidence bounds are a nice bonus.
Explanation: in period 13, we can be 95% confident that the number of visitors will be between 86 and 94.
Absolute Value
The ABS function in Excel returns the absolute value of a number. In other words: the ABS function removes the minus
sign (-) from a negative number, making it positive.
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
1. For example, the ABS function in cell B1 below returns the absolute value of a negative number.
4. For example, calculate the forecast error (difference between the actual and the forecast value) for each month.
Note: if we look at the sum of these errors (zero), this forecast model seems perfect, but it's not!
5. Simply use the ABS function to calculate the absolute error for each month.
6. If you don't want to display the forecast errors on the sheet, use SUMPRODUCT and ABS.
Note: visit our page about the SUMPRODUCT function to learn more about this function.
Let's take a look at one more cool example.
7. Use the ABS function to calculate the absolute value of each difference.
Explanation: if the difference is less than or equal to 3, the IF function returns 1, else it returns 0.
9. Add icons.
Note: visit our page about icon sets to learn more about this topic. To view this formatting rule, download the Excel file.
Next, on the Home tab, in the Styles group, click Conditional Formatting, Manage Rules.
Note: the first argument (D2:D12 in this example) is always the range in which the maximum or minimum will be
determined. This MAXIFS function has 1 range/criteria pair (B2:B12/Female).
3. For example, the MAXIFS function below finds the highest female score in Canada.
Note: this MAXIFS function has 2 range/criteria pairs (B2:B12/Female and C2:C12/Canada). MAXIFS and MINIFS
functions can handle up to 126 range/criteria pairs.
4. The MAXIFS function below finds the highest score below 60.
Weighted Average
To calculate a weighted average in Excel, simply use SUMPRODUCT and SUM.
1. First, the AVERAGE function below calculates the normal average of three scores.
Suppose your teacher says, "The test counts twice as much as the quiz and the final exam counts three times as much as the
quiz".
20 + 40 + 40 + 90 + 90 + 90
Weighted Average =
6
370
= = 61.67
6
3. We can use the SUMPRODUCT function in Excel to calculate the number above the fraction line (370).
Note: the SUMPRODUCT function performs this calculation: (20 * 1) + (40 * 2) + (90 * 3) = 370.
4. We can use the SUM function in Excel to calculate the number below the fraction line (6).
5. Use the functions at step 3 and step 4 to calculate the weighted average of these scores in Excel.
Standard Deviation
What is Standard Deviation? | STDEV.P | STDEV.S
This page explains how to calculate the standard deviation based on the entire population using the STDEV.P function
in Excel and how to estimate the standard deviation based on a sample using the STDEV.S function in Excel.
What is Standard Deviation?
Standard deviation is a number that tells you how far numbers are from their mean.
Explanation: the numbers are all the same which means there's no variation. As a result, the numbers have a standard
deviation of zero. The STDEV function is an old function. Microsoft Excel recommends using the new STEDV.S function
which produces the exact same result.
Explanation: the numbers are close to the mean. As a result, the numbers have a low standard deviation.
Explanation: the numbers are spread out. As a result, the numbers have a high standard deviation.
STDEV.P
The STDEV.P function (the P stands for Population) in Excel calculates the standard deviation based on the entire
population. For example, you're teaching a group of 5 students. You have the test scores of all students. The entire
population consists of 5 data points. The STDEV.P function uses the following formula:
7. Fortunately, the STDEV.P function in Excel can execute all these steps for you.
STDEV.S
The STDEV.S function (the S stands for Sample) in Excel estimates the standard deviation based on a sample. For example,
you're teaching a large group of students. You only have the test scores of 5 students. The sample size equals 5. The
STDEV.S function uses the following formula:
In this example, x1=5, x2=1, x3=4, x4=6, x5=9 (same numbers as above), x̄=5 (sample mean), n=5 (sample size).
1. Repeat steps 1-5 above but at step 5 divide by n-1 instead of N.
3. Fortunately, the STDEV.S function in Excel can execute all these steps for you.
Note: why do we divide by n - 1 instead of by n when we estimate the standard deviation based on a sample? Bessel's
correction states that dividing by n-1 instead of by n gives a better estimation of the standard deviation.
Frequency
The FREQUENCY function in Excel calculates how often values occur within the ranges you specify in a bin table. You
can also use the COUNTIFS function to create a frequency distribution.
1. First, enter the bin numbers (upper levels) in the range C4:C8.
2. Select the range D4:D9 (extra cell), enter the FREQUENCY function shown below (without the curly braces) and finish
by pressing CTRL + SHIFT + ENTER.
Note: the formula bar indicates that this is an array formula by enclosing it in curly braces {}. To delete this array formula,
select the range D4:D9 and press Delete.
3. Hide the column with the bin numbers (upper levels) and insert a column with proper bin labels.
Explanation: 1 value is less than or equal to 20, 8 values are greater than or equal to 21 and less than or equal to 25, etc. At
step 2, we selected the range D4:D9 (instead of the range D4:D8). As a result, the FREQUENCY function also counts the
number of values that are greater than 40.
5. Change the bin numbers. Select the range D4:D9 (no extra cell), enter the FREQUENCY function shown below (without
the curly braces) and finish by pressing CTRL + SHIFT + ENTER.
Explanation: the last bin number is greater than or equal to the maximum value (52). As a result, we don't need an extra cell
to count the number of values that are greater than 60.
6. You can also use the COUNTIFS function to create a frequency distribution.
Explanation: the COUNTIFS function in Excel counts cells based on two or more criteria. The COUNTIFS function shown
above has 2 range/criteria pairs. The & operator joins ">=" with the value in cell C4 and "<=" with the value in cell D4. You
can easily copy this formula to the other cells.
Round
Round | RoundUp | RoundDown
This chapter illustrates three functions to round numbers in Excel. ROUND, ROUNDUP and ROUNDDOWN.
Before your start: if you round a number, you lose precision. If you don't want this, show fewer decimal places without
changing the number itself.
Round
The ROUND function in Excel rounds a number to a specified number of digits. The ROUND function rounds up or down.
1, 2, 3 and 4 get rounded down. 5, 6, 7, 8 and 9 get rounded up.
Note: 114.7261, 114.7262, 114.7263 and 114.7264 get rounded down to 114.726 and 114.7265, 114.7266, 114.7267,
114.7268 and 114.7269 get rounded up to 114.727.
2. Round a number to two decimal places.
RoundUp
The ROUNDUP function in Excel always rounds a number up (away from zero). 1, 2, 3, 4, 5, 6, 7, 8 and 9 get rounded up.
Note: 114.7261, 114.7262, 114.7263, 114.7264, 114.7265, 114.7266, 114.7267, 114.7268 and 114.7269 get rounded up to
114.727.
2. Round a number up to two decimal places.
Note: remember, the ROUNDUP function rounds a number up (away from zero).
Note: again, the ROUNDUP function rounds a number up (away from zero).
RoundDown
The ROUNDDOWN function in Excel always rounds a number down (toward zero). 1, 2, 3, 4, 5, 6, 7, 8 and 9 get rounded
down.
Note: 114.7261, 114.7262, 114.7263, 114.7264, 114.7265, 114.7266, 114.7267, 114.7268 and 114.7269 get rounded down
to 114.726.
2. Round a number down to two decimal places.
Note: remember, the ROUNDDOWN function rounds a number down (toward zero).
Note: again, the ROUNDDOWN function rounds a number down (toward zero).
The INT (Integer) function rounds a number down to the nearest integer (negative numbers become more negative).
Conclusion: the INT function only chops off decimals from positive numbers.
Trunc
The TRUNC (Truncate) function always chops off decimals.
The TRUNC function can keep any number of decimals and chop off the rest.
Nearest Multiple
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
Ceiling
The same as MROUND but rounds up.
Floor
The same as MROUND but rounds down.
2. The EVEN function rounds a negative number down to the nearest even integer.
Odd
1. The ODD function rounds a positive number up to the nearest odd integer.
2. The ODD function rounds a negative number down to the nearest odd integer.
Even or Odd?
Use IF and MOD to determine if a number is even or odd. The MOD function gives the remainder of a division.
1. Even numbers divided by 2 always give a remainder of 0. For example, 28 divided by 2 equals 14 with a remainder of 0.
As a result, the IF function returns Even.
2. Odd numbers divided by 2 always give a remainder of 1. For example, 29 divided by 2 equals 14 with a remainder of 1.
As a result, the IF function returns Odd.
Formula Errors
##### error | #NAME? error | #VALUE! error | #DIV/0! error | #REF! error
This chapter teaches you how to deal with some common formula errors in Excel.
##### error
When your cell contains this error code, the column isn't wide enough to display the value.
1. Click on the right border of the column A header and increase the column width.
Tip: double click the right border of the column A header to automatically fit the widest entry in column A.
#NAME? error
The #NAME? error occurs when Excel does not recognize text in a formula.
#VALUE! error
Excel displays the #VALUE! error when a formula has the wrong type of argument.
#DIV/0! error
Excel displays the #DIV/0! error when a formula tries to divide a number by 0 or an empty cell.
Explanation: if cell A2 equals 0, an empty string ("") is displayed. If not, the result of the formula A1/A2 is displayed.
#REF! error
Excel displays the #REF! error when a formula refers to a cell that is not valid.
2. Delete column B. To achieve this, right click the column B header and click Delete.
4. To fix this error, you can either delete +#REF! in the formula of cell B1 or you can undo your action by pressing
CTRL + z
IsError
This example illustrates the ISERROR function in Excel.
1. For example, Excel displays the #DIV/0! error when a formula tries to divide a number by 0.
2. The ISERROR function in Excel checks whether a value is an error and returns TRUE or FALSE.
3. Add the IF function. If a cell contains an error, the value 5 is returned. If not, the value 100 is returned.
Aggregate
Excel functions such as SUM, COUNT, LARGE and MAX don't work if a range includes errors. However, you can easily
use the AGGREGATE function to fix this.
1. For example, Excel returns an error if you use the SUM function to sum a range with errors.
Explanation: the first argument (9) tells Excel that you want to use the SUM function. The second argument (6) tells Excel
that you want to ignore error values.
3. It's not easy to remember which argument belongs to which function. Fortunately, the AutoComplete feature in Excel
helps you with this.
4. The AGGREGATE function below finds the second largest number in a range with errors.
Explanation: the first argument (14) tells Excel that you want to use the LARGE function. The second argument (6) tells
Excel that you want to ignore error values. The fourth argument (2) tells Excel that you want to find the second largest
number.
5. The AGGREGATE function below finds the maximum value ignoring error values and hidden rows.
Explanation: the first argument (4) tells Excel that you want to use the MAX function. The second argument (7) tells Excel
that you want to ignore error values and hidden rows. In this example, row 2 is hidden.
Circular Reference
A formula in a cell that directly or indirectly refers to its own cell is called a circular reference. This is not possible.
1. For example, the formula in cell A3 below directly refers to its own cell. This is not possible.
2d. So far, everything's OK. Now change the value in cell C1 to the formula =C4. Cell C1 refers to cell C4, cell C4 refers to
cell C3, cell C3 refers to cell C2, and cell C2 refers to cell C1. In other words, the formula in cell C1 indirectly refers to its
own cell. This is not possible.
3. To find your circular references, on the Formulas tab, in the Formula Auditing group, click the down arrow next to Error
Checking.
Formula Auditing
Trace Precedents | Remove Arrows | Trace Dependents | Show Formulas | Error Checking | Evaluate Formula
Formula auditing in Excel allows you to display the relationship between formulas and cells. The example below helps you
master Formula Auditing quickly and easily.
Trace Precedents
You have to pay $96.00. To show arrows that indicate which cells are used to calculate this value, execute the following
steps.
2. On the Formulas tab, in the Formula Auditing group, click Trace Precedents.
Result:
As expected, Total cost and Group size are used to calculate the Cost per person.
As expected, the different costs are used to calculate the Total cost.
Remove Arrows
To remove the arrows, execute the following steps.
1. On the Formulas tab, in the Formula Auditing group, click Remove Arrows.
Trace Dependents
To show arrows that indicate which cells depend on a selected cell, execute the following steps.
2. On the Formulas tab, in the Formula Auditing group, click Trace Dependents.
Result:
Show Formulas
By default, Excel shows the results of formulas. To show the formulas instead of their results, execute the following steps.
1. On the Formulas tab, in the Formula Auditing group, click Show Formulas.
Result:
Note: instead of clicking Show Formulas, press CTRL + ` (you can find this key above the tab key).
Error Checking
To check for common errors that occur in formulas, execute the following steps.
2. On the Formulas tab, in the Formula Auditing group, click Error Checking.
Result. Excel finds an error in cell C13. The formula tries to divide a number by 0.
Evaluate Formula
To debug a formula by evaluating each part of the formula individually, execute the following steps.
2. On the Formulas tab, in the Formula Auditing group, click Evaluate Formula.
Excel stores and calculates floating point numbers. Sometimes, the result of a formula is a very close approximation.
1. For example, take a look at the formulas below. At first glance, everything looks alright.
2. However, if we show 16 decimal places, we can see that one result is a very close approximation.
You don't have to worry about floating point errors. They are rare.
3. Even if your worksheet contains a floating point error, in most cases, this causes no problems. However, if you compare
the value in cell C8 with another value, the following problem can occur.
Array Formulas
Without Array Formula | With Array Formula | F9 Key
This chapter helps you understand array formulas in Excel. Single cell array formulas perform multiple calculations in one
cell.
Without Array Formula
Without using an array formula, we would execute the following steps to find the greatest progress.
2. Next, we would use the MAX function to find the greatest progress.
2. To find the greatest progress (don't be overwhelmed), we add the MAX function, replace C2 with C2:C6 and B2 with
B2:B6.
Note: The formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
They will disappear when you edit the formula.
Explanation: The range (array constant) is stored in Excel's memory, not in a range. The array constant looks as follows:
{19;33;63;48;13}
This array constant is used as an argument for the MAX function, giving a result of 63.
F9 Key
When working with array formulas, you can have a look at these array constants yourself.
2. Press F9.
That looks good. Elements in a vertical array constant are separated by semicolons. Elements in a horizontal array constant
are separated by commas.
Count Errors
This example shows you how to create an array formula that counts the number of errors in a range.
1. We use IF and ISERROR to check for an error.
Explanation: the IF function returns 1, if an error is found. If not, it returns an empty string.
2. To count the errors (don't be overwhelmed), we add the COUNT function and replace A1 with A1:C3.
Note: The formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
They will disappear when you edit the formula.
Explanation: The range (array constant) created by the IF function is stored in Excel's memory, not in a range. The array
constant looks as follows:
{1,"",1;"","","";"","",1}
This array constant is used as an argument for the COUNT function, giving a result of 3.
4. To count specific errors, use the COUNTIF function. For example, count the number of cells that contain the #DIV/0!
error.
2. To count the unique values (don't be overwhelmed), we add the SUM function, 1/, and replace 5 with A1:A6.
Note: The formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
They will disappear when you edit the formula.
Explanation: The range (array constant) created by the COUNTIF function is stored in Excel's memory, not in a range. The
array constant looks as follows:
{3;1;1;1;3;3} - (three 7's, one sun, one moon, one 5, three 7's, three 7's)
This array constant is used as an argument for the SUM function, giving a result of 1/3+1+1+1+1/3+1/3 = 4.
4. The array formula below counts the number of values that occur exactly once.
Explanation: the IF function converts the array constant {3;1;1;1;3;3} to {0;1;1;1;0;0}. This array constant is used as an
argument for the SUM function, giving a result of 3.
5. If you have Excel 365, simply use the magic UNIQUE function to extract unique values.
Note: this dynamic array function, entered into cell C3, fills multiple cells. Wow! This behavior in Excel 365 is called
spilling.
6. Next, add the COUNTA function to count unique values in Excel 365.
7. The formula below counts the number of values that occur exactly once.
7400190666 [email protected] saraswatiscomputers.com
SARASWATI PROTECH
Note: the UNIQUE function has 2 optional arguments. The default value of 0 (second argument) tells the UNIQUE function
to extract values from a vertical array. The value 1 (third argument) tells the UNIQUE function to extract values that occur
exactly once.
2a. However, if we want to count the number of rows that contain Google or Stanford (two columns), we cannot simply use
the COUNTIF function twice (see the picture below). Rows that contain Google and Stanford are counted twice, but they
should only be counted once. 4 is the answer we are looking for.
2b. What we need is an array formula. We use the IF function to check if Google or Stanford occurs.
Explanation: TRUE = 1, FALSE = 0. For row 1, the IF function evaluates to IF(TRUE+TRUE,1,0), IF(2,1,0), 1. So the first
row will be counted. For row 2, the IF function evaluates to IF(FALSE+FALSE,1,0), IF(0,1,0), 0. So the second row will
not be counted. For row 3, the IF function evaluates to IF(FALSE+TRUE,1,0), IF(1,1,0), 1. So the third row will be
counted, etc.
2c. All we need is a SUM function that counts these 1's. To achieve this (don't be overwhelmed), we add the SUM function
and replace A1 with A1:A8 and B1 with B1:B8.
Note: The formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
They will disappear when you edit the formula.
Explanation: The range (array constant) created by the IF function is stored in Excel's memory, not in a range. The array
constant looks as follows:
{1;0;1;0;1;0;1;0}
This array constant is used as an argument for the SUM function, giving a result of 4.
3. We can go one step further. For example, we want to count the number of rows that contain
(Google and Stanford) or Columbia.
2. The MOD function gives the remainder of a division. For example, for the first row, MOD(1,3) = 1 because 1 divided by
3 equals 0 with a remainder 1. For the third row, MOD(3,3) = 0 because 3 divided by 3 equals 1 with a remainder of 0. As a
result, the formula returns 0 for every 3th row.
Note: change the 3 to 4 to sum every 4th row, to 5 to sum every 5th row, etc.
4. To get the sum of the product of these two ranges (FALSE=0, TRUE=1), use the SUM function and finish by pressing
CTRL + SHIFT + ENTER.
Note: The formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
They will disappear when you edit the formula.
Explanation: The product of these two ranges (array constant) is stored in Excel's memory, not in a range. The array
constant looks as follows.
{0;0;5;0;0;66;0;0;21}
This array constant is used as an argument for the SUM function, giving a result of 92.
2. To sum the 4 largest numbers (don't be overwhelmed), add the SUM function and replace 2 with {1,2,3,4}.
Note: The formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
They will disappear when you edit the formula.
Explanation: The range (array constant) created by the LARGE function is stored in Excel's memory, not in a range. The
array constant looks as follows.
{22,10,8,6}
This array constant is used as an argument for the SUM function, giving a result of 46.
This example shows you how to create an array formula that sums a range with errors. You can also use the AGGREGATE
function to sum a range with errors.
1. We use the IFERROR function to check for an error.
Explanation: the IFERROR function returns 0, if an error is found. If not, it returns the value of the cell.
2. To sum the range with errors (don't be overwhelmed), we add the SUM function and replace A1 with A1:A7.
Note: The formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
They will disappear when you edit the formula.
Explanation: The range (array constant) created by the IFERROR function is stored in Excel's memory, not in a range. The
array constant looks as follows:
{0;5;4;0;0;1;3}
This array constant is used as an argument for the SUM function, giving a result of 13.
2a. However, if we want to sum the cells that meet the following criteria: Google or Stanford (two criteria ranges), we
cannot simply use the SUMIF function twice (see the picture below). Cells that meet the criteria Google and Stanford are
added twice, but they should only be added once. 10 is the answer we are looking for.
2b. We need an array formula. We use the IF function to check if Google or Stanford occurs.
Explanation: TRUE = 1, FALSE = 0. For row 1, the IF function evaluates to IF(TRUE+TRUE,1,0)*3, IF(2,1,0)*3, 3. So the
value 3 will be added. For row 2, the IF function evaluates to IF(FALSE+FALSE,1,0)*5, IF(0,1,0)*5, 0. So the value 5 will
not be added. For row 3, the IF function evaluates to IF(FALSE+TRUE,1,0)*2, IF(1,1,0)*2, 2. So the value 2 will be added,
etc.
2c. All we need is a SUM function that sums these values. To achieve this (don't be overwhelmed), we add the SUM
function and replace A1 with A1:A8, B1 with B1:B8 and C1 with C1:C8.
Note: The formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
They will disappear when you edit the formula.
Explanation: The range (array constant) created by the IF function is stored in Excel's memory, not in a range. The array
constant looks as follows:
{1;0;1;0;1;0;1;0}
{3;0;2;0;4;0;1;0}
This latter array constant is used as an argument for the SUM function, giving a result of 10.
3. We can go one step further. For example, we want to sum the cells that meet the following criteria:
(Google and Stanford) or Columbia.
You can use the COUNTIF function to count the number of occurrences of each word. However, we are looking for a single
formula that returns the most frequently occurring word (circle in our example).
To find the most frequently occurring word, execute the following steps.
Explanation: circle (A7) found at position 2 in the range A1:A7. Set the third argument to 0 to return an exact match.
2. To find the position of the most frequently occurring word (don't be overwhelmed), we add the MODE function and
replace A7 with A1:A7.
Note: The formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself.
They will disappear when you edit the formula.
Explanation: The range (array constant) created by the MATCH function is stored in Excel's memory, not in a range. The
array constant looks as follows:
{1;2;2;2;5;5;2} - (triangle found at position 1, circle found at position 2, circle found at position 2, etc.)
This array constant is used as an argument for the MODE function, giving a result of 2 (the position of the most frequently
occurring word).
4. Use this result and the INDEX function to return the 2nd word in the range A1:A7, the most frequently occurring word.
5x + 1y + 8z = 46
4x - 2y = 12
6x + 7y + 4z = 50
In matrix notation, this can be written as AX = B
5 1 8 x 46
with A = 4 -2 0 , X= y , B = 12
6 7 4 z 50
If A-1 (the inverse of A) exists, we can multiply both sides by A-1 to obtain X = A-1B. To solve this system of linear equations
in Excel, execute the following steps.
1. Use the MINVERSE function to return the inverse matrix of A. First, select the range B6:D8. Next, insert the
MINVERSE function shown below. Finish by pressing CTRL + SHIFT + ENTER.
Note: the formula bar indicates that the cells contain an array formula. Therefore, you cannot delete a single result. To
delete the results, select the range B6:D8 and press Delete.
2. Use the MMULT function to return the product of matrix A-1 and B. First, select the range G6:G8. Next, insert the
MMULT function shown below. Finish by pressing CTRL + SHIFT + ENTER.
3. Put it all together. First, select the range G6:G8. Next, insert the formula shown below. Finish by pressing CTRL +
SHIFT + ENTER.