50% found this document useful (2 votes)
815 views74 pages

Excel Formulas & Functions

This document provides an overview of formulas and auditing tools in Excel. It discusses formula syntax and reference types, common Excel errors and how to fix them, functions like IFERROR to handle errors, and keyboard shortcuts for navigating and editing worksheets. Tools covered include formula auditing options like trace precedents/dependents and evaluating formulas step-by-step. Tips are provided for writing robust formulas that account for errors or invalid references using techniques like IF statements and absolute cell referencing.

Uploaded by

Stefos Pepes
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
50% found this document useful (2 votes)
815 views74 pages

Excel Formulas & Functions

This document provides an overview of formulas and auditing tools in Excel. It discusses formula syntax and reference types, common Excel errors and how to fix them, functions like IFERROR to handle errors, and keyboard shortcuts for navigating and editing worksheets. Tools covered include formula auditing options like trace precedents/dependents and evaluating formulas step-by-step. Tips are provided for writing robust formulas that account for errors or invalid references using techniques like IF statements and absolute cell referencing.

Uploaded by

Stefos Pepes
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 74

SECTION 2:

FORMULAS 101

1
Formulas Ta b / A u d i t i n g To o l s

AUDITING TOOLS:
Trace Precedents/Dependents shows
which cells affect or are affected by the
value of the selected cell

Show Formulas displays all of the


formulas in the sheet as text

FORMULA LIBRARY: Evaluate Formula allows you to step


into a formula and determine the output
Includes a list of all common formulas, component
of each component
parts, and brief descriptions of how each formula works

2
Formula Syntax

All Excel formulas start with a


“=“ and can either be selected
from the formula library or
typed directly into the formula
bar
As you begin to type a formula, a pop-up will appear to guide you through each step, shown in bold

A1 A1:C4 A1,C4
Single-cell references describe a cell’s Array references describe a Non-contiguous references
location within a worksheet, in terms contiguous group of cells based on describe selections of individual cells
of the intersection between a column the location of the top-left (A1) and that do not share a common border,
(A through XFD), and a row (1 through the bottom-right (C4) cells, separated separated by a “,”
1,048,576) by a “:”

3
Reference Ty p e s

Hold the phone, how come some cell references include a “$”?

These are used to create Fixed, Relative, or Mixed References; the $ basically locks a
specific cell range or reference so that it does not change if you apply the formula to other cells

For Example:
$A$1 = Fixed column, Fixed row
A$1 = Relative column, Fixed row
$A1 = Fixed column, Relative row
A1 = Relative column, Relative row

PRO TIP:
Select part of your formula with the
cursor and use “F4” to quickly scroll
through reference types. ALWAYS
THINK ABOUT YOUR REFERENCES

4
Common Excel Errors

Error Type What it means How to fix it

Drag or double-click column border to increase width, or right-


###### Column isn’t wide enough to display values
click to set custom column width

Make sure that function names are correct, references are valid
#NAME? Excel does not recognize text in a formula and spelled properly, and quotation marks and colons are in place

Check that your formula isn’t trying to perform an arithmetic


#VALUE! Formula has the wrong type of argument
operation on text strings or cells formatted as text

Check the value of your divisor; if 0 is correct, use an IF statement


#DIV/0! Formula is dividing by zero or an empty cell to display an alternate value if you choose

Make sure that you didn’t move, delete, or replace cells that are
#REF! Formula refers to a cell that it not valid referenced in your formula

5
IFERROR Statement

The IFERROR statement is an excellent tool to eliminate annoying error messages


(#N/A, #DIV/0!, #REF!, etc.), which is particularly useful for front-end formatting

=IFERROR(value, value_if_error)
Formula or value (which may or may not result in an error) Value returned in the case of an error

In this case we’re replacing an error caused by =IFERROR(A1/B1,“Invalid Formula")


the A1/B1 formula with “Invalid Formula”, and
an error caused by a VLOOKUP function with “-” =IFERROR(VLOOKUP(A1,D1:E4,2,0),"-")

PRO TIP:
If you’re writing a formula that may trigger an error (i.e. a VLOOKUP where not all values
have a match), WRITE THE FULL FORMULA FIRST then wrap it in an IFERROR statement

6
Function Shortcuts

The F4 function is used for two helpful shortcuts:


A1
1) Adding or modifying cell reference types
With your cursor selecting any cell reference or array within a A$1 $A$1
formula, the F4 key will cycle through fixed, relative, and absolute
reference types $A1
2) Repeating your last command or action
F4 will also repeat the last user action, such as inserting/deleting rows or columns,
changing cell format or style, etc. (Note: F4 will not repeat entered values or formulas)

The F2 function displays the cell ranges that are tied to a given formula
PRO TIP:
Use F2 to help diagnose formula errors or make
quick adjustments to cell references and arrays

7
CTRL Shortcuts

The CTRL function can be combined with a variety of keys, such as:
1) CTRL- ARROW
Jumps to the left, right, top, or bottom edge CTRL-SHIFT-RIGHT ARROW
(i.e. last non-blank cell) of a contiguous data array

2) CTRL-SHIFT-ARROW
Extends a selection to the left, right, top, or bottom CTRL-SHIFT-DOWN ARROW

edge (i.e. last non-blank cell) of a data array

3) CTRL-PAGE UP/DOWN
Jumps between tabs of a workbook

FULL LIST: https://exceljet.net/keyboard-shortcuts

8
A LT Key Tips

The ALT function enables Key Tips, which allow you to access any function in
the ribbon using keyboard shortcuts (Note: you do not need to hold down ALT)

1) Press ALT to reveal


tab-level shortcuts:

2) Press the key for the tab you want


(i.e. H) to reveal additional shortcuts:

3) Continue to press shortcut keys PRO TIP:


(i.e. V) to drill into specific functions: Use ALT-H-V-V to paste as values
or ALT-H-V-F to paste as formulas

9
Command Shortcuts for Mac

Mac Shortcut Purpose PC Equivalent

Command-T Cycles between cell reference types F4

Command-Y Repeats the last user action F4

Control-U Displays cell ranges tied to a given formula F2

Command-Arrow Jumps to the edge of a contiguous data array CTRL-ARROW

Command-Shift-Arrow Extends a selection to the edge of a data array CTRL-SHIFT-ARROW

Command-Fn-Up/Down Jumps between workbook tabs CTRL-PAGE UP/DOWN

FULL LIST: www.exceljet.net/keyboard-shortcuts


10
Data Validation

Data Validation allows you to specify exactly what types of values a cell can contain
(i.e. whole numbers, positive integers, values from a list, etc.)

One of the most useful forms of data


validation is LIST, which creates a
drop-down menu of options based
on a source list that you specify:

(but the best part is that you can write your own
hilarious error messages) See, Excel can be fun!

11
Fixed vs. Volatile Functions

Volatile Functions are functions or formulas in Excel that change every time the
workbook recalculates (i.e. any time you enter data anywhere in any open workbook)

Handle with Care: Common volatile functions


include NOW(), TODAY(), RAND(), OFFSET() &
INDIRECT()

PRO TIP:
To control when Excel recalculates, change the Calculation Options
to “Manual” in the Formulas tab (just don’t forget you changed it!)

12
SECTION 3:
LOGICAL OPERATORS

13
Logical Operators - Intro

All Logical Operators in Excel are based on


simple “IF/THEN” statements:

-IF it’s raining, THEN bring an umbrella


-IF it’s sunny, THEN bring sunglasses
-IF it’s sunny AND it’s summer, skip work and go to the beach

Basically it just says “Hey Excel, if this statement is true,


return this value. Otherwise, return something else.”

14
IF Statements

=IF(logical_test, [Value if True], [Value if False])

Any test that results in either Value returned if logical Value returned if logical
TRUE or FALSE test is TRUE test is FALSE
(i.e. A1=“Google”, B2<100, etc)

= IF(B2<=0,“Yes”,”No”)
In this case we’re categorizing the Freeze column
as “Yes” if the temperature is equal to or below
32, otherwise “No”

15
Nested IF Statements

By using Nested IF Statements, you can include multiple logical tests


within a single formula:

= IF(B2<40,”COLD”,IF(B2>80,”HOT”,”MILD”))

If temp<40, climate = “Cold”, if temp>80,


climate = “Hot”, otherwise climate = “Mild”

16
AND/OR Statements

Excel’s AND and OR statements allow you to include multiple logical tests at once:

=IF(OR(F2=“Rain”,F2=“Snow”),“Wet",“Dry")
Here we’re categorizing conditions as “Wet” if the
precipitation type equals “rain” OR “snow”,
otherwise Conditions = “Dry”

=IF(AND(D2=“Yes”,C2>0),“Snow",IF(AND(D2=“No”,C2>0),“Rain",“None"))
If the temp is below freezing AND the amount of precipitation > 0, then Precip Type = “Snow”, if the temp is
above freezing AND the amount of precipitation >0, then Precip Type = “Rain”, otherwise Precip Type = “None”

PRO TIP:
When writing nested functions, copy/paste repetitive pieces and tweak
individual elements to save time (rather than starting from scratch)

17
NOT/<> Operators

If you want to evaluate a case where a logical statement is not true, you can use
either the NOT statement or a “<>” operator

=IF(NOT(C2=0),“Wet",“Dry")
=IF(C2<>0,“Wet",“Dry")

In both of these examples, we’re defining Conditions = “Wet” if the amount of precipitation is NOT equal to 0

18
IFERROR

The IFERROR statement is an excellent tool to eliminate annoying error messages


(#N/A, #DIV/0!, #REF!, etc.), which is particularly useful for front-end formatting

=IFERROR(value, value_if_error)

Formula or value that may or Value returned in the


may not result in an error case of an error

PRO TIP:
If you’re writing a formula that may trigger an error (i.e. a VLOOKUP where not all values
have a match), WRITE THE FULL FORMULA FIRST then wrap it in an IFERROR statement

19
IS Statements

Excel offers a number of different IS formulas, each of which checks whether a


certain condition is true:

ISBLANK = Checks whether the reference cell or value is blank


ISNUMBER = Checks whether the reference cell or value is numerical
ISTEXT = Checks whether the reference cell or value is a text string
ISERROR = Checks whether the reference cell or value returns an error
ISEVEN = Checks whether the reference cell or value is even
ISODD = Checks whether the reference cell or value is odd
ISLOGICAL = Checks whether the reference cell or value is a logical operator
ISFORMULA = Checks whether the reference cell or value is a formula

20
SECTION 4:
STATISTICAL FUNCTIONS

21
Basic Stats Functions

The Count, Average, Median, Mode, Max/Min, Percentile and Standard


Deviation/Variance functions are used to perform basic calculations on a data array

=COUNT(A2:A20)
=AVERAGE(A2:A20)
=MEDIAN(A2:A20)
=MODE(A2:A20)
=MAX(A2:A20)
=MIN(A2:A20)
=PERCENTILE(A2:A20,.25)
=PERCENTILE(A2:A20,.75)
=STDEV(A2:A20)
=VAR(A2:A20)

22
RANK/SMALL/LARGE

RANK(A2,A2:A8) = 2
RANK(A3,A2:A8) = 7 (lowest) The RANK function returns the rank of a
RANK(A4,A2:A8) = 6
particular number among a list of values
RANK(A5,A2:A8) = 1 (highest)
RANK(A6,A2:A8) = 4
RANK(A7,A2:A8) = 3
RANK(A8,A2:A8) = 5

LARGE(A2:A8,2) = 90
(the 2nd largest number in the array is 90)
The SMALL/LARGE functions return the
nth smallest/largest values within an array
SMALL(A2:A8,3) = 50
(the 3rd smallest number in the array is 50)

23
PERCENTRANK

PERCENTRANK returns the rank of a value as


a percentage of a given array or dataset

=PERCENTRANK(array, x)

What range of data Which value within the


are you looking at? range are you looking at?

PERCENTRANK($A$2:$A$19, A14) = 100% (highest)

PERCENTRANK($A$2:$A$19, A16) = 0% (lowest)

24
RAND/RANDBETWEEN

RAND() and RANDBETWEEN act like random number generators in Excel:

The RAND() function returns a random


value between 0 and 1 (to 15 digits)

The RANDBETWEEN function returns an


integer between two values that you specify

=RANDBETWEEN(0,100)

25
SUMPRODUCT

The SUMPRODUCT formula multiplies corresponding cells from multiple arrays and
returns the sum of the products (Note: all arrays must have the same dimensions)

=SUMPRODUCT(array1, array2 … array_N)


Example: Total Revenue

Without using SUMPRODUCT, you could multiply SUMPRODUCT(B2:B4,C2:C4) = $7.40


quantity*price in each row and sum the products

26
SUMPRODUCT

SUMPRODUCT is often used with filters to calculate products only for rows that meet
certain criteria:

Quantity of goods sold at Shaws:


SUMPRODUCT((A2:A17=“Shaws”)*C2:C17) = 16

Total revenue from Shaws:


SUMPRODUCT((A2:A17=“Shaws”)*C2:C17*D2:D17) = $21.80

Revenue from apples sold at Shaws:


SUMPRODUCT((A2:A17=“Shaws”)*(B2:B17=“Apple”)*C2:C17*D2:D17) =
$0.50

PRO TIP:
When you add filters to a SUMPRODUCT, you need
to change the commas to multiplication signs

27
SUMPRODUCT

Great, but how does it really work?


SUMPRODUCT((A2:A17=“Shaws”)*(B2:B17=“Apple”)*C2:C17*D2:D17) = $0.50

What YOU see

What EXCEL sees

When you apply a condition or filter


to a column, Excel translates those
cells as 0’s (if false) and 1’s (if true)

If you multiply all four columns,


ONLY ROWS THAT SATISFY
ALL CONDITIONS WILL
PRODUCE A NON-ZERO SUM

28
COUNTIF/SUMIF/AVERAGEIF

The COUNTIF, SUMIF, and AVERAGEIF formulas calculate a sum, count, or average
based on specific criteria
=COUNTIF(range, criteria)
=SUMIF(range, criteria, sum_range)
=AVERAGEIF(range, criteria, average_range)

Which cells need to Under what condition Where are the values
match your criteria? do I want to sum, count, that I want to sum or
or average? average?

COUNTIF(B2:B20,22) = 2
SUMIF(A2:A20,“Ryan”,B2:B20) = 190
SUMIF(A2:A20,“<>Tim”,B2:B20) = 702
AVERAGEIF(A2:A20,“Maria”,B2:B20) = 45.75

29
COUNTIFS/SUMIFS/AVERAGEIFS

COUNTIFS, SUMIFS, and AVERAGEIFS are used when you want to evaluate a
count, sum, or average based on multiple conditions or criteria
=COUNTIFS(criteria_range1, criteria1, criteria_range2 , criteria2…)
=SUMIFS(sum_range, criteria_range1, criteria1, criteria_range2 , criteria2…)
=AVERAGEIFS(average_range, criteria_range1, criteria1, criteria_range2 , criteria2…)

COUNTIFS(B2:B13,“Search”, D2:D13,“>200”) = 3
SUMIFS(D2:D13, A2:A13,“Feb”,B2:B13,“Display”) = 734
AVERAGEIFS(D2:D13, A2:A13,“Jan”,C2:C13,“MSN”) = 263

PRO TIP:
If you use < or >, you need to add quotation
marks as you would with text (i.e. “>200”)

30
SECTION 5:
LOOKUP/REFERENCE
FUNCTIONS

31
Named Ranges

Using Named Arrays can simplify a lookup function if you use the same
data array in multiple formulas

For example, if you name the array from A1:D6 “Apparel”…

…you can write your vlookup formula in either of


the following ways:

=VLOOKUP(A1,$A$1:$D$6,2)
=VLOOKUP(A1,Apparel,2)

32
VLOOKUP

Let’s take a look at one of Excel’s most common reference functions – VLOOKUP:

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

This is the value that This is where you Which column Are you trying to match the
you are trying to match are looking for the contains the data exact lookup value (0), or
in the table array lookup value you’re looking for? something similar (1)?

D2=VLOOKUP(A2, $G$1:$H$5, 2, 0)

To populate the Price in


column D, we look up the
name of the product in the
data array from G1:H5 and
return the value from the 2nd
column over
33
HLOOKUP

Use HLOOKUP if your table array is transposed (variables headers listed in rows)

=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])

This is the value that This is where you Which column Are you trying to match the
you are trying to match are looking for the contains the data exact lookup value (0), or
in the table array lookup value you’re looking for? something similar (1)?

D2=HLOOKUP(A2, $H$1:$L$2, 2, 0)
With an HLOOKUP, we search for the product name
in F1:J2 and return the value from the 2nd row down

34
Laws of Lookups

There are two key rules that constrain VLOOKUP and HLOOKUP formulas:

1. The lookup value must be in the first column of a


VLOOKUP table array or the first row of a HLOOKUP
table array

2. Excel will always return the value from the top most
row or left most column of a table array when
multiple instances of the lookup value are present

PRO TIP:
Avoid breaking Law #2 by identifying a “Key”
that is common to both datasets and is unique
for every row (NOTE: Keys often take the form
of a concatenation of multiple fields)

35
ROW/ROWS

The ROW function returns the row number of a given reference, while the ROWS
function returns the number of rows in a given array or array formula

=ROW([reference])
=ROWS(array)

ROW(C10) = 10
This example uses an array, which is why
it includes the fancy { } signs – more on ROWS(A10:D15) = 6
that in the ARRAY functions section
ROWS({1,2,3;4,5,6}) = 2

36
COLUMN/COLUMNS

The COLUMN function returns the column number of a given reference, while the
COLUMNS function returns the number of columns in a given array or array formula

=COLUMN([reference])
=COLUMNS(array)

PRO TIP: COLUMN(C10) = 3


Leave the cell reference out and just
write ROW() or COLUMN() to return the COLUMNS(A10:D15) = 4
row or column number of the cell in
which the formula is written COLUMNS({1,2,3;4,5,6}) = 3

37
INDEX

The INDEX function returns the value of a specific cell within an array

=INDEX(array, row_num, column_num)

What range of cells How many rows How many columns


are you looking at? down is the value over is the value you
you want? want?

INDEX($A$1:$C$5, 5, 3) = 234

In this case we’re telling Excel to find the value of a cell


somewhere within the array of A1:C5. Starting from the
upper left, we move down to the 5th row and right to the
3rd column, to return the value of 234

38
MATCH

The MATCH function returns the position of a specific value within a column or row

=MATCH(lookup_value, lookup_array, [match_type])

What value are you In which row or column Are you looking for the exact
trying to find the are you looking? (must be value (0), or anything close?
position of? a 1-dimensional array)
1: Find largest value < or = lookup_value
0: Find exact lookup_value
-1: Find smallest value > or = lookup_value

MATCH(“Pliers”,$A$1:$A$5, 0) = 4

MATCH(66,$A$3:$C$3, 0) = 3
Matching the word “Pliers” in column A, we
find it in the 4th row. Matching the number
66 in row 3, we find it in the 3rd column
39
INDEX/MATCH

INDEX and MATCH are commonly used in tandem to act like a LOOKUP function; the
only difference is that INDEX/MATCH can find values in any column or row in an array

Example: Price Checker In this example, we want to populate the price of a given product and
size in cell B10 by returning a particular value within the array B2:D4

B10=INDEX(B2:D4, MATCH(B6,A2:A4,0), MATCH(B8,B1:D1,0))

The number of rows down to index The number of columns over to


depends on what product I’m index depends on what size I’m
looking for, so we use a MATCH looking for, so we use a MATCH
function and search for the value in function and search for the value
cell B6 (in this case “Pants”) in cell B8 (in this case, “Medium”)

Considering the output of each MATCH function, the formula is just a simple INDEX:

B10 = INDEX(B2:D4, 3, 2) = $30


40
OFFSET

The OFFSET function is similar to INDEX, but can return either the value of a cell
within an array (like INDEX) or a specific range of cells

=OFFSET(reference, rows, columns, [height], [width])

What’s your How many How many If you want to return a


starting rows down columns over multidimensional array,
point? should you should you how tall and wide should it
move? move? be?
An OFFSET formula where [height]=1
and [width]=1 will operate exactly like an PRO TIP:
INDEX. A more common use of OFFSET Don’t use OFFSET or INDEX/MATCH when
is to create dynamic arrays (like the a simple VLOOKUP will do the trick
Scroll Chart example in the appendix)

41
SECTION 6:
TEXT FUNCTIONS

42
TRIM/UPPER/LOWER/PROPER

Text functions can be used to standardize formatting, particularly the TRIM, UPPER,
LOWER, and PROPER functions:

PRO TIP:
If two text strings are identical except one has a trailing space, they will look exactly the same
but Excel will treat them as completely different values; TRIM will make them equivalent

43
CONCATENATE

CONCATENATE allows you to combine text, cell values, or formula outputs into a
single text string
Note: Rather than typing “=CONCATENATE(Text1, Text2…)”, you can simply
separate each piece of the resulting text string with an ampersand (“&”)

44
LEFT/MID/RIGHT/LEN

The LEFT, MID, and RIGHT functions return a specific number of characters from a
location within a text string, and LEN returns the total number of characters

=LEFT(text, [num_chars])
=RIGHT(text, [num_chars])
=MID(text, start_num, num_chars)

45
TEXT/VALUE

The TEXT function converts a numeric value to text and assigns a particular format

=TEXT(value, format_text)

Numeric value, formula that evaluates to a numeric Numeric format as a text string enclosed in
value, or reference to a cell containing a numeric quotes (i.e. “m/d/yyyy”, “$0.00” or “#,##0.00”
value

=“Lisa earned ”&B4 returns “Lisa earned 3725”


=“Lisa earned ”&TEXT(B4“$#,###”) returns “Lisa earned $3,725”

PRO TIP:
Use VALUE to convert a text string that
represents a number into a value

46
SEARCH/FIND

The SEARCH function returns the number of the character at which a specific
character or text string is first found (otherwise returns #VALUE! error)

=SEARCH(find_text, within_text, [start_num])

What character or string Where is the text that Search from the beginning (default)
are you searching for? you’re searching or after a certain number of
through? characters?

PRO TIP:
The FIND function works exactly the same way, but is case-sensitive

47
IF(ISNUMBER(SEARCH

IF(ISNUMBER(SEARCH is powerful combination of functions that can be used to


classify data based on cells that contain specific strings of text

=IF(ISNUMBER(SEARCH(find_text, within_text)),value_if_true, value_if_false)

Searches for a specific string of Returns one value if that string is


text within a given cell found (TRUE), and another if it is
not found (FALSE)

=IF(ISNUMBER(SEARCH(“Disp”,A2)),”Display”,”Other”)
Search the cells in column A for the text string “Disp” and
classify column B as “Display” if you find it, “Other” if you don’t

48
SECTION 7:
DATE/TIME FUNCTIONS

49
Date Value

Every date in Excel has an associated date value, which is how Excel
calculates the passage of time (using midnight on 1/1/1900 as the starting point)

Excel recognizes most typed dates and automatically applies a common format
(i.e. m/d/yyyy), along with an associated date value (cell format → General)
Note: If you type a date in a format that Excel does NOT recognize, it will be treated as text
and there will be no associated date value; however, you can use a DATEVALUE or
TIMEVALUE function to convert unformatted dates or times into serial values

Jan 1,1900 is the first date with an assigned date value (1). Feb 6,
2015 is the 42,041st day since 1/1/1900, so its date value = 42041

Date values can also indicate fractions of days: 42041.5 translates to


noon on 2/6/2015 (50% through the day), and 42041.75 translates to
6:00pm on 2/6/2015 (75% through the day)

50
Date Formatting

To format dates in Excel, you can either select a preset option from the “Date”
category of the “Format Cells” dialog box, OR create your own custom format

You can build your own custom


Preset Formats: Custom Format:
formats using combinations of
date/time codes. For example:

d = day w/out leading zero (1-31)


dd = day w/ leading zero (01-31)
ddd = day-of-week (Sat)
dddd = day-of-week (Saturday)
m = month w/out leading zero (1-15)
mm = month w/ leading zero (01-15)
mmm = month abbreviation (Jan)
mmmm = full month (January)
yy = last 2 digits of year (15)
yyyy = full year (2015)

(full list available at


support.office.com)

51
Fill Series

When you drag the corner of a cell containing a date, Excel automatically
applies subsequent values automatically using Fill Series options:

Click the Auto Fill Options button to determine exactly which


values your subsequent cells should take:

Copy Cells = Repeats the same value in all cells

Fill Days = Increases the date by 1 day per cell

Fill Weekdays = Increases the date by 1 day per cell (excluding


weekends)

Fill Months = Increases the date by 1 month per cell

Fill Years = Increases the date by 1 year per cell

52
TODAY()/NOW()

The TODAY() and NOW() functions return the current date or exact time
Note: These are volatile functions, meaning that they change with every worksheet calculation

This is what the TODAY() and NOW() functions return at 5:15pm on


February 6, 2015. Note that these values will automatically update
with every change made to the workbook

PRO TIP:
Make sure to enter TODAY() and NOW() functions with both
parentheses included – these functions don’t refer to other cells

53
Serialization Formulas

Excel will always calculate dates and times based on their precise underlying
serial values, but what if you need to work with less-specific values, like
months instead of days, or hours instead of seconds?

The YEAR, MONTH, DAY, HOUR, MINUTE, and SECOND functions extract
individual components of a given date:

54
EOMONTH

Use the EOMONTH function to calculate the last day of a given month, or
to calculate the start/end dates of previous or future months

=EOMONTH(start_date, months)

Reference to the cell containing Number of months before or after the start/current date (positive
the start/current date number yields a date in the future, negative number yields a date in
the past

=EOMONTH(C2, 0)
=EOMONTH(C2, -1)+1
=EOMONTH(C2, 0)+1

55
YEARFRAC

YEARFRAC calculates the fraction of a year represented by the number of whole days
between two dates

=YEARFRAC(start_date, end_date, [basis])


Option specify the type of day count to use:
0 (default) = US (NASD) 30/360
Reference to the cell Reference to the cell
containing the start date containing the end 1 = actual/actual (RECOMMENDED)
date
2 = actual/360
3 = actual/365
4 = European 30/360

=YEARFRAC(B2, B3, 1) = 15.9% PRO TIP:


=YEARFRAC(B2, B3, 2) = 16.1% YEARFRAC is a great
tool for pacing and
projection calculations

56
WEEKDAY

If you want to know which day of the week a given date falls on, there are two
ways to do it:
1) Use a custom cell format of either “ddd” (Sat) or “dddd” (Saturday)
-Note that this doesn’t change the underlying value, only how that value is displayed

2) Use the WEEKDAY function to return a serial value corresponding to a


particular day of the week (either 1-7 or 0-6)

=WEEKDAY(serial_number, [return type])

This refers to a cell 0 (default) = Sunday (1) to Saturday (7)


containing a date or time 1 = Monday (1) to Sunday (7)
3 = Monday (0) to Sunday (6)

57
WORKDAY/NETWORKDAYS

WORKDAY returns a date that is a specified number of days before or after a given start
date, excluding weekends and (optionally) holidays; NETWORKDAYS counts the
number of workdays between two dates:

=WORKDAY(start_date, days, [holidays])

This refers to the cell Number of days before Optional reference to


containing the start date or after start date a list of holiday dates

=NETWORKDAY(start_date, end_date, [holidays]) =WORKDAY(B2, 20) = 1/29/2015


=NETWORKDAYS(B2, B3) = 42
This refers to the cell This refers to the cell Optional reference
containing the start date containing the end date to a list of holiday
dates

58
DATEDIF

DATEDIF calculates the number of days, months, or years between two dates

=DATEDIF(start_date, end_date, unit)

Reference to the cell Reference to the cell How do you want to calculate the difference?
containing the start date containing the end
“D” = # of days between dates
date
“M” = # of months between dates
“Y” = # of years between dates
“MD” = # of days between dates, ignoring months and years

=DATEDIF(B2, B3, “D”) = 58 “YD” = # of days between dates, ignoring years


“YM” = # of months between dates, ignoring days and years
=DATEDIF(B2, B3, “MD”) = 27

PRO TIP:
If you only need to calculate the # of days between dates, just use subtraction

59
SECTION 8:
FORMULA-BASED
FORMATTING

60
Formula-Based Formatting

If you want to go rogue, you can adjust the style of existing


conditional formats or create your own formula-based rules

This is where you can add, clear, and


manage your conditional formatting rules

61
Formula-Based Formatting

In this example we’re formatting the cells in columns B


through H with a green fill and bold text, but only when the
state name is equal to the value in cell $C$2
Note that the row label is relative (no “$”), which allows us to
apply this formatting to other rows without losing functionality

62
SECTION 9:
ARRAY FUNCTIONS

63
Array Functions - Intro

Array functions perform multiple calculations on one or more items in an array, and can
take the form of either a single-cell formula (which exists within one cell) or a multi-cell
formula (which can be applied to a number of cells and return multiple results)

You must press CTRL-SHIFT-ENTER to enter, edit, or delete an array formula; this
automatically adds brackets “{ }” to indicate that the function applies to an array

If you select D2:D5, type “=B2:B5*C2:C5” and hit If you select D2:D5, type “=B2:B5 * C2:C5” and
ENTER, the formula will only be applied to cell D2 hit CTRL-SHIFT-ENTER, you have created an
array formula applied to all cells in the range

64
Array Functions - Rules

When you work with array functions, you must obey the following rules:

1. You must press CTRL-SHIFT-ENTER (C-S-E) to edit or


enter an array formula

2. For multi-cell array functions, you must select the range


of cells before entering the formula

3. You cannot change the contents of any individual cell


which is part an array formula

4. You can move or delete an entire array formula, but not


a piece of it (so you often have to delete and rebuild)

5. You cannot insert blank cells into or delete cells from a


multi-cell array formula

65
PROS & CONS

Array functions can be incredibly powerful, but also a total buzzkill to work with;
here are some of the key pros and cons of using them:

PROS CONS
-Condenses multiple calculations into one -Can be very difficult to modify or delete
formula, often reducing file size existing array formulas

-Can perform some complex functions that -Limited visibility into the formula’s function,
non-array formulas cannot especially for users who are not familiar with
arrays
-Reduces the risk of human error such as
accidentally deleting parts of arrays or -Eliminates the option to modify cells
mistyping formulas contained within arrays

-May reduce processing speed if multiple array


functions are used

66
Array Constants

Array constants are created by manually entering a list of items directly into the
formula bar and manually surrounding the list with brackets ({ })

Horizontal array constants create an array contained


within a single row, and are delimited by commas (i.e.
Select A1:D1, type “={1,2,3,4}” then hit C-S-E)

Vertical array constants create an array contained


within a single column, and are delimited by semicolons
(i.e. Select A1:A4, type “={1;2;3;4}” then hit C-S-E)

Two-dimensional array constants create an array


contained across multiple rows and columns (i.e. Select
A1:D2, type “={1,2,3,4;5,6,7,8}” then hit C-S-E)

67
Array Constants in Formulas

Array constants can contain values, text (surrounded by “ ”), logical values (TRUE,
FALSE), or error values (#N/A), and can be used as part of an array formula

{=SUM(A1:A5 * {1;2;3;4;5})} = 70
This function takes each value in the array
A1:A5 and multiplies it against the
corresponding value in the array constant
{1;2;3;4;5}, which essentially translates into
Array constant the following formula: =SUM(A1*1, A2*2,
Function
Operator A3*3, A4*4, A5*5)
Stored
array

PRO TIP:
You manually add the brackets when you type array
constants, but the additional brackets surrounding the entire
formula are automatically added once you press C-S-E

68
Named Arrays

Just like normal cell ranges, array constants can be assigned a name using Excel’s
name manager, which can make them much easier to work with

Select “Define Name” (or Name Manager → New) from the Formulas tab

Now if you select A1:C1, type “=Quarter1” and press


CTRL-SHIFT-ENTER, the saved array will populate In the New Name dialog box, enter the array
constant (remembering to manually include the
brackets), give it a name, and select OK

69
TRANSPOSE

The TRANSPOSE function allows you to change the orientation of a given data array
(i.e. from 5 rows x 2 columns to 2 rows x 5 columns)
NOTE: The range in which you enter a TRANSPOSE function must be the exact
dimensions of the transposed data

{=TRANSPOSE(array)}

Select A9:E10, type “=TRANSPOSE(A3:B7)” and press


CTRL-SHIFT-ENTER to copy the transposed data

PRO TIP:
To transpose a data set that you may want to later
edit, just use Paste Special → Transpose (ALT-H-V-T)

70
SECTION 10:
BONUS/BADASS
FUNCTIONS

71
INDIRECT

The INDIRECT function returns the reference specified by a text string, and can be used
to change a cell reference within a formula without changing the formula itself

=INDIRECT(ref_text, [a1])

Which cell includes the Is your text string in A1 format (1) or R1C1 format (0)?
text that you are
evaluating?

In the first ROW function, Excel


ROW(B3) = 3 returns the row number of cell B3,
regardless of what value it contains.
ROW(INDIRECT(B3)) = 1 When you add INDIRECT, Excel sees
ROW(INDIRECT(B4,0)) = 1
that cell B3 contains a reference (B1)
and returns the row of the reference

72
INDIRECT (cont)

Let’s be real, the INDIRECT function is pretty confusing at first. Here are a few more
examples that should give you a sense of how it works and why it can be useful:

SUM(D2) = 0
SUM(INDIRECT(D2)) = 16
The sum of “B3:B5” as a value doesn’t make sense, but the sum of
B3:B5 as a reference is valid – INDIRECT tells Excel to recognize
that the cell you’re referring to is a reference, not a value

VLOOKUP(“A”, D4, 2, 0) = #N/A


VLOOKUP(“A”, INDIRECT(D4), 2, 0) = 5
INDIRECT will tell a VLOOKUP formula to use an array contained within
a cell, rather than treat the cell itself as the array (which returns #N/A)

73
HYPERLINK

HYPERLINK creates a shortcut that links users to a document or location within a


document (which can exist on a network server, within a workbook, or via a web
address)
=HYPERLINK(link_location,[friendly_name])

Where will people go if they How do you want the link to


click? read?

=HYPERLINK(”http://www.example.com/report.xlsx”, “Click Here”)


=HYPERLINK(“[C:\My Documents\Report.xlsx]”, “Open Report”)
=HYPERLINK("#Sheet2!A1”)
PRO TIP:
Use =HYPERLINK("#'"&A2&"'!A1") to jump to
cell A1 of the sheet name specified in A2 (note
the extra single quotation marks!)

74

You might also like