Sunteți pe pagina 1din 48

Function Description

NOW() Returns current date and time


YEAR(serial_number) Returns the year in year format
DAY(serial_number) Returns the day of the month
Calculates the number of days btween
DAYS360(start_date;end_date;method)
two dates
WEEKDAY(serial_number;return_type) Returns a number between 1 and 7
DATE(year,month,day) Returns the date in date format
DATEVALUE(date_text) Returns de date in date format
HOUR(serial_number) Returns in figures from 0 to 23
TIMEVALUE(time_text) Converts a time in text into figures
TODAY() Returns current date
Returns the number of the month in
MONTH(serial_number) the range 1(January) to 12
(December)
Returns the minute in the range 0 to
MINUTE(serial_number)
59
Converts hours, minutes and seconds
TIME(hour;minute;second)
given in figures
Returns the second in the range 0 to
SECOND(serial_number)
59

In detail:

Date and time functions (I)


NOW() Function
This function returns the sysem's current date and time in date and time format.
Example: =NOW() returns 09/09/2004 11:50

YEAR Function(serial_number)
This function has as it parametre a numerical value and returns the year in year format in
the range 1900-9999.
Example: =YEAR(38300) returns 2004. We could pass the reference to a cell that contains
a date instead of a numerical value:=YEAR(B12) also returns 2004, if in cell B12 I have the
value 01/01/2004.

DAY Function(serial_number)
Returns the day of the month that corresponds to the numerical value given.
Example: =DAY(38300) returns 9.

1
360DAYS function(start_date;end_date;method)
It calculates the number of days between two given dates on a 360 days per year
basis.The initial and final date paremetres should be introduced by means of the function
Date(year;month,day). The parametre for method is logical (true, false), V --> European
method, F or omitted--> American method.*
European Method: The initial or final dates that correspond to the 31st of the month
become the 30th of the same month.
American method: If the initial date is the 31st of the month, it becomes the 30th of the
same month. If the last date is the 31st of the month and the initial date is before the 30th, the
final date becomes the 1st of the following month; otherwise the final date becomes the 30th
of the same month.

Example: =DAYS360(date(1975;05;04);Date2004;05;04)) returns 10440.

WEEKDAY Function(serial_number;return_type)
It returns a figure between 1 and 7 that indicates the day of the week, with the type
parametre you can specify from which day the week starts. In the American style we will enter
type=1 (Sunday=1 and Saturday=7), for Eurpean style we will enter type=2 (Monday=1 and
Sunday=7).
Example: =WEEKDAY(38300;2) returns 2.

DATE Function(year;month;day)
Returns the date on date format. This function is particularly useful to indicate the full date
in cells where we have data of the day, month and year separate.*
Example: =DATE(2004;2;15) returns 15/02/2004.

DATEVALUE Function(date_text)
It returns the date in date format converting it in text format as parametre. The date as
parametre must have the style "day-month-year". *
Example: =DATEVALUE("12-5-1998") returns 12/05/1998

Date and time functions (II)


HOUR Function(serial_number)
It returns the time in figures from 0 to 23
Example: =HOUR(0,15856) returns 3.

TIMEVALUE Function(time_text)
It converts an hour in text in an Excel numerical value for an hour.

2
Example: =TIMEVALUE("12:35:20") returns 0,5245...
Note: To see the number as an hour (12:35:20), remember that you have to select the cell
and in the Format menu, click Cells, and in the tab * Number select Hour in the box
Category .

TODAY() Function
It returns the current date in date format.
Example: =TODAY() returns 09/09/2004.

MONTH(serial_number) Function
It returns the month number in the range 1 (January) to 12 (December) according to the
numrical value passed by the paremetre.
Example: =MONTH(35400) returns 12.

MINUTE(serial_number) Function
It returns the minute in the range 0 to 59 according to the numerical value passed as
parametre.
Example: =MINUTE("16:20:00") returns 20.

TIME(time;minute;second) Function
It converts hours, minutes and seconds given as figures in an Excel numerical value in hour
format.
Example: =TIME(16;20;00) returns 0,64.

SECOND(serial_number) Function
It returns the second in 0 to 59 range according to numerical value passed as parametre.
Example: =SECOND("12:20:40") returns 40.

3
Exercise on Time and Date function:

Please, open Excel2003, if it isn't already opened, so you can do the exercise.
2 Go to cell A1 and press on, select date and time category and choose function NOW().
3 Press the button OK.
A dialog box indicating that the function has no arguments will appear.
4 Press again on OK.
4 Go to B2 and type today's date in figures. Ex. 5
5 Go to cell B3 and type the current month in figures. Ex. 8
6 Go to cell B4 and type the current year in figures. Ex. 2004
7 Go to cell C5 and press on, choose function DATE() and press the button OK,
8 Select as arguments cells B4 --> for year, B3 --> for month and B2 --> for day, press OK.
You are going to calculate your age.
9 Go to cell D1 and type your date of birth in format (day/month/year)
10 In cell E1 type =TODAY()
11 In cell E2 select function DAYS360, as initial date cell D1 (date of birth), as final date
E1 (today) and in method type True.
The result shows the number of days gone by since the date D1 and the date E1.
12 Now in cell F3 type =E2/360 to obtain the years.
The result shows decimal fractions, to get an integer number we can use the function
=INT(E2/360).
We have used four of the most commonly used functions that offer many possibilities.
13 Save your workbook in My documents folder in the hard disc with the name
Functions with dates.
14 Close the workbook.

TEXT FUNCTIONS:

Text functions
Spreadsheets are designed to be used with figures. But Excel also has a number of
specific functions for the manipualtion of texts.
These are all the text functions offered by Excel.

Function Description
Returns the character
CHAR(number) specified by the
number

4
Returns the ASCII
CODE(text) code of the first
character of the text
Returns a chain of
CONCATENATE(text1;text2,...;textN) characters with the
union
Rounds (up or
FIXED(number;decimals;no_commas) down*) a figure
passed as parametre
Returns the number
RIGHT(text;num_chars) of characters
specified
Returns the initial
SEARCH(find_text;within_text;start_num) position of the text
searched
Removes all spaces
between words
TRIM(text) except for single
spaces between
words
Returns the
MID(text;start_num;num_chars) characters indicated
in a chain
Finds a chain inside a
FIND(find_text;within_text;start_num)
text
Returns a logical
value (true/false).
EXACT(text1;text2) Check whether two
texts are strictly the
same
Returns the number
LEFT(text;num_chars) of characters
specified
Returns the length of
LEN(text)
the text
Cleans the text, gets
CLEAN(text) rid of characters that
can't be printed
Converts into capital
UPPER(text)
letters
Converts into small
LOWER(text)
letters (lower case)
Converts into
DOLLAR(number;decimals)
currency
Converts into capital
PROPER(text)
the first letter of a text
Replaces part of a
REPLACE(old_text;start_num;num_chars;new_text)
text chain for another

5
REPT(text;number_times) Repeats the text
Substitutes a text for
SUBSTITUTE(text;old_text;new_text;instance_num)
another
Checks up that the
T(value)
value is text
Converts a value in
TEXT(value;format_text)
text
Converts a number in
BAHTTEXT(number)
Thai text (Baht)
Converts a text in a
VALUE(text)
number

Details:

CHAR(number) Function
It returns the character specified by the corresponding code number in the ASCII character
code.
Example: =CHAR(76) returns L

CODE(text) Function
This function returns the ASCII code of the text first character passed as parametre.
Example: =CODE("L") returns 76

CONCATENATE(text1;text2;...;textN) Function
Returns a chain of characters with the union of text passed as parametre. This function is
useful when we have a text like a person's complete name that is divided into different cells
and we want to have it all in one cell.
Example: =CONCATENATE("Antonio ";"Gutierrez ";"Fernandez " ) returns Antonio
Gutierrez Fernandez

FIXED(number;decimals;no_comas)
Rounds (up or down) a number passed as parametre to the decimals indicated and returns
the result in text format. The last option is a logical parametre (TRUE, FALSE), if it is omitted it
takes a FALSE value, it will show the dots that separate the thousands.
Example: =FIXED(4005,75;3) returns 4.005,750 y =FIXED(4005,75;3;TRUE) returns
4005,750

RIGHT(text;num_chars)
It returns the text chain, the number of characters especified starting the count from the end

6
of the text.
Example: =RIGHT("Blessed be those who study Excel...";12) returns "udy Excel..."

SEARCH(find_text;within_text;start_num) Function
Returns the initial position of the text searched inside a text, starting the search form
position numb_initial. In contrast with the FIND function it distinguishes capital from small
letters and does not admit joker characters.
Example: =SEARCH("Wally";He's alsways looking for new adventures this Wally and
always lost, please, help me to find him";1)
returns 40, which is the position where the word Wally begins.

TRIM(text) Function
Returns the same text but getting rid of spaces that are not single spaces between words.
Example: =TRIM("At a certain place in La Mancha...") returns "At a certain place in La
Mancha..."

MID(text;start_num;num_chars)
Returns the characters indicated in a text chain from the initial position.
Example: =MID("Watching the sea, an intense emotion takes hold of me...";12;3)
returns "sea"

FIND(find_text;within_text;start_num)
It searchs for a text inside another text and returns the position of the text searched. It
performs the search reading the text from left to right, from the initial position indicated in
numb_initial. In contrast with the function SEARCH, FIND does not distinguish between
capital and small letters and admits joker characters (? just one character, * any number of
characters, scape character).
Example: =FIND("Sea";"Watching the sea, an intense emotion takes hold of me...";1)
returns 12
=FIND("W?r";"Watching the sea, an intense emotion takes hold of me...";1) returns 1
EXACT(tex1;tex2) Function
It returns a logical value (true/false) depending on whether both text chains are the same
or not.
Example: =EXACT(" this is the same?";" is this the same?") returns FALSE
It is normally used to compare the values stored in two cells.
LEFT(tex;num_chars) Function
It returns the number of characters specified from the beginning of the text chain.
Example: =LEFT("The sun can not compete with the brightness of your gaze";6)
returns "The sun"

7
LEN(text) Function
It returns the number of characters that the text chain has, that is its length.
Example: =LEN("The sun can not compete with the brighteness of your gaze")
returns 51

CLEAN(text) Function
It gets rid of character that can not be printed.
Example:If you type in a cell:=CHARACTER(7)&"This text is valid"&CHARACTER(7) in
the cell you would see this: if you type
=CLEAN(CHARACTER(7)&"This text is valid"&CHARACTER(7)), the characters that can
not be printed will disappear and you will see:

UPPER(text) Function
Converts into capital letters a text chain.
Example: =UPPER("converts to capital") returns "CONVERTS TO CAPITAL"

LOWER(text) Function
Converts to small letters a text chain.
Example: =LOWER("COME ON NOW SMALL LETTERS") returns "come on now small
letters"

DOLLAR(number;decimals)
It converts to text a number using currency format.
Example: =DOLLAR(25;2) returns "25,00 € "

PROPER(text) Function
It converts the first letter of each word of a text into capital letters, the rest of the word into
small letters.
Example: =PROPER("antonio manuel ramiro") returns "Antonio Manuel Ramiro"

REPLACE(old_text;start_num;num_chars;new_text) Function
It replaces part of a text chain for another.
Example: =REPLACE("If this is the original text, it will be modified";21;8;"Into this")
returns "If this is the text Into this, will be modified"

REPT(text;num_times)
It repeats a text a previuosly fixed number of times.

8
Example: =REPT("You repeat yourself";5) returns "You repeat yourself You repeat
yourself You repeat yourself You repeat yourself You repeat yourself"

SUBSTITUTE(text;old_text;new_text;instance_num) function
Substitutes in the text, an original text_ for new text_.
Example: =SUBSTITUTE("The price for the whole project implies..."; "price"; "cost")
returns "The cost for the whole project implies..."

T(value) function
It checks whether the value is text and returns text if it is or double inverted comas if it isn't.
With this function you can eliminate the values in a cell that aren't text.
Example: =T("This is text") returns "This is text"

TEXT(value;format_text) function
It converts a value in text.
Example: =TEXT(25;"0,00 €") returns "25,00 €"

BAHTTEXT(number)
Converts a number in thai (Baht) text.
The baht format can be changed into a different style used. Regional configuration or
Regional options in the Windows Control panel .
Example: =BAHTTEXT(25) returns figure 25 in letter but in Thai.

VALUE(text) function
Converts a text that represents a figure in a figure.
Example: =VALUE("254") returns 254 numerical format.

Exercises:

Please, open Excel2003, if it isn't already opened, so you can do this exercise.
2 Go to cell A1 and press , select Category Text and chose CODE() function, press OK.
3 Type as argument for that function letter a and press Enter.
You will obtain code 97, this is the number asigned to the letter a. Now we are going to
check whether that is correct using the CHAR() function.
4 Go to cell B1 and press on , select the Category Text and select the CHAR().
5 As argument type 97. As you can see, Excel returns exactly the letter "a".
6 Go to cell B2 and type "Today is ". Make sure that you leave the blank spaces
7 Go to cell B3 and type " January ". Make sure you leave the blank spaces.

9
8 In cell B4 type 22 and in cell B5 type 2004.
Now we are going to create a concatenated phrase in several cells.
9 Go to cell C5 and press on , select the Category Text
10 Select CONCATENATE() function and as arguments type, in the first argument B2, in
the second B4, as a third argument type " of", as fourth argument type B3, as fifth argument
type "of " and as last argument type B5.
11 In order to have the date in only one cell the function must look like this
=CONCATENATE(B2;B4;" of";B3;"of ";B5) *.
Now we are going to use the PROPER() function that is also very useful to format a text
chain.
12 Go to cell A5 and type "john" in cell B5 type "adam" and in cell C5 type "smith". Do
not type capital letters.
13 Now in cell D5 press on , select category Text, select the CONCATENATE() function
press OK and choose as parametres A5, B5 and C5. You must add the spaces to separate
the complete name. The formula must look like this =CONCATENATE(A5;" ";B5;" ";C5).
Now that you have the full name in one cell, you can use the PROPER() function.
14 Go to cell G5 and select the PROPER() function and pass it as parametre cell D5.
You must get in cell G5 John Adam Smith. The initials have been converted into capital
letters.
15 Save the workbook in My documents folder in the hard disc, with the name Text
functions.
16 Close the workbook.

Search Funtions:

In an Excel sheet it is very important to get the correct data with which to work with the
designed formulas. For this there exists a specific group of functions with which to perform
data searches.
We understand that a search in itself is when we want to find some kind of information, we
do not look for it directly as the data is unknown to us, and so we perform a search of a
property or something similar that is know to us to possibly contain what it is that we are
looking for. Eg if we are looking for a person we describe their physical aspect, while if we are
looking for the tel. number of a restaurant we search in the tel. book for the name of the
restaurant. The data that we are looking for is normally unknown to us, but we are able to
search for it by using data that is known to us.

These are the availible options in Excel to perform searches:


Función Descripción
Returns the number of
AREAS(reference)
areas in a reference
Searches for the values
LOOKUP(...) of a range in a column
or file.

10
Searches for a value in
the top row of a table or
an array of values, and
then returns a value in
HLOOKUP(lookup_value,table_array,row_index_num,range_lookup) the same column from
a row you specify in the
table or array
Searches for a value in
the leftmost column of
a table, and then
VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) returns a value in the
same row from a
column you specify in
the table
Returns the relative
position of an item in an
MATCH(lookup_value,lookup_array,match_type) array that matches a
specified value in a
specified order
Returns the column
COLUMN(reference)
number of a reference
Returns the number of
COLUMNS(array) columns in an array or
reference.
Returns a range
OFFSET(reference;rows;columns;height;width)
reference
Creates a cell address
as text, given specified
ADDRESS(row_num,column_num,abs_num,a1,sheet_text)
row and column
numbers.
Uses index_num to
return a value from the
list of value arguments.
CHOOSE(index_num;value1;value2;...) Use CHOOSE to select
one of up to 29 values
based on the index
number
Returns the row
ROW(reference)
number
Returns the number of
ROWS(array)
rows
Creates a direct access
HYPERLINK(link_location;friendly_name)
to a document
Extracts data stored in
GETPIVOTDATA(data_field;pivot_table;field1;element1;field2;element2...) a pivot table.
Returns a value or the
reference to a value
INDEX(array,row_num,column_num)
from within a table or
range.
INDIRECT(ref_text;a1) Returns the reference

11
specified by a text
string. References are
immediately evaluated
to display their
contents.
Returns a vertical
range of cells as a
TRANSPOSE(array)
horizontal range, or
vice versa.

Details

Functions that search for a value(I)


AREAS function (ref)

Returns the number of classes of adjacent or single cells of a reference.


Example: =AREAS(A1) returns 1, and there is only one area.

LOOKUP function (...)


This function searches for a value in a range of a column, a row, or a matrix. You need to
indicate the value to search for, where you want to search for it, and where you want to obtain
the result.

Example: In column B we have a list of freinds' names, and in column C their e-mails. In
cell A1 we write the name of the freind who's e-mail we are searching for. In cell E1 we select
the LOOKUP function, and we insert the following parametres:

"search_value= A1", "comparation_vector= B:B" and "result_vector = C:C". It will return to


us the e-mail related to the person being searched.

HLOOKUP function (lookup_value,table_array,row_index_num,range_lookup)


Searches the first row of the table or matrix of values, and returns the result in the same
column from a specific row.

Example: Lets imagine the same situation as before with a column with names and
another with the e-mails, and we now want it to tell us who is two places below a freind on the
list, or the e-mail that is found two rows below where we are currently looking. We use the the
HLOOKUP funcion with the following parametres.
"searched for_value= A1" "search_matrix_in= B:C" and "row_indicator=2" IT will return to
us the e-mail of the relevant person situated two rows below the search.

12
VLOOKUP function (lookup_value,table_array,col_index_num,range_lookup)
Search for a value in the first column to the left and return the value in the same row from a
specific column.
It has the same effect as the the previous function except that this function carries out the
search for columns.

MATCH function (lookup_value,lookup_array,match_type)


Returns the relative position of an element, which coincides with a value given in a
specified order within a matrix.
match_type is the number -1, 0, or 1 and specifies how the value being searched for
should coincide with the values within the search_matrix.
If type_of coincidence is 1, COINCIDE will find the highest value that is less than or equal
to the searched for_value. The values in the search_matrix need to be placed in ascending
order: ...-2, -1, 0, 1, 2; A-Z: FALSE; TRUE.
If type_of coincidence is 0, COINCIDE will find the first value that is exactly equal to the
searched for_value. The values in the search_matrix can be in any order.
If type_of coincidence is -1, COINCIDE will find the smallest value that is greater than or
equal to the value being searched for. the search_matrix values need to be placed in
descending order: TRUE; FALSE; Z-A; ...2; 1; 0; -1; -2; ... and so succesively.
If coincidence_type is omitted, it is presumed that it is 1.

Example: =MATCH(23;{"grapes";,23\"pears";45\"apples";55}) returns 2, which is the


position where the number 23 is found.

COLUMN function (reference)


Returns the column number of a reference.
Example: COLUMN(D:H) returns 4, because, the first column of the D:H matrix is the D
(column no. 4)

COLUMNS function (matrix)


Returns the number of columns that a matrix is composed of.
Example: =COLUMNS(A:C) returns 3, because, the matrix has 3 columns.

OFFSET(reference;rows;columns;height;width) function
Returns a cross-reference of the cells situated from a reference (ref) a few rows below
(nrows positive), or above (nrows negative), a few columns to the right (ncolumns positive),
or more columns to the left (ncolumns negative). The height and width parametres indicate
the number of cells that need to be recovered as from that point.

13
Example: =OFFSET(A1;2;3) returns the value situated 2 rows below, and 3 columns to
the right of cell A, that is, in cell D3.

=SUM(OFFSET(K4;-3;-1;3;2)) obtains the sum of the cells returned by the OFFSET


function. In this case the desref function returns the J1:K3 cells, to see this we look at how to
perform the function: from cell K4 we move 3 rows up (nfiles-3), and 1 column to the left
(ncolumns-1), we reach cell J1, as from this cell we take 3 rows (height 3) and 2 columns
(width 2), that is cells J1,J2,J3,K1,K2 AND K3, the desref function has returned to us the
range J1:K3.

ADDRESS(row_num,column_num,abs_num,a1,sheet_text) function
Creates a cell address as text, given specified row and column numbers.
Column_num is the column number to use in the cell reference.
Row_num is the row number to use in the cell reference.
abs_num specify the type of reference to be returned.
( 1 or omit returning the absolute reference
2 returns an absolute reference row, relative column.
3 returns a relative reference row, absolute column.
4 returns a relative reference
a1 is a logical value that specifies the style of the A1 or F1C1 reference.If a1 is TRUE or is
omitted, ADDRESS returns a a reference of the B3 style; if it's FALSE, ADDRESS will return
a reference of the F3C2 style (Row3Column2).

Sheet is text that specifies the name of the calculation sheet or that is used as an external
reference. If sheet is omitted, then no sheet name will be used.

Example: =ADDRESS(1;2) returns an absolute reference to ($B$1)


=ADDRESS(1;2;4) returns an absolute reference to (B1)
=ADDRESS(1;2;4;false) returns an absolute reference to (F1C2)
CHOOSE (index_num;value1;value2;...) function
Choose a value or an action from a list of value's using an index number.
Example: CHOOSE(3;"grape";"pear";"melon";"apple") returns "melon" which is in the
3rd position.

ROW (ref) function


Returns the row number of a reference.
Example: =ROW(A2:B5) returns 2, as the cell A2 is in the 2nd row.

14
ROWS (array) function
Returns the number of rows in a reference or array.
Example: =ROWS(A2;B5) returns 4

HYPERLINK (link_location;friendly_name) function

Create a direct access to a document saved in the hard drive or on the internet.
Example: =HYPERLINK("HTTP;www.teacherclick.com";"Teacherclick") creates a link
to our Web page.

GETPIVOTDATA (data_field;pivot_table;field1;element1;field2;element2...) function


Extracts data stored in a pivot table.

INDEX (matrix;row_num;column_num) function


Within a range specified by way of matrix, returns the value of the cell found at the
intersection of a specific row and column.
Example: =INDEX(A3:b7;2;1) returns the value of the cell found in the second row of the
matrix and in the first column, that is, A4.

INDIRECT (ref_text;a1) function


Returns the reference specified by a text value.
Example: =INDIRECT (A2) returns the link value of the cell A2 which is also a link. Let us
imagine that in cell B5 we have a value of 7 and in the cell A2 we have put B5, if we write the
function =INDIRECT(A2) it returns the value 7.

TRANSPOSE (array) function


Returns a vertical range of cells as a horizontal range, or vice versa
We have a row with the values 4 6 7 9, and with achieving this function.
Example: =TRANSPOSE(($A$1:$D$1) we will obtain the value 4 in a row, the value 6
in the next row of the same column etc.... as a result.
Note: The formula of the example must be introduced as a formula. We first need to select
the A2:A5 range starting with the formula's cell, pressing F2, and next
CTRL+SHIFT+ENTER. If the formula is not introduced as a formula, the only result is 1.

15
Exercise

Step by step exercise. Lookup functions.

Objective.
Practice the use of the functions availible to search for values in Excel2003.

Step by step
exercise.
1 If you do not have Excel2003 open, open it in order to perform the exercise.
2 Write in column B the names of 10 real or imagined persons, eg John, Paul, Joe,
Sally...Every one in a cell, but remember to keep them all in column B.
3 Now in column C write a telephone number next to each name that you introduced
before.
We are going to make use of the LOOKUP(), we will use the cell D5 to introduce the name
to search and cell D11 to harbour the telephone number of the person being searched for.
4 After this, situate yourself in cell D11 and clic on , select the search and reference
category and then the LOOKUP() function.
5 Click on OK.
6 In the lookup_value parameter introduce or select the cell D5, in lookup_vector write
"B:B"or select column B, and in the result_vector write "C:C" or select Column C.
7 Insert a value into cell D5, a value found in column B, and see what occurs. The
telephone number of the person should appear in cell D11.
We are now to use the TRANSPOSE() function, which you might find a little more
complicated.
Remember that to transpose implies changing the rows to columns and vice-versa. That is,
if we have data in a row, on transposing it we will have the data in a column.
8 Situate yourself in cell A15 and clic on , selecting the search and reference category
and then selecting the TRANSPOSE() function. Click on OK.
In the only parameter that will ask us for "Matrix" we should select the matrix of rows and
columns that we are going to transpose.
9 Select the matrix of B1:C10.
The formula is already complete, but we will see that we are advised of an value error, this
is due to the formula referring to a matrix and not to a single cell. In order for the transposition
to be properly executed we will need to repeat the folmula for each one of the cells to
transpose by following these next steps.
10 As from the cell of the formula (A15) it is included, by selecting the cells necessary to
cover the transposed matrix, that is, a matrix of 2 rows by 10 columns that correspond with

16
the matrix A15:J16, press F2 and continued with Ctrl+Shift+Enter. In this way the formula
will copy the rest of the cells and it will be properly executed..
11 Save the work book in the My exercises folder of the hard drive, naming it Search
functions.
12 Close the work book.

Financial functions.
Excel is one of the most powerful existing tools to work with financial information and
calculations, offering a wide range of pre-designed functions to create your own "savings bank
at home"
All of these functions are grouped in the Financial category.
We are going to study the wide range of financial functions offered to us by Excel:
Description
Function
and Example
Returns the
depreciation of
an asset for a
specified period
DB(cost,salvage,life,period,month) using the fixed-
declining
balance method.
Returns the
depreciation of
an asset for a
specified period
using the
DDB(cost,salvage,life,period,factor) double-declining
balance method
or some other
method you
specify.
Returns the
depreciation of
an asset for a
VDB(cost;salvage;life;start_period;end_period;factor;no_switch) specific period,
including partial
periods
Calculates the
interest paid
during a specific
ISPMT(rate,per,nper,pv) period of an
investment.
Returns the
number of
NPER(rate;pmt;pv;fv;type)
periods for an
investment
PMT(rate;nper;pv;fv;type) Calculates the

17
payment for a
loan based on
constant
payments and a
constant interest
rate.

Returns the
interest payment
for a given
period for an
investment
IPMT(rate;period;nper,pv;fv;type) based on
periodic,
constant
payments and a
constant interest
rate.
Returns the
payment on the
principal for a
given period for
an investment
based on
PPMT(rate,per,nper,pv,fv,type) periodic,
constant
payments and a
constant interest
rate.

Returns the
straight-line
SLN(cost,salvage,life) depreciation of
an asset for one
period.

Returns the
sum-of-years'
digits
SYD(cost,salvage,life,per)
depreciation of
an asset for a
specified period.

Returns the
interest rate per
RATE(nper;pmt;pv;fv;type;guess)
period of an
annuity.

IRR(values;guess) Returns the


internal rate of
an investment
for a series of

18
cash values

Returns the
MIRR(values;finance_rate;reinvest_rate) internal rate of
modified return
Returns the
actual value of
PV(rate;nper;pmt;fv;type) an investment
Returns the
future of an
investment
based on
periodic and
constant
FV(rate:nper;pmt;pv;type) payments plus a
fixed interest
rate

Returns the
actual net value
of an inversion,
from a discount
rate and a series
NPV(rate;value1;value2;...) of future
payments

DB (cost;residual_value;life;period;month) function
Returns the depreciation of an asset for a specified period, using the fixed salary declining
balance method.
Cost = is the initial value of the asset.
Salvage = is the final value after the depreciation of the asset.
Life = is the number of periods during which the depreciation of the asset takes place (also
known as usefull life)
Period = is the period over which you want the depreciation to be be calculated.
Month = is the number of months in the first year, if these are not specified, they are
assumed to be 12.
example:
We have bought a car for 20.000€, and we will suppose that in 5 years time the value of
the car will be 9.000€. We want to know what the depreciation will be 6 months after buying
it.
If we introduce the data DB(20000;9000;5;1;6) it should give us the result 1.480€, that is, 6
months after buying it, the car will be worth 18.520€..

19
DDB (cost;salvage;life;period;factor) Function
Returns the depreciation of an asset over a specific period, by way of the depreciation
method for double balance reduction or another specified method.
The double reduction depreciation method calculates the depreciation at a accelerated
value. The depreciation is higher during the first period, and reduces over succesive periods.
Cost = is the inicial asset value
Salvage = is the value at the end of the depreciation (sometimes called the salvage value
of the asset)
Life = is the number of periods over which the asset is being depreciated (sometimes
called the useful life of the asset).
Period = is the period over which the depreciation is calculated.
Factor = is the value at which the balance diminishes. If factor is omitted, it is assumed to
be 2 (the method of depreciation by double balance reduction.

Example:
We will continue with the example of the car.
Therefore if we introduce the data DDB(20000;9000;5;1) it should give us the result of
8.000€, in the first year of the cars sale it will be worth 12.000€

VBD (cost;salvage;life;start_period;end_period;factor;no_switch) function


Returns the depreciation of an asset for any period you specify, including partial periods,
using the double-declining balance method or some other method you specify.
VDB stands for variable declining balance.
Cost = is the inicial asset value
Salvage = is the final value of the asset after depreciation.
Life = is the number of periods over which the asset is depreciated (sometimes called the
useful life of the asset).
Initial_period = is the starting period for which you want to calculate the depreciation
Final_period = is the ending period for which you want to calculate the depreciation.
Factor = If factor is omitted, it is assumed to be 2 (the double-declining balance method).
Change factor if you do not want to use the double-declining balance method. For a
description of the double-declining balance method, see DDB.
No_Switch = is a logical value specifying whether to switch to straight-line depreciation
when depreciation is greater than the declining balance calculation.
If no_switch is TRUE, Microsoft Excel does not switch to straight-line depreciation even
when the depreciation is greater than the declining balance calculation.
If no_switch is FALSE or omitted, Excel switches to straight-line depreciation when
depreciation is greater than the declining balance calculation.

20
Example:
If we introduce the data VBD(5000;500;5*12;0;1) it should give us a result of 166.67€, that
is, in the first month of the assets sale it is worth 4833.33€(166,67€ less than when it was
bought).

ISPMT(rate,per,nper,pv) function

Calculates the interest payed during a specific investment period. This function is included
to provide compatibility with Lotus 1-2-3.

Rate = is the interest rate of the investment.


Period = is the period whose interest is being ascertained and needs to be comprised of
between 1 and the nper parameter.
nper = is the total number of payment periods.
va = is the actual value of the investment.

EG: for the ISPMT(8%/12;1;5*12;30000) the result should be -196.667, which is the
interest payed in the first month of a loan of 30.000€ over 5 years.

NPER (rate, pmt, pv, fv, type) function

Returns the number of payments of an investment, based on fixed and periodic payments
and a fixed rate of interest.

Rate =is the interest rate per period.


Pmt =is the payment made each period; it cannot change over the life of the annuity.
Typically, pmt contains principal and interest but no other fees or taxes.
Pv =is the present value, or the lump-sum amount that a series of future payments is worth
right now.
Fv= is the future value, or a cash balance you want to attain after the last payment is
made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
Type = is the number 0 or 1 and indicates when payments are due.

Eg: for the NPER(6%;-599,55;100000;0;0), function we should obtain 360, which is the
number of quotas for a loan of 10.000€ with an interest rate of 6% and a monthly quota of
599.55.

21
PMT(rate,nper,pv,fv,type)
Calculates the payment for a loan based on constant payments and a constant interest
rate.
This function is elaborated on more in the step by step exercises found at the end of this
page.

IPMT(rate,per,nper,pv,fv,type)
Returns the interest payment for an investment for a given period
This function is elaborated on more in the step by step exercises found at the bottom of
this page.

PPMT(rate,per,nper,pv,fv,type)
Returns the payment on the principal for a given period for an investment based on
periodic, constant payments and a constant interest rate.
This function is elaborated on more in the step by step exercises found at the end of this
page.

SLN function (cost;salvage;life)


Returns the straight-line depreciation of an asset for one period.
Cost = is the initial cost of the investment
Salvage = is the value at the end of the depreciation (sometimes called the salvage value
of the asset).
Life = is the number of periods over which the asset is depreciated (sometimes called the
useful life of the asset).
Eg: for the SLN(20000; 9000;5) function we should obtain 2.200€ which is the
depreciation in one year of the life of an asset.

SYD function (cost;salvage;life;per)


Returns the sum-of-years' digits depreciation of an asset for a specified period.
Cost = is the initial cost of the investment
Salvage = is the value at the end of the depreciation (sometimes called the salvage value
of the asset).
Life = is the number of periods over which the asset is depreciated (sometimes called the
useful life of the asset).
Period = is the period and must use the same units as life.

Eg: for the SYD(20000;9000;5;2) function we should obtain 2.933,33 € which is the
resulting depreciation over 2 years.

22
RATE (nper,pmt,pv,fv,type,guess) function
Returns the interest rate per period of an annuity. RATE is calculated by iteration and can
have zero or more solutions.

Nper is the total number of payment periods in an annuity.


Pmt is the payment made each period and cannot change over the life of the annuity.
Typically, pmt includes principal and interest but no other fees or taxes. If pmt is omitted, you
must include the fv argument.
Pv is the present value— the total amount that a series of future payments is worth now.
Fv is the future value, or a cash balance you want to attain after the last payment is made.
If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
Type is the number 0 or 1 and indicates when payments are due.
Eg: for the RATE(360;-599,55;100000) we should obtain 0%, which is the monthly interest,
to obtain the annual interest we need to multiply the value by 12, and then multiply the result
by 100 to get the percentage.

IRR function (values;guess)


Returns the internal rate of return of an investment for a set of values in cash.
These cash flows do not need to be constant, as in the case of an annuity. But the cash
flows need to occur at regular intervals like months or years. The internal rate of return
equals the rate produced by an investment project with payments (negative values) and
earnings (positive values) that occur in regular periods.

IRR syntax (values;guess)


Values = is a matrix or reference to a cell that contains the numbers with which it needs to
calculate the internal rate of return.
• The values argument needs to contain at least one positive value and one negative value
with which to calcuate the internal rate of return, if not, it will return the error #¡NUM!
• IRR interprets the order of the box flows according to the the order of value
argument.The values of the payments and earnings need to be correct.

Guess = is a number that is estimated that will approximate the IRR result. In most cases
it is not necessary to provide the estimate argument, it is assumed to be 0,1 (10%)

Eg:
For an investment table like the one seen below.

A B C D E F
1 Ingresos
2 Initial.Inv 1st year 2nd year 3rd year TIR TIR 2nd year

23
3 -60000 15000 20000 35000 7% -28%

Cell E3=IRR(A3:D3) and cell F3=IRR(A3:C3)

MIRR function (values;financing_rate;reinvestment_rate)


Returns the modified internal rate of return, for a series of periodic flows, declared cost of
the investment and interest to be returned on investing the cash.ctivo.

MIRR syntax(values;financing_rate;reinvestment_rate)

Values = is a matrix or a cell reference that contains numbers. These numbers represent a
series of payments (negative values) and earnings (positive values) that are performed in
regular periods.
The values argument should contain at least one positive and one negative value, in order
to calculate the modified internal rate. If not , TIM will return the error value #¡DIV/O!

Financing_rate = is the interest rate payed for the money used in the cash flow
Reinvestment_rate = is the interest rate obtained from the cash flows measured by their
reinvestment.

Eg:
For an investment table like the following:

A B C D E F G
1 Proceeds
Reinvestment
2 Initial.Inv 1st year 2nd year` 3rd year Interest rate TIRM
rate
3 -160000 20000 35000 56000 10% 15% -8%

Cell G3=MIRR(A3:D3;E3;F3)

PV function(rate;nper;payment;vf;type)
Returns the actual value of an investment. The actual value is the sum of a series of
payments to be made in the future.

PV syntax(rate;nper;payment;type)
RATE = is the interest rate per period

24
Nper = is the total of periods in an annuity
Payment = is the payment effected in each period and does not change during the life of
the annuity.
Vf = is the future value or balance in cash that you wish to obtain after effecting the final
page. If the vf argument is omitted, the value will be assumed to be zero. (a loan for example)
Type = is the number 0 (expiration of payments at the end of the period), or 1 (expiration at
the beginning of the period)

Eg: We plan to design a pension plan that will pay us 500€ monthly during 15 years. The
plan costs us 35.000€ and the money earns an annual interest of 10%. We use the VA
function to calculate whether it is worth it to make a retirement plan.

We therefore write the PV(10%/12;15*12;500), which should return -46.528,72 € which


appears in negative because it is the money that will be payed. And we can now see that it
would be worthwhile as the money invested was 35.000 € and we have a return of 46.528,72
€.

FV function(rate;nper;payment;type)
Returns the future value of an investment based on periodic payments and constants, with
a fixed interest rate.
Observations
Maintains uniformity in the use of the units with which the rate and nper arguments are
specified. If monthly payments are made to a 5 year loan with an annual interest of 10%, it
will use 10/12% for the rate argument and 5*12 for the nper argument. If annual payments
are made to the same loan, it will use 10% for the rate argument and 5 for the nper
argument.

FV syntax(rate:nper;va;type)
Rate = the interest rate for the period
Nper = is the total amount of payments of an annuity
Payment = is the payment made at every period, and can not be changed during the
validity of the annuity.
Va = is the actual value of the total quantity of a series of future payments. If the argument
is omitted, it is considerred 0 (zero)
Type = indicates when the pyments are overcome(0 final of the period, 1 beginning of the
period). If the argument is omitted, it is considerred 0 (zero)

Eg: We are planning to save money until a limited date and with a starting date. With an
initial deposit of 2000€ we know that the interest returned by our savings account is 7%,
every month we will deposit 100€ and we will wait for one year to see what result we will be
offered.

25
We use the FV(7%/12;12;-100;-2000) function and we obtain a result of 3.383,84 € which
is not bad as we have already profited 183,84 € in one year by doing nothing, just saving.

NPV(rate;value1;value2;...)
Returns the actual net value of the investment from a discount rate and a series of future
payments.

NPV syntax (rate;value1; value 2;.......)


Rate = is the discount rate during the period
Value 1; value 2....are the arguments 1 to 29 that represent the payments and earnings.
Value 1; value 2...should have the same duration and should occur at the end of each period.
NPV uses the value 1; value 2... to interprete the order of the box flows. Payment and
earnings values need to be introduced in the correct order.
Arguments consist of numbers, empty cells, logical values, are calculated, the arguments
that consist of error or text values that can not be translated to numbers are transferred
upward.
Observations
The NPV investment starts one period before the box flow date of value 1, and ends with
the final box flow of the list. The NPV calculation is based on future flow boxes. If the first
cash flow occurs at the beginning of the first period, the fisrt value should be added to the
NPV result, which is not included in the value arguments.

Eg: Let us consider an investment of 55.000 € and we will wait to receive the ingresses in
the next 5 years, the annual discount rate is 7%.

We have the following earnings table:


A B C D E F
1 Earnings
2 Initial Inv 1st year 2nd year 3rd year 4th year`5th year 5º Año
3 -55000 5000 8000 12000 14500 25000

We write the NPV(7%;B3:F3)+A3 function and we obtain -4.657 €, which tells us that we
have still not started to receive profits even though the profits have surpassed the initial
investent.

Excercise:

We are going to develop a practical example to calculate the payment of a loan based on
constant payments and a fixed interest rate.
1 If Excel2003 is not open, open it in order to perform the exercise.
To carry out this exercise we are going to use the PAYMENT function.

26
2 Click on the button on the formula bar.
The Insert function dialogue box will appear.
3 Select the Financial option fom the Select a category box.
4 Select PMT from the Select a function box.
The syntax of the PAYMENT function is PMT(rate;nper;pv;fv;type), we are going to
describe each one of its parameters.
rate = is the interest type of the loan.
nper = is the total number of payments of the loan.
pv = is the actual value of the total of the payments.
fv = is the future value or balance in cash that you wish to obtain after the final payment. If
fv is omitted, it is assumed to be 0, that is, after the final payment there is no outstanding
balance, which accurs when processing a loan.
type = indicates the expiration of the payments.
( type = 0 ) --> at the end of the period
( type = 1 ) --> at the beginning of the period
Now that we know the parameters needed by the function, we can create the example:

We are going to request a loan of 100,000 € over a period of 30 years, that is


30*12=360 no. of monthly payments at an interest of 6%.
So then, we already have an example of a loan.
5 Situate yourself in cell A1 and write Loan.
6 Situate yourself in cell A2 and write Rate
7 Situate yourself in cell A3 and write No. of payments
8 Situate yourself in cell A4 and write Type
9 Situate yourself in cell A5 and write Monthly quota
10 Situate yourself in cell B1 and write 100.000€
11 Situate yourself in cell B2 and write 6%
12 Situate yourself in cell B3 and write 360
13 Situate yourself in cell B4 and write 0
14 Situate yourself in cell B5 and write =PMT(B2/12;B3;B1;0;B4)
With this function we indicate that at the expiration of payments is realised at the end of
the period, and that once these payments are complete no more outstanding quotas exist.
We should obtain -599,55 € as a result ie. the monthly quota. The numbers appears as
negative as it is an amount being payed, eg deposits into savings accounts, loan quotas, are
represented by negative numbers; the cash that it receives is represented by positive
numbers.
With the PMT function we can also calculate how much money we need to deposit each
month in order to save X amount of money in X amount of years.

27
We will now calculate how we can save 30.0000€ in 5 years, with an interest rate of 6%.
15 Situate yourself in cell C1 and write Save
16 Situate yourself in cell C2 and write Annual rate
17 Situate yourself in cell C3 and write Years
18 Situate yourself in cell C4 and write Monthly deposit
19 Situate yourself in cell D1 and write 30.000 €
20 Situate yourself in cell D2 and write 6%
21 Situate yourself in cell D3 and write 5
22 Situate yourself in cell D4 and write PMT(D2/12;D3*12;0;D1)
As a result , we should obtain the amount of -429,98 €. in cell D4.
We are now going to calculate the interest payed over a period of time to a loan, eg the
interest in the first example.

To perform this exercise we need to use the IPMT function


This function has the following syntax IPMT(rate;per;nper;pv;fv;type)
rate = is the type of interest of the loan.
Per = specifies the period and must be in the range 1 to nper.
nper = is the total number of payment periods in an annuity.
Pv = is the present value, or the lump-sum amount that a series of future payments is
worth right now.

fv = is the future value, or a cash balance you want to attain after the last payment is
made. If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
type = is the number 0 or 1 and indicates when payments are due.
( type = 0 ) --> the end of the period
( type = 1 ) --> the start of the period

23 Situate yourself in cell E1 and write Loan


24 Situate yourself in cell E2 and write Annual rate
25 Situate yourself in cell E3 and write Interest on the quota no.
26 Situate yourself in cell E4 and write Amount of quotas
27 Situate yourself in cell E5 and write Interest
28 Situate yourself in cell F1 and write 100.000 €
29 Situate yourself in cell F2 and write 6%
30 Situate yourself in cell F3 and write 1
31 Situate yourself in cell F4 and write 360

28
32 Situate yourself in cell F5 and write PMT(F2/12;F3;F4)
This function should return to us -500,00 € which is the interest payed in the first quota of
the loan. Changing the value in F3 you can see the interest payed in each case.
We are now going to calculate the quotas amortized for a loan, we will again base it on
the first exercise.

To create this exercise we will use the PPMT function


This function has the following syntax PPMT(rate;per;nper;pv;fv;type)
rate = is the type of interest of the loan.
Per = specifies the period and must be in the range 1 to nper.
nper = is the total number of payment periods in an annuity.
pv = is the actual value of the total payments
fv = is the future value, or a cash balance you want to attain after the last payment is
made. If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
type =indicates the expiration of the payments
( type = 0 ) --> at the end of the period
( type = 1 ) --> at the start of the period

33 Situate yourself in cell A8 and write Loan


34 Situate yourself in cell A9 and write Annual rate
35 Situate yourself in cell A10 and write calculate amortization in quota no.
36 Situate yourself in cell A11 and write Total quotas
37 Situate yourself in cell A12 and write Amortized
38 Situate yourself in cell B8 and write 100.000 €
39 Situate yourself in cell B9 and write 6%
40 Situate yourself in cell B10 and write 1
41 Situate yourself in cell B11 and write 360
42 Situate yourself in cell B12 and write PPMT(B9/12;B10;B11;B8)
You should obtain a result of -99,55 € in cell B12

43 Save the workbook in the My documents folder of the hard drive, naming it Financial
functions
44 Close the workbook.

Today we will learn a fascinating little feature in excel called “goal seek”.

But what good is a feature if we cant find a use for it? So we will build a simple
retirement calculator using excel.

29
Before plunging in to the complex
retirement calculations, let us spend a
bunch of words understanding what
this goal seek is all about.

What is
goal
seek in excel?

We can think of goal seek as opposite of formulas. Formulas


tell you what is the output of a bunch of variables used in an
equation (for eg. sumproduct is an equation involving + and *).
Goal seek tells you what inputs you need to give in order to get certain output.

For example, you can use goal seek to solve a linear equation or find the internal return
rate (IRR) of an investment.

Now that you understand goal seek, let us plan your retirement.

Make a financial model to estimate your monthly savings to meet


retirement goals.

(Note: the image shows commas according to Indian currency formatting.)

In order to proceed, we would need some data, like,


(1) What is your current age?
(2) What is your expected retirement age?
(3) How much do you think you will spend every month when you retire (of course in
today’s prices)
(4) Your expectation of inflation (%)?
(5) Your expected return (%) on investments?

Once the data is available, we will need to calculate the following,

I have shown the worksheet on the right with some dummy data.
(6) The yearly expenses at the time of retirement: (3) * (1+(4))^((2)-(1))*12
(7) Corpus required to generate the above amount every year (and leave the principle
behind): (6)/(5)

(If these calculations are overwhelming, download the excel retirement calculator
workbook here .)

We know how much corpus is needed.

30
We can use FV() formula to determine the future value of a series of payments made
periodically and compounded at a given interest rate.

We know how much the FV() out come should be, but we don’t know how much the
input (monthly investment) should be.

This is where goal seek is going to help us.

Let us assume the monthly investment amount will be in cell A5. Let us also assume, the
interest rate is in cell A4, retirement age is in A3, current age is in A2.
We will write the FV formula in cell A6 like this = -FV(A4/12,(A3-A2)*12,A5)
(we have to negate FV since it uses weird accounting notations)

Since the cell A5 is blank, the FV will show the value as 0.

Now, we will use goal seek to find out how much cell A5 should have so that A6 will be
calculated to the corpus amount required.

Go to Data tab and click on What if analysis and select goal seek. (In excel 2003, it
should be in tools menu)

See this screen cast to understand how the goal seek works:

The goal seek window has 3 inputs. The cell you need to change. The cell you want to set
and the value to set.

Once you use the goal seek it will find the correct (or closest) value to meet the goal and
displays it. If you press OK, the value will be placed in the cell (in our case, in A5)

That is all.

Excel has various functions, including functions to calculate inverse cosine of a given
value, to multiply 2 matrices, to estimate the internal rate of return. But, most of us(well,

31
just me then..) use just about 5-6 functions to do our jobs. And IF functions are a majority
of these, so it doesn’t harm to learn a few interesting things you can do with just the excel
IF functions.

1. Sum alternative rows / columns:

There comes a time when you are slapped with a sheet of data and need to sum every
other row in it (dont ask me why, it happens, for eg. when you copy paste your credit card
statement in excel), Ofcourse, we can always type the sum function with all those
arguments, but we would rather chomp on that donut while excel does the dirty work for
us. Thats why it helps to know that you can sum alternative rows / columns of data using
sumif() function. Sumif function sums a range of data that meets a specific criteria.
In our case the criteria will be, “if the data element is in odd number rows”.

All you need to do is add an additional column at the end of the table and fill it with 1s
and 0s. (just enter 1 and 0 in 2 rows, select both of them and drag till the end of the table).
Now we can use this column to test our condition by writing the sumif function as
=sumif(condition range, 1, sum range) [learn how you can highlight alternative
rows / columns in an excel table]

2. Count how many times each item on list A is in List B vice versa

Often when you are working on data spread across multiple sheets, it helps to know how
many times each item on one list is repeated in another list(s). This can be done easily
using a good old countif function. Excel countif function counts data that meets a
specific criteria.

32
In the above example, I have used countif function to findout how many customers are
there in each city (where customer data is in List B and city data is in List A). The
formula looks like =countif(condition rage, condition), eg.
countif($g$32:$g$47,"chicago") would tell us how many customers are in Chicago.

3. Quickly Summarize Data with countif / sumif:

Now that we have figured out how to use sumif and countif, you can use these two
functions to create quick summary of your data.

For example, we can findout, average sales per customer per city dividing total sales data
per each city (obtained using a sumif) with total customers in that city (obtained using a
countif) as shown below. This can be a quick way to do pivot analysis of data without
actually using excel pivot tables (very useful if you are allergic to excel pivot tables or
not very happy using and constantly updating them)

33
4. Lookup second, third … nth occurrence of an item in a list in excel:

Often we work with data that has lot of duplicates, for eg. customer phone number data
that has grown over a period of time with new numbers added at the bottom of the list.
Getting second, third, fourth or nth occurrence from the list can be tricky, by using a
combination of countif and vlookup we can lookup nth occurrence from a list.

First in our data list we will insert another column and place the formula =current-
item&countif(range till that point, item), this will append the number of
smiths till that point to the end of smith, thus first smith would become smith1, second
smith would become smith2, so on…

34
Next, when looking up smith instead of using the initial column of customer data we will
use our modified customer data to fire the lookup, for eg. vlookup("smith3",
lookup range, 2, false) would tell us the 3rd phone number of smith. Note the last
argument to the vlookup as “false”, since our list may not be alphabetically sorted, we
have to use “false” to force excel to keep looking till it finds the 3rd smith row.

5. Reduce your nested if()s to one function

Do you know that you cannot next excel if functions beyond 7 levels? Thankfully, most
of us never go beyond 3 or 4 levels. But why write even that many levels when you can
use choose() function, which is like a switch structure in programming. A typical switch
function would look like, =switch(condition, outcome1, outcome2,
outcome3...), for eg, =switch(3,"good","average","poor") would return
“poor” when used. The only limitation to the switch() excel function is that it accepts
numbers for testing the condition. But you can overcome this with some creativity, like I
have shown in the below student letter grading example:

How did I convert the letter grade to a numeric in the choose(), well thats for you to
figure out

6. Now, lets learn the most important Excel IF function tip

Well, that is for you to tell me. What is your favorite Excel IF function tip / usage? Share
it in the comments, let everyone know

I have prepared an excel sheet with all these if function examples, Click here to
download it and experiment.

Excel conditional formatting is a hidden and powerful gem that when used well, can
change the outlook of your project report / sales budget / project plan or analytical
outputs from bunch of raw data in default fonts to something truly professional and good
looking. Better still, you dont even need to be a guru or excel pro to achieve dramatic
results. All you need is some coffee and this post to learn some cool conditional
formatting tricks.

35
So you got your coffee mug? well, lets start!

The 5 tricks we are going to learn are,


1. Highlighting alternative rows / columns in
tables
2. No-nonsense project plans / gantt charts
3. Extreme Incell graphs
4. Highlight mistakes, errors, omissions, repetitions
5. Create intuitive dashboards

If you are new to Excel Conditional Formatting, please read the Conditional
Formatting Basics article before proceeding.

I have created an excel sheet containing all these examples. Feel free to download the
excel and be a conditional formatting rock star

1. Highlighting alternative rows / columns in tables:

Often when you present data in a large table it looks monotonous and is difficult to read.
This is because your eyes start interpreting the data as grid instead of some important
numbers. To break this you try highlighting or changing the background color of
alternative rows / columns. But how would you do this if you have rather large table and
it keeps changing. The trick lies in Conditional Formatting. (Of course you can use the
built-in auto format feature, but we all know how the default settings of various
Microsoft products are like).

 First select data part of the table you want to format.


 Go to Conditional formatting dialog (Menu > Format > Conditional Formatting)
 Change the “cell value is” to “formula is” (YES, you can base your formatting
outcome on formulas instead of cell values)
 Now, if you want to highlight alternative rows, the formula can go something like
this,
=MOD(ROW(),2)=0
which means, whenever row() of the current cell is even, to change
the coloring to odd rows, you just need to put =MOD(ROW(),2)=1 as
formula
Also, if you want to highlight alternative columns instead of rows
you can use the column() formula.
What if you want to change background color of every 3rd row
instead, just use =MOD(ROW(),3)=0 instead. Just use your
imagination.

36
 Set the format as you like, in my case I have used yellow color. When you are
done, the dialog should look something like this:

 Click OK.
 Congratulations, you have mastered a conditional formatting trick now

2. Creating a quick project plan / gantt chart using conditional formatting:

Project plans / gantt charts are everyday activity in most of our lives. Creating a simple
and snazzy project plan template in excel is not a difficult job, using conditional
formatting a bit of formulas you can do it no time.

 First create a table structure like shown above, with columns like Activity, start
and end day, day 1, 2,3, etc…
 Now, whenever a day falls between start and end day for a corresponding activity,
we need to highlight that row. For that we need to identify whether a day falls
between start and end. We can do that with the below formulas,
=IF(AND(F$8>=$D9, F$8<=$E9),"1","")
Which means, whenever, the day number represented on the top row
is between start and end we will in 1 in the corresponding cell.
 Next, whenever the cell value is 1, we will just fill the cell with a favorite color
and change the font to same color, so that we dont see anything but a highlighted
cell, better still, whenever you change the start or end dates, the color will change
automatically. This will be done by conditional formatting like below:

37
 Congratulations, you have mastered the art of creating excel gantt charts
now

3. Extreme In-cell Graphs:

Incell graphing is a nifty trick that basically uses REPT() function (used to repeat a string,
character given number of times) to generate bar-charts with in a cell. You can apply
conditional formatting on top of them to give the charts a good effect. Here is a sample:

The above is a table of visits to Pointy Haried Dilbert in the month of January 2008. As
you can see I have highlighted (by changing the font color to red and making it bold) for
the cells that have more than average number of visits in the month. I am not going to tell
you how to do it, it is your home work

4. Highlight mistakes / errors / omissions / repetitions using conditional


formatting:

Often we will do highly monotonous job like typing data in a sheet. Since the work is
monotonous you tend to make mistakes, omit a few or repeat something etc. This can be

38
avoided by conditional formatting. I use this trick whenever I am typing something or
pasting a formula over a rather large range of cells (for eg. vlookup on annual revenue
data of all your accounts, could run in to thousands of rows across multiple states /regions
etc.).

Lets see how you can highlight a cell when it has an error:

 First select the cells that you want to search for errors
 Next go to menu > format > conditional formatting and mention the formula as:
=iserror() (see below)

 In the same way you track repetitions, a simple countif() would do the magic
for you, or Omissions (again a countif())
 Thats it, you have learned how to save tons of time by letting excel do the job for
you. Sit back and sip that coffee before it gets cold.

5. Creating dash boards using excel conditional formatting:

As I said before you can use conditional formatting to create intuitive sales reports or
analytics outputs. Like the one shown here,

Here is how you can do it:

 Copy your data table to a new table.


 Empty the data part and replace it with formula that can go like this (I am using
the above table format to write these formulas, may change for your data)
=ROUND(C10,0) & " " & IF(C9 Essentially, what we are doing is,
whenever the cell value is more than its predecessor in the data
table we are appending the symbol â–² (go to menu > insert >
symbols and look for the above one) etc.
 Next, conditionally change the color of cell to red / green / blue or pink (if you
want ) and you are done

39
 Show it to your boss, bask in the glory

VLOOKUP may not make you tall, rich and famous, but learning it can certainly give
you wings. It makes you to connect two different tabular lists and saves a ton of time. In
my opinion understanding VLOOKUP, OFFSET and MATCH worksheet formulas can
transform you from normal excel user to a data processing beast.

In our 4th installment of spreadcheats, we will learn how to use these formulas.

What is the syntax for Match, Vlookup and Offset?

Here is the syntax for these three very powerful functions in plain English:

What are vlookup () and match () ?

VLOOKUP and MATCH are your way of asking excel to find a needle in haystack.
Imagine you have all your customer contact information in one sheet in the range
A1:D5000 in the format phone number, name, city and date of birth. Now you need to
find out which customer has the phone number “936-174-5910″. How do you do it?

You guessed it right, you use VLOOKUP and summon excel to do the search and return
with customer name.

While VLOOKUP is used to fetch value a based on what you are looking for,
MATCH is used to fetch the position of the value you are looking for.

See this illustration to understand :

40
So what is Offset() then?

OFFSET is your way of telling excel to fetch a portion from large range of values.
You can compare OFFSET to what you see from your car window while driving. As your
car moves, you see different things from the window.

OFFSET returns a reference to the portion of a large range you have supplied based on 5
parameters. For eg. OFFSET (A1, 3,4, 5,6) would return 5×6 cell range from E4 (A+4
columns, 1+3 rows = E4) thus: E4: J9

See this illustration to understand how OFFSET spreadsheet formula works:

So how are Offset() and Match() linked to each other?

Since MATCH returns the position of the item you are looking for in a list, you can then
use this position in OFFSET to fetch values surrounding the searched value.

41
Finally

Remember, both VLOOKUP and MATCH throw a fail


error of #value! if the value you are looking for is not
there. Also, OFFSET returns a range so make sure you
pass the value to another function like SUM that accepts
ranges.

Just use them with some dummy data, play around with arguments and see how you can
say “oh yeah, I can do that in few minutes” to your boss next time.

Excel date time features are very handy and knowing them a little in depth can help you
save a ton of time in your day to day spreadsheet chores. Let us prepare for your date
with the sheet using these 10 handy tips.

Before jumping on to the tips, it helps to know how excel represents the date and time.

Microsoft Excel stores dates as sequential numbers … By default, January 1, 1900 is


serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days
after January 1, 1900. Excel stores times as decimal fractions because time is considered
a portion of a day. [Excel Help Text on Date / Time]

So you see, Date and Time are in fact numbers in Excel. Just enter a date in your excel
sheet and format it as number to see its equivalent numeric value. Today is 25-Aug-2008
and excel represents it as 39685.

Now that you know the little secret behind date / time, lets move to the 10 tips.

1. Test whether a date is future or past

You can find whether a date is past or future or today using simple if formula like:
=if(this_date=today(),"Today",if(this_date < today(),"Past","Future"))

today() is the spreadsheet function using which you can find today's date.

2. Find the number of days between two dates

Since dates are represented as sequential numbers in excel, in order to find out how many
days are between any given 2 dates, just subtract one from another. For eg. you can use
=today()-datevalue("08/15/1947") to find that it is 22,291 days since India's
independence (August 15, 1947).

3. Formatting dates

Having date / time in the sheet is not enough if you can not make it look like the way you
want. For eg. you may want to show date as "Monday - August 25, 2008". You can use

42
cell formatting to do this. Just select the cell with date and hit ctrl+1 and in
the "Number" tab select "Custom" as category and mention "dddd mmm dd,
yyy" as format string.

Try these other date formats as well. Learn more about custom cell
formatting.

4. Auto-filling only weekdays

We all know that in order to fill a series of dates in excel sheet, you just need to enter first
few dates and then select the range and drag to auto fill the selection with rest of the
dates. But what if you need to fill only weekdays?

You can do that easily with Auto fill option - "weekdays only" as shown on the right.
learn more.

5. Find out the day of week from a given date

Finding whether a day is weekend or weekday is useful if you are making project plans or
resource allocation sheets. You can do this by simply using weekday() function. For eg.
=weekday("08/25/2008") would return 2 (Excel, by default starts the week at Sunday,
hence Monday is indicated as 2).

If you would like to start the week with Monday like most of us do, use
=weekday("08/25/2008",2).

6. Highlight weekends using conditional formatting

Often when you are making project plans or reports, it helps if the weekends or after
office hours can be grayed out. You can do this easily with conditional formatting as
shown below:

43
In order to do this, we can test whether a given a day is
weekend or not in conditional formatting by
=WEEKDAY(this_date,2)>5 as weekday() returns 6 and
7 for Saturday and Sunday.

You can use similar logic to highlight after office hours (before 9AM or after 5PM) for
time values. Learn these 5 tips to master conditional formatting.

7. Adding / Subtracting dates

Since Excel dates are nothing but numbers, you can find out the difference between two
given dates by just subtracting one from another. For eg. ="09/20/2008"-"08/25/2008"
will return 26

In order to add n number of days to a given date, you can just add that number to given
date. For eg. ="08/25/2008"+26 will return 09/20/2008

8. Ensuring a valid date or time is entered in a cell

When sharing your sheets with others to enter some data, it may be useful if you can
restrict them to enter only valid date values in cells that require date value. You can do
that using cell data validation feature in excel. Just select the cell to which you want to
apply date / time validation, goto menu > data > validation and set type as "Date" or
"Time" and specify criteria.

For example, you can specify criteria like the one on left to ensure that date entered is at
least 18 years before 1/1/2008. What more, using message option of data validation
settings you can even show messages like this:

9. Insert today's date, current time using key board shortcuts

Just go to the cell where you want to insert date and press ctrl+;

To get current time, use ctrl+shift+; ( thus ctrl+: )

Btw, if you are planning to get today's date or current time using formulas, you can use
today() and now(). Also learn these 11 very useful excel keyboard shortcuts.

44
10. Filling every 2nd / 3rd day

Often when you are entering dates in to the spreadsheet, it may be required to just enter
every second or third day only. You can do this by changing the step value of auto-fill
criteria (the default step value is 1).

 Enter the start date in first cell.


 Select a range of cells in which you would like to fill rest of cells.
 Go to Menu > Edit > Fill > Series
 In the dialog, mention step criteria as 2 or 3 as shown aside.

That is all, with these 10 tips I hope I made your date with that spreadsheet is made
little exciting.

Here is a little formula trick if you need to sum a range of cells based on multiple
conditions.

Assuming you have the starfleet, captain and flight data like this (seriously, what are you
doing with excel again?)

In order to findout how many flights James Kirk did on the Amarillo, you can write an
array formula like this:
=SUM(($D$3:$D$24)*($B$3:$B$24="Amarillo")*($C$3:$C$24="James Kirk"))

Remember, the above is an array formula. So you need to type it and press
CTRL+SHIFT+Enter.

Update: Or you can also use SUMPRODUCT (replace SUM in the above formula with
SUMPRODUCT and just hit Enter (Thanks to Simon for teaching me this tip)

As you can guess, column B has ship names, C has captains and D has # of flights.

Using the same logic, you can make a cross tab (or pivot) like the one shown on the right
too.

Today I have learned this very cool way to find if a list has duplicate items or not.

45
To find out duplicate items:

This technique uses array formulas (do not shudder, believe me they are not as difficult as
you may think)

First the formula

Assuming your list is in the range, C3: C9, the array formula to find if a list has duplicate
items or not is,

=IF(MAX(COUNTIF(C$3:C$9;C3:C9))>1,"list is not unique","list is unique")

Now the explanation

How do you know if a list has no duplicates? Simple, we find the number of times each
item has appeared in the list and see if any of those counts are more than 1.

Now, take a look at the formula. It says find the maximum of individual item counts
using countif (learn excel countif function) and if the maximum is more than 1, then the
list has duplicates, otherwise it is unique.

But…

Yes, entering the formula will not work by itself. You have to make it array formula.

How do you do that?

Oh, that is simple, you just take the excel spreadsheet and whack it until it turns blue.

well, not really. all you need to do is enter the formula and press CTRL + SHIFT ENTER
instead of just pressing enter.

that way excel converts your formula to array formula and the
COUNTIF(C$3:C$9,C3:C9) will return an array of counts instead of one value. Now you
can also guess why we have absolute reference for one parameter of countif () and
relative reference for another. Learn more about Absolute and Relative References in
excel formulas.

I am obsessed with unique values, I guess it has something to do the quality data of I get
to work with. So much so that it is the first excel post I have written on this blog, way
back in 2006. Today I want to share with you all one more way (Not again man, you did
that 2 weeks back) to extract unique values. I promise that I wont propose another unique
idea to extract unique values (remember, I can still write about ways to remove
duplicates… )

46
Ok, enough introduction already. Here goes another unique items extraction technique,
this time using Pivot Tables.

1. Just select the data from which you need to extract unique items

2. Create a Pivot Table (in Excel 2003 menu > data > pivot table and in Excel 2007
Insert > Pivot Table)

3. Drag and drop a column in the pivot table and you will instantly see all unique values
for that column.

4. Copy the values and use paste special to extract the values.

Why I love this technique:

It is scalable and works really well with large data. If your data changes just refresh the
pivot. Also, when you need to extract unique values for multiple columns this technique
is really good, for eg. unique customer names, product names, cities from monthly sales
report. Despite the manual step of creating the pivot tables, this method is highly reliable.

To increment only when there is a change.

Here is a quick formula trick you can use to generate sequence numbers that only
increment when there is a change.
Assuming the sequence of values are in column C from C3,

you can write the following formula in B4 onwards (B3 will be 1, wake up…)
=IF(C4=C3,B3,B3+1)
Now just copy paste the formula over the entire range [...]

47
48

S-ar putea să vă placă și