Excel Advanced Functions
Excel Advanced Functions
Debra Dalgleish
www.contextures.com
30 Excel Functions in 30 Days: Text, Information, Lookup and Reference
Copyright © 2011 by Debra Dalgleish, Contextures Inc., www.contextures.com
All rights reserved. No part of this work may be reproduced or transmitted in any form or
by any means, electronic or mechanical, including photocopying, recording, or by any
information storage or retrieval system, without the prior written permission of the
copyright owner and the publisher.
Trademarked names may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, we use the names only in an editorial fashion
and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The information in this book is distributed on an "as is" basis, without warranty.
Although every precaution has been taken in the preparation of this work, neither the
author(s) nor Contextures Inc. shall have any liability to any person or entity with respect
to any loss or damage caused or alleged to be caused directly or indirectly by the
information contained in this work.
Version 1.00 – August 26, 2011
www.contextures.com
Table of Contents
Table of Contents .......................................................................................................................................... 1
Introduction ................................................................................................................................................... 1
Function 01: EXACT .................................................................................................................................... 2
Function 02: AREAS .................................................................................................................................. 12
Function 03: TRIM ..................................................................................................................................... 17
Function 04: INFO ...................................................................................................................................... 21
Function 05: CHOOSE ............................................................................................................................... 26
Function 06: FIXED ................................................................................................................................... 31
Function 07: CODE .................................................................................................................................... 37
Function 08: CHAR .................................................................................................................................... 40
Function 09: VLOOKUP ............................................................................................................................ 47
Function 10: HLOOKUP ............................................................................................................................ 53
Function 11: CELL ..................................................................................................................................... 57
Function 12: COLUMNS ............................................................................................................................ 61
Function 13: TRANSPOSE ........................................................................................................................ 65
Function 14: T ............................................................................................................................................. 71
Function 15: REPT ..................................................................................................................................... 73
Function 16: LOOKUP ............................................................................................................................... 78
Function 17: ERROR.TYPE ....................................................................................................................... 82
Function 18: SEARCH ............................................................................................................................... 86
Function 19: MATCH ................................................................................................................................. 91
Function 20: ADDRESS ............................................................................................................................. 96
Function 21: TYPE ................................................................................................................................... 102
Function 22: N .......................................................................................................................................... 106
Function 23: FIND .................................................................................................................................... 110
Function 24: INDEX ................................................................................................................................. 114
Function 25: REPLACE ........................................................................................................................... 123
Function 26: OFFSET ............................................................................................................................... 126
Function 27: SUBSTITUTE ..................................................................................................................... 131
Function 28: HYPERLINK....................................................................................................................... 137
Function 29: CLEAN ................................................................................................................................ 141
Function 30: INDIRECT........................................................................................................................... 144
What Next? ............................................................................................................................................... 150
Functions Index......................................................................................................................................... 151
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 1
Introduction
This guide will help you get started with Excel functions, from the Text, Information and
Lookup and Reference categories. You'll see the arguments required for each function,
learn tips and pitfalls, and work through examples.
To improve your skills, find an applicable situation to use each function in your own
workbooks. For extra brain-sticking power, teach a friend or co-worker how to use each
function. When you explain it to someone else, you'll understand it better yourself.
Links
1. If you're reading this guide on your computer, you can click the links to read more
about a topic on the Contextures website. The home page is
http://www.contextures.com
2. The tutorial videos are uploaded to the Contextures channel on YouTube, and you
can click the video links in this guide, to view the videos online.
Sample Files
3. The zipped folder that contains this Lesson Guide also has folders with Excel files,
for the lessons. You can create and save your own files as you work through this
course, or use the sample files provided for each lesson.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 2
EXACT Syntax
The EXACT function has the following syntax:
EXACT(text1,text2)
• Text1 is the first text string.
• Text2 is the second text string.
You can enter the arguments as cell references or text strings. In Excel 2007, the
maximum string length for EXACT is 32767 characters.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 3
EXACT Traps
In Excel 2007 Help, there is the following statement in the Remarks section for the
EXACT function.
"You can also use the double equals (==) comparison operator instead of the
EXACT function to make exact comparisons. For example, =A1==B1 returns the
same value as =EXACT(A1,B1)."
This is incorrect. There is no "double equals" operator in Excel, and this remark has
been removed in the Excel 2010 Help.
On another sheet, users will enter the password, and you'll use the EXACT function to
compare their entry to the contents of the "pwd" cell.
2. On the Ex01 sheet, the user will type a password in cell C3. For this test, enter the
correct password, but make the last letter lower case, instead of upper case.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 4
First, see what happens if you use the Equal Sign to compare the two cells.
3. In cell C5, enter this formula: = C3=pwd
and the result will be TRUE, as long as the values are the same – it doesn't matter
if the letters are upper or lower case.
Next, see what happens if you use the EXACT function to compare the two cells.
4. In cell C6, the EXACT function compares C3 to the pwd cell: =EXACT
(C3,pwd)
• If the contents of the two cells are identical, including upper and lower case,
cell C6 will show TRUE as the result. Note: Formatting differences, such as
bold font, are ignored.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 5
• If there is a difference in the contents – if even one letter is a different case, the
result in C6 will be FALSE.
Finally, you could combine the EXACT function with the IF function, to show a message
if the incorrect password is entered.
5. In cell C8, enter this formula:
=IF(C3="","",IF(EXACT(C3,pwd),"Correct","Incorrect. Try again."))
• If cell C3 is empty ("") then no message will be shown in cell C8.
• If cell C3 is an EXACT match for the pwd cell, then cell C8 will show the
message, "Correct".
• If cell C3 is NOT an EXACT match for the pwd cell, then cell C8 will show
the message, "Incorrect. Try again."
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 6
To test the data validation, enter a password, then try to type a number that is higher than
10%. You'll see an error message, and will have to Cancel or Retry.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 7
If any lower case letters are entered in cell C2, an error alert will appear. This won't
prevent all errors in the postal code, but will ensure that only upper case letters are used.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 8
The formula in cell F2 uses the EXACT function to check the product code typed in cell
E2, and see if there's an exact match in the list of product codes.
The OR function checks if any one of the cells – B2 OR B3 OR B4 OR B5 – is an
EXACT match for the entry in cell E2.
IN cell F2, type this formula, and press Ctrl+Shift+Enter, to array-enter the formula.
=OR(EXACT($B$2:$B$5,E2))
NOTE: The curly brackets will be automatically added, to show that it is an array
formula – do not type the curly brackets yourself.
{=OR(EXACT($B$2:$B$5,E2))}
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 9
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 10
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 11
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 12
AREAS Syntax
The AREAS function has the following syntax:
AREAS(reference)
• The reference argument can be a single cell or range, or can refer to
multiple areas.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 13
Reference Operators
When entering references, you can use any of the 3 reference operators:
Operator Example Type Use
: colon A1:B4 Range all cells between, and including, the two
references
, comma A1, B2 Union combine multiple references into one
space A1 B3 Intersection cells common to the references
AREAS Traps
If you are using a comma in the AREAS function, to refer to multiple ranges or cells, add
another set of parentheses.
=AREAS((F2,G2:H2))
Otherwise, the comma will be interpreted as a field separator, and you'll get a "too many
arguments" error.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 14
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 15
In this example, the two references overlap, and F2 is completely within the F2:H2 range,
but they are counted as separate areas, so the formula result is 2.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 16
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 17
TRIM Syntax
The TRIM function has the following syntax:
TRIM(text)
• text is a cell reference or text string from which you want spaces removed.
TRIM Traps
The TRIM function only removes standard space characters from the text. If you copy
text from a website, it might contain special non-breaking space characters, and the
TRIM function will not remove those.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 18
The LEN formula in cell E7 now counts 13 characters – the 4 space characters added in
cell C5 have been trimmed.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 19
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 20
Alternatives
When the TRIM function doesn't work, you can try other methods for cleaning the data:
• manually delete the non-breaking space character
• use the SUBSTITUTE function
• record or write a macro.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 21
INFO Syntax
The INFO function has the following syntax:
INFO(type_text)
• type_text is one of the following items, which specify what information you
want.
o "directory" Path of current directory
o "numfile" Number of active worksheets in open workbooks.
o "origin" Absolute cell reference of top left visible
o "osversion" Current operating system version, as text.
o "recalc" Current recalculation mode; "Automatic" or "Manual".
o "release" Microsoft Excel version, as text.
o "system" Name of the operating environment: "pcdos" or "mac"
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 22
INFO Traps
In Excel's Help file, there is a warning that you should use the INFO function with
caution, because it could reveal confidential information to other users. For example, you
might not want other people to see the file path that your Excel workbook is in. If you're
sending an Excel file to someone else, be sure to remove any data that you don't want to
share!
You could use the result to display a message, based on version number. This formula, in
cell C4, uses IF, to test the result of the INFO function in cell C2
=IF(C2+0<14,"Time to upgrade","Latest version")
A zero is added to the INFO function result, to change the text value into a number. Then,
that number can be tested, to see if it's less than 14 (the latest version of Excel).
C2+0<14
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 23
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 24
In cell B3, there is a data validation drop down list, based on the TypeText named range.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 25
In cell C3, the INFO function returns the result for the type_text that is selected in B3.
=INFO(B3)
When "recalc" is selected, the result shows that the current recalculation mode is
Automatic.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 26
CHOOSE Syntax
The CHOOSE function has the following syntax:
• CHOOSE(index_num,value1,value2,…)
o index_number must be between 1 and 254 (or 29 in Excel 2003 and
earlier)
o index_number can be typed in the function, or can be a formula or cell
reference
o index_number fractions will be truncated to the lowest integer, before
using
o value arguments can be numbers, cell references, defined names,
formulas, functions, or text
CHOOSE Traps
• In Excel 2003, and earlier versions, the CHOOSE function is limited to
numbers between 1 and 29.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 27
For the CHOOSE function, the first argument is a reference to cell C2, where you'll type
a month number.
Next, you'll enter the quarter number for each month, in the order that they appear in the
table above.
=CHOOSE(C2,3,3,3,4,4,4,1,1,1,2,2,2)
Enter a month number in cell C2, and the Fiscal Quarter is calculated by the CHOOSE
function, in cell C3. If the month number in cell C2 is 8 (August), then the fiscal quarter
is 1.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 28
With the current date in cell C2, the formula in cell C3 uses the WEEKDAY and
CHOOSE functions to calculate the next Monday.
=C2+CHOOSE(WEEKDAY(C2),1,7,6,5,4,3,2)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 29
Inside the SUM function, the CHOOSE function will be evaluated first, and returns the
correct range for the SUM, for the selected store.
The stores are numbered in sequence, starting from 100, so we subtract 100 from the
store number, to get its position in the table.
=SUM(CHOOSE(C2-100,C7:C9,D7:D9,E7:E9))
This is example of a situation where other functions, like INDEX and MATCH, would be
more efficient.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 30
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 31
FIXED Syntax
The FIXED function has the following syntax:
• FIXED(number,decimals,no_commas)
o Number is the number you want to round and convert to text.
o Decimals is the number of digits to the right of the decimal point.
o If omitted, decimals defaults to 2
o If negative, decimals round to the left of decimal point
o If no_commas is FALSE or omitted, the result includes commas as
usual
o If no_commas is TRUE, commas are not included in the result.
FIXED Traps
The FIXED function changes a number to text, so don't use it anywhere that you want to
keep numbers as numbers. For example, if you want to limit the number of decimal
places for a chart's data, use number formatting in the cells, or use the ROUND function
instead.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 32
Instead of using FIXED, you could simply format the cell as Number format, with 2
decimal places, and a comma. That would leave the cell value unchanged — only its
appearance would be different.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 33
Or, you could use the ROUND function, combined with cell formatting, to return a
number that is rounded to two decimal places, and has a comma separator.
=ROUND(C2,2)
Finally, if you really want the result as text, use the TEXT function. Its formatting
options are much more flexible, and if you need rounding to the left, you can combine it
with the ROUND function.
=TEXT(C2,"#,###.00″)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 34
Or, you could use the ROUND function, to return a number that is rounded to the left.
=ROUND(C2,-2)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 35
Instead of using FIXED, you could format the cell with a Custom Number format of $#,
which would leave the cell value unchanged — only its appearance would be different.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 36
Or, for a text result, use the TEXT function, which lets you format the number as
thousands of dollars.
=TEXT(C3,"$#,")
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 37
CODE Syntax
The CODE function has the following syntax:
• CODE(text)
o text is the text string from which you want the first character's code
CODE Traps
Results could be different if you switch to a different operating system. The codes for the
ASCII character set (codes 32 to 126) are consistent, and most can be found on your
keyboard. However, the characters for the higher numbers (129 to 254) may vary, as you
can see in the comparison charts shown here:
Differences between ANSI, ISO-8859-1 and MacRoman character sets
For example, the ANSI code 189 is ½ and for the Macintosh it is Ω
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 38
In cell D3, the RIGHT/CODE formula shows that the last character has the code 160,
which is a non-breaking space used on websites.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 39
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 40
CHAR Syntax
The CHAR function has the following syntax:
• CHAR(number)
o a number between 1 and 255, specifying the character you want
returned. The character is from the character set used by your computer
CHAR Traps
Just like the CODE function, CHAR results could be different if you switch to a different
operating system. The codes for the ASCII character set (codes 32 to 126) are consistent,
and most can be found on your keyboard. However, the characters for the higher numbers
(129 to 254) may vary, as you can see in the comparison charts shown here:
Differences between ANSI, ISO-8859-1 and MacRoman character sets
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 41
After you create the formula, format the cell with Wrap Text, to see the line break,
instead of that strange symbol between the strings.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 42
The CODE for the first letter in the alphabet is 65, which is 1 + 64. So, if you add 64 to a
letter number, you'll get the CODE for that letter.
Then you can use the CHAR function to find any other letter in the alphabet, by adding
64 to the requested number.
=CHAR(B5+64)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 43
Unfortunately, that AutoFill technique doesn't work with letters (unless you create a
Custom List, as described below.) However, you can use the CHAR function to create a
list with the entire alphabet.
In cell A3, enter this formula, then copy it across to cell Z3.
=CHAR(A2 + 64)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 44
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 45
In the sample workbook, the CHAR function cells are in a range named CHAR_List. You
can select that named range from the Name Box drop down list, then change the font, to
see a different CHAR set.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 46
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 47
VLOOKUP Syntax
The VLOOKUP function has the following syntax:
• VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)
o lookup_value: the value that you want to look for — it can be a value,
or a cell reference.
o table_array: the lookup table — this can be a range reference or a
range name, with 2 or more columns.
o col_index_num: the column that has the value you want returned, based
on the column number within the table.
o [range_lookup]: for an exact match, use FALSE or 0; for an
approximate match, use TRUE or 1, with the lookup value column
sorted in ascending order..
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 48
VLOOKUP Traps
VLOOKUP can be slow, especially when doing a text string match, in an unsorted table,
where an exact match is requested. Wherever possible, use a table that is sorted by the
first column, in ascending order, and use an approximate match. You can use MATCH or
COUNTIF to check for the value first, to make sure it is in the table's first column (see
example 3 below).
Other functions, such as INDEX and MATCH, can be used to return values from a table,
and are more efficient.
If the product name is not found in the first column of the lookup table, the VLOOKUP
formula result is #N/A
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 49
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 50
The lookup value in this example is 77, which is not in the percentage column. The
grade for 75 (B) is returned, because 75 is the next largest value that is less than 77.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 51
If the product name is not found in the first column of the lookup table, the formula result
is 0.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 52
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 53
HLOOKUP Syntax
The HLOOKUP function has the following syntax:
• HLOOKUP(lookup_value,table_array,row_index_num,range_lookup)
o lookup_value: the value that you want to look for — it can be a value,
or a cell reference.
o table_array: the lookup table — this can be a range reference or a
range name, with 2 or more columns.
o row_index_num: the row that has the value you want returned, based
on the row number within the table.
o [range_lookup]: for an exact match, use FALSE or 0; for an
approximate match, use TRUE or 1, with the lookup value row sorted in
ascending order.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 54
HLOOKUP Traps
Like VLOOKUP, the HLOOKUP function can be slow, especially when doing a text
string match, in an unsorted table, where an exact match is requested. Wherever possible,
use a table that is sorted by the first row, in ascending order, and use an approximate
match. You can use MATCH or COUNTIF to check for the value first, to make sure it is
in the table's first row.
Other functions, such as INDEX and MATCH, can be used to return values from a table,
and are more efficient.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 55
If the region name is not found in the first row of the lookup table, the HLOOKUP
formula result is #N/A
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 56
The lookup value in this example is March 15th. That value is not in the date row, so the
value for January 1st (0.25) is returned.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 57
CELL Syntax
The CELL function has the following syntax:
• CELL(info_type,reference)
o info_type is one of the following values
o address…Reference of first cell in reference, as text.
o col…Column # of cell in reference.
o color…1 = color for negative values; otherwise 0 (zero).
o contents…Value of upper-left cell in reference
o coord…Absolute reference of first cell in reference
o filename…Filename and full path
o format…Cell number format
o parentheses…1 = parentheses for positive or all values; otherwise 0.
o prefix …"label prefix" of cell (alignment)
o protect…0 = not locked, 1 = locked.
o row…Row # of cell
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 58
CELL Traps
There are a few things to watch for when using the CELL function:
• The CELL function's reference argument is optional, but if it is omitted, the
result is returned for the last cell that was changed. To ensure that the result is
what you expect, it's best to include a reference — you can refer to the cell that
contains the CELL formula.
• When using the CELL function, you may need to recalculate the worksheet to
update the CELL formula result, if the cell is changed.
• For the "filename" info_type, an empty string is returned if the workbook has
not yet been saved.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 59
From that result, you can use other functions to extract the worksheet name. In the
formula below, the MID and FIND functions are used to find closing square bracket, then
return the 32 characters that follow it. (A worksheet name is limited to 31 characters)
=MID(CELL("filename",C3),FIND("]",CELL("filename",C3))+1,32)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 60
When "width" is selected, the result shows the column width, as an integer. The
measurement unit represents the width of one character in the default font size.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 61
COLUMNS Syntax
The COLUMNS function has the following syntax:
• COLUMNS(array)
o array is an array or array formula, or reference to a range.
COLUMNS Traps
If you're using a range reference, it must be a contiguous range.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 62
In cell C2, the COLUMNS function counts the number of columns in the RegionSales
table.
=COLUMNS(RegionSales)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 63
This formula, in cell C2, sums the last column in the named range.
=SUM(INDEX(MyRange,,COLUMNS(MyRange)))
The COLUMNS function counts the columns in the range, and the INDEX function uses
that number to return a reference to the last column. Then, SUM calculates the total
amount in that column.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 64
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 65
TRANSPOSE Syntax
The TRANSPOSE function has the following syntax:
• TRANSPOSE(array)
o array is an array or a range of cells to be transposed
TRANSPOSE Traps
• TRANSPOSE must be entered as an array formula, by pressing
Ctrl+Shift+Enter.
• The TRANSPOSE destination range must have the same number of rows and
columns, respectively, as the array has columns and rows.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 66
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 67
Instead of using TRANSPOSE, you could use another formula to display the data, such
as this INDEX formula. It does not require array entry, and you don't have to select all
the destination cells when creating the formula.
Enter this formula in cell C4, then copy down to cell C7, to get the annual amounts from
the horizontal table, in a vertical layout.
=INDEX($B$2:$E$2,,ROW()-ROW(C$4)+1)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 68
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 69
The formula tests the ranges to see if there are enough consecutive COLUMNS. The
results of those tests (1 or 0) are multiplied by the cell values, to get the total salaries.
To verify the results, I used the INDEX function, with SUM, with the maximum value
highlighted in yellow. This is a long way to accomplish what the previous formula did in
one cell!
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 70
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 71
Function 14: T
The T function returns the text from a value, or an empty string for no text.
T Syntax
The T function has the following syntax:
• T(value)
o value can be any value — typed in the formula, or a cell reference
T Traps
The T function returns an error if the value is an error, unlike ISTEXT, which returns
FALSE for errors.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 72
That looks like a number in cell B4, but there's an apostrophe in front of it, so it's actually
text. The T function returns the "1234" string. In column D, the ISTEXT function also
tests the value in cell B4, and returns the result of TRUE.
=ISTEXT(B4)
If the value is a number, as in cell B3, the T function result is an empty string. If you use
ISTEXT instead, the result is FALSE.
For error values, the T function result is an error, and ISTEXT returns false.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 73
REPT Syntax
The REPT function has the following syntax:
• REPT(text,number_times)
o text is the item that you want to repeat.
o number_times is a positive number
REPT Traps
• The limit to the text string is 32,767 characters — anything higher, and the
formula will result in an error.
• If number_times is a decimal, it will be truncated to an integer.
• If number_times is zero, the result is an empty string.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 74
REPT Alternative
If you simply want to fill a cell with a character, you can use cell formatting instead:
1. In a cell, type the character(s) that you want as the fill, e.g. a hyphen or period
2. With the cell selected, press Ctrl + 1, to open the Format Cells window
3. Click the Alignment tab, and from the Horizontal setting, select Fill
4. Click OK to close the dialog box.
The character fills the cell, and expands or shrinks if the column width is adjusted.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 75
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 76
The formula result shows one group of t's, for every 5 items in the count — INT(B3/5).
If there is a remainder, after dividing the count by 5, that amount is displayed at the end,
as lower case L's — MOD(B3,5).
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 77
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 78
LOOKUP Syntax
The LOOKUP function has two syntax forms — Vector and Array. With Vector form, it
looks for a value in a specified column or row, and with Array form, it looks in the first
row or column of an array.
The Vector form has the following syntax:
• LOOKUP(lookup_value,lookup_vector,result_vector)
o lookup_value can be text, number, logical value, a name or a reference
o lookup_vector is a range with only one row or one column
o result_vector is a range with only one row or one column
o lookup_vector and result_vector must be the same size
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 79
LOOKUP Traps
• The LOOKUP function doesn't have an option for Exact Match, which both
VLOOKUP and HLOOKUP have. If the lookup value isn't found, it matches
the largest value that is less than the lookup value.
• The lookup array or vector must be sorted in ascending order, or the result
might be incorrect.
• If the first value in the lookup array/vector is bigger than the lookup value, the
result is an #N/A error.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 80
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 81
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 82
ERROR.TYPE Syntax
The ERROR.TYPE function has the following syntax:
• ERROR.TYPE(error_val)
o error_val is the error that you want to identify
o ERROR.TYPE codes:
o 1…..#NULL!
o 2…..#DIV/0!
o 3…..#VALUE!
o 4…..#REF!
o 5…..#NAME?
o 6…..#NUM!
o 7…..#N/A
o #N/A..Other
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 83
ERROR.TYPE Traps
If the error_val is not an error, the result of the ERROR.TYPE function is an #N/A error.
You can avoid this, by using ISERROR to test for an error, as shown in Example 2.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 84
Here's the lookup table, with Error Type numbers, and messages.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 85
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 86
SEARCH Syntax
The SEARCH function has the following syntax:
• SEARCH(find_text,within_text,start_num)
o find_text is the text that you're looking for.
o within_text is the string that you're searching in.
o if start_num is omitted, the search starts with the first character
SEARCH Traps
The SEARCH function will return the position of the first matching string, regardless of
case. If you need a case sensitive search, use the FIND function.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 87
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 88
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 89
The formula found the string that contain "bank", but one of those is in a City name, not
the occupation:
There is a pipe character after each city name, so we can add a SEARCH for that. The
pipe character position can be used as the start_number argument in the main SEARCH,
so the cities will be ignored when searching.
Now, with the revised formula, only the rows with "bank" in the occupation are counted.
=–ISNUMBER(SEARCH($E$1,B2,SEARCH("|",B2)))
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 90
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 91
MATCH Syntax
The MATCH function has the following syntax:
• MATCH(lookup_value,lookup_array,[match_type])
o lookup_value can be text, number or logical value
o lookup_array is an array, or array reference (contiguous cells in a single
row or column)
o match_type can be -1, 0 or 1. If omitted, assumed to be 1
MATCH Traps
MATCH function returns the position of the item found, not the value. If you need the
value, combine MATCH with another function, like INDEX.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 92
Instead of an array reference, you can type an array as the lookup_array argument, within
curly brackets.
In this formula, the lookup month name is in cell D5, and three month names are typed in
the MATCH function's second argument -- {"Jan","Feb","Mar"}. If a later month,
such as Oct, is entered in D5, the result will be #N/A.
=MATCH(D5,{"Jan","Feb","Mar"},0)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 93
The lookup value is 54, and it's not in the list of scores, so MATCH returns the position
for 60. Because 60 is in position 4, the 4th value in the CHOOSE options is the result —
cell C6, with a grade of D.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 94
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 95
Type this formula in cell F2, then press Ctrl+Shift+Enter, to enter as an array.
=INDEX(B2:B5,MATCH(MIN(ABS(C2:C5-F1)),ABS(C2:C5-F1),0))
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 96
ADDRESS Syntax
The ADDRESS function has the following syntax:
• ADDRESS(row_num,column_num,[abs_num],[a1],[sheet_text])
o abs_num — if 1 or omitted, Absolute ($A$1), for Relative (A1), use 4.
Other options, 2=A$1, 3=$A1
o a1 — if TRUE or omitted, returns A1 style, FALSE for R1C1 style
o sheet_text — sheet name can be included, for address on different sheet
ADDRESS Traps
The ADDRESS function only returns the cell address as text. If you need the cell value,
use the INDIRECT function around the ADDRESS function, or use one of the alternative
formulas shown in Example 2.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 97
By omitting the abs_num argument in the formula above, the result was the default,
absolute reference -- $C$1.
To see the address as a relative reference, change the formula, by adding 4 as the
abs_num argument.
=ADDRESS($C$2,$C$3,4)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 98
To see R1C1 style, instead of the default A1 style, you can add FALSE in the a1
argument. In this version, the formula has a 1 as the abs_ref argument, so the result is an
absolute reference, in R1C1 style – R1C3.
=ADDRESS($C$2,$C$3,1,FALSE)
The final argument is sheet, and you can include a sheet name, if you want it in the result.
The ADDRESS function will automatically add single quotes around the sheet name, in
the formula result.
=ADDRESS($C$2,$C$3,1,TRUE,"Ex02")
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 99
The INDIRECT function will work without the ADDRESS function too. Here, the &
operator is used to create an R1C1 style address, and the cell value is returned.
=INDIRECT("R" & C2 & "C" & C3,FALSE)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 100
The INDEX function can also return a cell's value, based on a row and column number.
=INDEX(1:500,C2,C3)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 101
Then, in cell F4, the ADDRESS function is combined with MATCH, which finds the row
number, and COLUMN, which gets the column number.
=ADDRESS(MATCH(F3,C:C,0),COLUMN(C2))
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 102
TYPE Syntax
The TYPE function has the following syntax:
• TYPE(value)
o value can be text, number, error, or any other value
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 103
TYPE Traps
Unfortunately, the TYPE function cannot identify cells that contain a formula. It only
shows the type for a cell's contents, or a formula's result. In a few versions of Excel, the
Help files incorrectly reported that a formula would return 8 with the TYPE function.
This MSKB article corrects that error.
http://support.microsoft.com/kb/119148
However, if there is an apostrophe in front of the number, the TYPE function result is 2 –
Text.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 104
• If text is entered in B3, the TYPE function returns 2. That is less than 3, so the
MIN function returns 2, and CHOOSE returns the message "No text".
• If anything else is entered in B3, the TYPE function returns a 4 or higher. The
MIN function result will be 3, so CHOOSE returns the message "Enter Qty".
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 105
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 106
Function 22: N
The N function returns a value converted to a number. It's similar to the T function that
we saw earlier, but checks for numbers instead of text.
N Syntax
The N function has the following syntax:
• N(value)
o value can be text, number, or any other value
N Traps
If the value is an error, the N function returns the same error, instead of a number. Use
IFERROR or ISNUMBER to handle the errors.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 107
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 108
Or use two minus signs (double unary) to convert TRUE/FALSE or text numbers to
numbers.
=IFERROR(--C3,"")
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 109
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 110
FIND Syntax
The FIND function has the following syntax:
• FIND(find_text,within_text,[start_num])
o find_text is the text that you're looking for.
o within_text is the string that you're searching in.
o if start_num is omitted, the search starts with the first character
FIND Traps
• The FIND function will return the position of the first matching string, and it is
case sensitive. For a search that is not case sensitive, use the SEARCH
function.
• You can't use wildcard characters in the find_text string. For wildcards, use the
SEARCH function.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 111
FIND is case sensitive, so the first two "i" characters are ignored, because they are lower
case. The upper case I, at position 14, is found.
To handle errors, if the text is not found, you can wrap the FIND function with IFERROR
(in Excel 2003 or earlier, use IF and ISERROR).
=IFERROR(FIND(B5,B2),"Not Found")
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 112
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 113
The formula tests the first character at the LEFT, using a double unary (--) and
ISNUMBER.
ISNUMBER(--LEFT(B2,1))
If the first character is a number, the FIND function locates the first space character, and
the MID function returns all the text from the next character, to the end.
MID(B2,FIND(" ",B2)+1,LEN(B2))
If the first character is not a number, the entire text string in cell B2 is returned.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 114
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 115
INDEX Syntax
The INDEX function has two syntax forms — Array and Reference. With Array form, a
value is returned, and with Reference form, a reference is returned.
The Array form has the following syntax:
• INDEX(array,row_num,column_num)
o array is an array constant or range of cells
o if array has only 1 row or column, corresponding row/column number
argument is optional
o if array has >1 row or column, and only row_num or column_num is
used, array of entire row or column is returned
o row_num – if omitted, column_num is required
o column_num – if omitted, row_num is required
o if both the row_num and column_num arguments are used, returns value
in cell at intersection of row_num and column_num
o if row_num or column_num are zero, returns array of values for entire
column or row
The Reference form has the following syntax:
• INDEX(reference,row_num,column_num,area_num)
o reference can refer to one or more cell ranges – enclose nonadjacent
ranges in parentheses
o if each area in reference has only 1 row or column, corresponding
row/column number argument is optional
o area_num selects range in reference from which to return row and
column intersection
o area_num – if omitted, area 1 is used
o if row_num or column_num are zero, returns reference for entire
column or row
o result is a reference, and can be used by other functions
INDEX Traps
If the row_num and column_num don't point to a cell within the array or reference, the
INDEX function returns a #REF! error.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 116
To make the formula more flexible, you could use MATCH to return the row number,
based on the month that was selected from a drop down list.
=INDEX($C$2:$C$8,MATCH($F$2,$D$2:$D$8,0))
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 117
With the INDEX function, you can return the cost or revenue amount for a specific
region and month in the MonthAmts range.
• reference: MonthAmts range
• row_num: B10 – Region number
• column_num: C10 – column number (1=Rev, 2=Cost)
• area_num: D10 – Month number
Enter this formula in cell E10, to find the amount for the specified region, column, and
month:
=INDEX(MonthAmts,B10,C10,D10)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 118
The INDEX function result can be multiplied, as in the Tax calculation in cell F10:
=0.05*INDEX(MonthAmts,B10,C10,D10)
or, it can return a reference for the CELL function, to show the address of the result, in
cell G10.
=CELL("address",INDEX(MonthAmts,B10,C10,D10))
The CELL function is also used in conditional formatting, to highlight the selected cell.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 119
If another month is added to the list in column C, it will automatically appear in the data
validation drop down list in cell F2, which uses MonthsList as its source.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 120
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 121
From the result in cell G4, we can see that there are 2 months that come before
January, alphabetically.
• The ROW function calculates the row within the results list, by subtracting the
formula's row from the heading cell's row:
=ROW(E4)-ROW(E$3)
• SMALL returns the nth smallest item in the COUNTIF list, based on the
calculated ROW number. So, for ROW 1, the smallest COUNTIF result is 0.
=SMALL($G$4:$G$9,H4)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 122
• MATCH returns the row number for the SMALL result. For 0, the MATCH is
found in row 4 of the table.
=MATCH(I4,$G$4:$G$9,0)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 123
REPLACE Syntax
The REPLACE function has the following syntax:
• REPLACE(old_text,start_num,num_chars,new_text)
o old_text is the text string in which characters will be replaced.
o start_num is the position of the old characters
o num_chars is the number of old characters that will be replaced
o new_text is the text that will replace the original text
REPLACE Traps
The REPLACE function replaces a specified number of characters at the indicated
starting position. To replace a specific text string, anywhere in the original text, you can
use the SUBSTITUTE function.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 124
With the text in cell B3, starting from the first character, 3 characters are replaced, with
the value in cell C3.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 125
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 126
OFFSET Syntax
The OFFSET function has the following syntax:
• OFFSET(reference,rows,cols,height,width)
o reference is a cell or range of adjacent cells.
o rows can be positive (below starting reference) or negative (above
starting reference)
o cols can be positive (right of starting reference) or negative (left of
starting reference)
o height must be positive, and is number of rows in returned reference
o width must be positive, and is number of columns in returned reference
o if height or width are omitted, starting reference size is used
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 127
OFFSET Traps
The OFFSET function is volatile, so it could slow down a workbook if used in too many
cells. Instead, you could use another function, like INDEX, to return a reference.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 128
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 129
If another month is added to the list in column C, it will automatically appear in the data
validation drop down list in cell F2, which uses Months_List as its source
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 130
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 131
SUBSTITUTE Syntax
The SUBSTITUTE function has the following syntax:
• SUBSTITUTE(text,old_text,new_text,instance_num)
o text is the text string or cell reference, where text will be replaced.
o old_text is the text that will be removed
o new_text is the text that will be added
o instance_number is the number of occurrence of old text that you want
replaced
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 132
SUBSTITUTE Traps
• The SUBSTITUTE function can replace all instances of the old text, so use the
instance_num argument if you want a specific occurrence of old text replaced.
• For replacements that are not case sensitive, you can use the REPLACE
function.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 133
The printed report title is in cell C3. With this SUBSTITUTE formula, the "yyy" in the
title text will be replaced with the region name, selected in cell D13.
=SUBSTITUTE(RptTitle,"yyy",D13)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 134
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 135
In D3, the SUBSTITUTE function replaces the 2nd space character with new text – " | "
=SUBSTITUTE(B3," "," | ",C3)
Instead of using two columns for this formula, you could combine them:
=SUBSTITUTE(B3," "," | ",LEN(B3)-LEN(SUBSTITUTE(B3," ","")))
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 136
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 137
HYPERLINK Syntax
The HYPERLINK function has the following syntax:
• HYPERLINK(link_location,friendly_name)
o link_location is the text string for the location where you want to go.
o friendly_name is the text you want displayed in the cell
HYPERLINK Traps
If you have trouble creating the correct location string for the HYPERLINK function,
manually insert a link with the Hyperlink command on Excel's Ribbon. That should show
you the correct syntax, and then recreate that in your link_location argument.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 138
You could also use the & operator, and a cell address, to construct the link location. Here,
the sheet name is in cell B5 and the cell address is in C5. The friendly name for the
hyperlink is in cell D5.
=HYPERLINK("#"&"'" & B5 & "'!" & C5,D5)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 139
For a link to a named range in the same workbook, use the range name as the link
location. Here, the range name is in cell D7, and that is also used as the friendly name for
the hyperlink.
=HYPERLINK("#"&D7,D7)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 140
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 141
CLEAN Syntax
The CLEAN function has the following syntax:
• CLEAN(text)
o text is any information from which you want the non-printing characters
removed
CLEAN Traps
The CLEAN function only removes some non-printing characters from text — characters
0 to 31, 129, 141, 143, 144, and 157. For other non-printing characters, such as the non-
breaking space character 160, you can use SUBSTITUTE to replace them with space
characters, or empty strings.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 142
With the CLEAN function, in cell C7, those characters are removed, and the number of
characters is reduced by 2, so it's back to the original 13 characters.
=CLEAN(C5)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 143
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 144
INDIRECT Syntax
The INDIRECT function has the following syntax:
• INDIRECT(ref_text,a1)
o ref_text is the text string for a reference.
o a1 if TRUE or omitted, uses an A1 reference style; if FALSE, the R1C1
reference style is used
INDIRECT Traps
• The INDIRECT function is volatile, so it could slow down your workbook, if
used in many formulas.
• If the INDIRECT function creates a reference to another workbook, that
workbook must be open, or the formula will result in a #REF! error.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 145
• If the INDIRECT function creates a reference to a range outside the row and
column limit, the formula will result in a #REF! error. (Excel 2007 and Excel
2010)
• The INDIRECT function cannot resolve a reference to a dynamic named range
Later, if a row is inserted at the top of the lists, and January amounts are entered, the
column C total doesn't change. The formula adjusts to the inserted row, shifting down:
=SUM(C3:C5)
However, the INDIRECT function locks the starting cell to E2, so January is included in
the column E total. The ending cell changed, but the starting cell wasn't affected.
=SUM(INDIRECT("E2"):E5)
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 146
Instead of typing the name in the SUM formula, you can refer to the range name in a
worksheet cell. For example, with the name NumList in cell D7, the formula in cell E7 is:
=SUM(INDIRECT(D7))
Using INDIRECT with the static range names gives the same result as typing the range
name in the SUM function.
Unfortunately, the INDIRECT function can't resolve a dynamic range, so when the
formula is copied down to cell E8, the result is a #REF! error.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 147
The result in cell E3 shows the value from cell B2 on the MyLinks sheet.
By combining AVERAGE and LARGE in a formula, you can find the average for the top
3 numbers.
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 148
The numbers {1,2,3} could be typed as an array in the formula, as they are in cell D2:
=AVERAGE(LARGE(B1:B6,{1,2,3}))
If you need a bigger array of numbers, you wouldn't want to type all of them. Instead,
you could use the ROW function, as in the array-entered formula in cell D3:
=AVERAGE(LARGE(B1:B6,ROW(1:3)))
A third option is to use the ROW function with INDIRECT, as in the formula in cell D4,
which is also array-entered:
=AVERAGE(LARGE(B1:B8,ROW(INDIRECT("1:3"))))
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 149
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 150
What Next?
You've now covered 30 Excel Functions in 30 Days, from the Text, Information and
Lookup and Reference categories, and you're probably eager to learn more.
Keep in Touch
Also, if you haven't already, you can follow me on Twitter (@ddalgleish), and find my
Contextures page and Pivot Tables page on Facebook.
Debra
www.contextures.com
30 EXCEL FUNCTIONS IN 30 DAYS – PAGE 151
Functions Index
ABS ........................................................... 69, 95 LEFT ...............................................................113
absolute reference ......................................... 11 LEN ............................................ 18, 38, 113, 135
ADDRESS ........................................ 97, 101, 138 LOOKUP ........................................ 79, 80, 81, 84
AND .................................................................. 6 MATCH .......................... 92, 93, 94, 95, 101, 120
AREAS ................................................. 14, 15, 16 MAX ........................................................69, 100
AVERAGE ...................................................... 148 MID .........................................................59, 113
CELL ............................................ 58, 59, 60, 118 MIN .........................................................95, 104
CHAR .......................... 41, 42, 43, 134, 142, 143 MMULT ...........................................................69
CHOOSE ................................ 27, 28, 29, 93, 104 MOD................................................................76
CLEAN ........................................................... 142 N............................................................107, 109
CODE ........................................................ 38, 42 OFFSET .................................... 69, 127, 128, 130
COLUMN ................................................ 69, 101 Operators ........................................................13
COLUMNS........................................... 62, 63, 69 OR .............................................................8, 112
COUNT.......................................................... 130 relative reference ...........................................11
COUNTIF ................................................. 51, 120 REPLACE ................................................124, 125
double unary ............................ 10, 88, 108, 113 REPT .................................................... 74, 76, 77
ERROR.TYPE ............................................. 83, 84 RIGHT ..............................................................38
EXACT ................................................4, 5, 6, 7, 8 ROUND ......................................................33, 34
FIND........................................ 59, 111, 112, 113 ROW ................................................67, 120, 148
FIXED .................................................. 32, 34, 35 SEARCH ............................................... 87, 88, 89
HLOOKUP ................................................. 54, 55 SMALL ...........................................................120
HYPERLINK.................................... 138, 139, 140 SUBSTITUTE .......................... 133, 134, 135, 143
IF................................5, 22, 38, 51, 84, 112, 113 SUM .................. 29, 63, 109, 128, 130, 145, 146
IFERROR.......................................... 87, 108, 111 T ......................................................................71
INDEX .... 16, 63, 67, 95, 100, 116, 117, 118, 120 TEXT ..........................................................33, 36
INDIRECT ........................ 99, 145, 146, 147, 148 TRANSPOSE ...............................................66, 69
INFO ................................................... 22, 23, 25 TRIM............................................ 18, 19, 20, 134
INT .................................................................. 76 TYPE ......................................................103, 104
ISERROR.......................................................... 84 UPPER ...............................................................7
ISNUMBER ........................ 88, 89, 108, 112, 113 VLOOKUP ................................ 48, 49, 51, 77, 94
ISTEXT ............................................................. 72 WEEKDAY ........................................................28
LARGE ........................................................... 148
www.contextures.com