Professional Documents
Culture Documents
17-11-2015
COURSE OUTLINE
1. Names
2. Formulas Audition & Calculation
CELL CONTENT
A) DATA
1) Numbers
123
2) Dates
3) Logical
True
4) Errors
5) Text
12.5 is text
12,5 0,25
False
B) FORMULAS
Start with = (or +)
Text in Formulas should be between quotes: 12 Lisboa
FORMULAS
HOW TO INSERT A NEW FORMULA
17-11-2015
FORMULAS
HOW TO CHECK AN EXISTENT FUNCTION
Using The Insert Function Wizard
17-11-2015
FORMULAS
Cell References
1. Relative Cell References
Excel, by default, uses a reference format known as A1
ex: F5
References contain a combination of both the column letter and row number
3. Range References
A1:C5
A1:C5 ; D6:E7
1:2
C:E
sheet2!A1:C5
17-11-2015
FORMULAS
Operations inside formulas are executed in the following order:
3.a) ^
3.b) * , /
3.c) + -
FORMULAS
Cell References
1. Relative Cell References
Excel, by default, uses a reference format known as A1
References contain a combination of both the column letter and row number
3. Range References
Upper Left Cell reference : Lower Right Cell reference
ex: A1:C5
17-11-2015
FORMULAS
AUDITION
1) Using F2 Key
17-11-2015
FORMULAS
CALCULATION
1) Automatic (default)
2) Manual
17-11-2015
10
Defining NAMES
A NAME
17-11-2015
11
Defining NAMES
Rules:
1) a name should start with a letter or _
2) afterwards can be letters, numbers or _
3) spaces are not allowed
4) a name cant be a cell or range reference
17-11-2015
12
FUNCTIONS
EXCEL FUNCTIONS:
1) have a name and parameters between parenthesis
2) always return at least one value: number, date, text, True|False, #N/A, #Value!, ..
A) TEXT
Left, Right, Mid
Left(Mary Ann, 2) -> Ma Mid(Mary Ann; 3; 5) -> ry An
Exact, Len
T = t -> True Exact(T, t)->False Len(Mary Ann) -> 8
Trim, Concatenate
Trim( Mary Ann ) -> Mary Ann
Upper, Lower, Proper
Upper(Mary 9) -> MARY 9 Proper(mary ann) -> Mary Ann
Find, Search
Search(a; Ana)-> 1 find(a; Ana)-> 3 find(b; Ana)-> #Value!
Substitute
Substitute(Ana Maria ; ; ) -> AnaMaria
Text( , format)
Formats: "000" ; "00.00"; "###"; "yyyy-mm-dd
Char, Code
code(A) -> 65 char(65)->A
B) DATE
Today, Now
Today(), Now()
Weekday, Weeknum
Year, Month, Day
Date , Time
Date(1985; month(today()); day(today()))
Datedif
Datedif(oldDate; NewDate,;y")
17-11-2015
13
FUNCTIONS
C) MATH
Sum, Product
Int, Trunc
Round , Roundup, RoundDown
Ceiling; Mround
Mod, Quotient, Sqrt, Power, Pi
Rand, RandBetween
SumSQ
SumProduct
SumX2MY2
D) STATISTICAL
Average, Stdev, Var, Avedev
Mode, Median
Max, Large
Min, Small
Rank
Count, CountA, CountBlank
17-11-2015
product(3; 5; 4) -> 60
int(-4,6) -> -5 trunc(-4,6) -> -4
RoundUP(18,4; 0) -> 19 RoundDown(18,4; 0) -> 18
Ceiling(13;4) -> 16
MRound(13;4) -> 12
14
FUNCTIONS
17-11-2015
15
FUNCTIONS
E) MATH & STAT with Conditions
Countif, CountIfs
SumIf,
SumIfs
Averageif, AverageIfs
Criteria:
1) should always be text
2) if there is a need to calculate a value use operator &: >= & average(range1)
3) dont use AND( ), OR() as criteria
4) only for multiple AND conditions; not for multiple OR conditions
5) "a*" - rows with text started with an "a"
6) "*a" - rows with text finishing with an "a"
7) "*a*" - rows with text at least with an "a"
8) "a?" - rows which text start with an "a" followed by one letter
9) "?a*" - rows which text has an "a" as second letter
17-11-2015
16
FUNCTIONS
17-11-2015
17
FUNCTIONS
F) INFORMATION
isError
isblank, IsNumber, istext
G) LOGICAL
And, Or, Not
If
Iferror
18
FUNCTIONS
17-11-2015
19
FUNCTIONS
I) LOOKUP Functions
Row, Column
Rows, Columns
row(B5) -> 5
rows(5:6) -> 2
columns(A:B) -> 2
Match
Index
Vlookup
17-11-2015
20
FUNCTIONS
J) ARRAY Functions
Functions that return multiple values and not a single one
Steps:
1) Select all cells
2) Write the formula (start with =)
3) Press Ctrl+Shift+Enter
Afterwards the formula should be surrounded by curly brackets
Examples:
Transpose, MInverse
MMult
Frequency
Large
Small
17-11-2015
{=transpose( range1)}
{=mmult( range1; range2)}
{=frequency( range1; {1,2,3,4})}
{= large(range1; {1;2}) }
{= Sum(small(A1:B3;{1;2}))}
21
CONDITIONAL FORMATING
Format cells according to their own values
Choose a predefined conditional formatting option
17-11-2015
22
DATA VALIDATION
Deny entering certain values
Whole numbers, Decimals, Date, Time, Text length
1; 2 ; 3
=A1:A7
=Offset(A1; 0;0;2;1)
=range1
List1
=indirect(name in cell) List2
Error Alert message : the message to give the user in case of error
17-11-2015
23
ADVANCED FILTERING
17-11-2015
24
DUPLICATED DATA
1) Formatting Duplicates
2) Removing Duplicates
3) Filtering Duplicates
4) Moving Duplicates and Unique Data to other places
17-11-2015
25
ARRAY FORMULAS
Why the need of array formulas?
1) There are some operations we cannot do without auxiliary columns:
Maxifs
Averageifs
sumifs
Averageifs
3) There are some operations that can only be done with Macros and CSE
Dynamically sort ranges
17-11-2015
26
ARRAY FORMULAS
What is an Excel array formula?
1) An array formula return several values instead of just one or
2) An array formula return a single value but implied the creation and use of at
least one virtual range
= Sum(A1; A3; A4)
-> Regular Formula
{= A1:A4 * B1:B4}
-> Array Formula
{=Max(A1:A4 * B1:B4) } -> Array Formula
17-11-2015
27
ARRAY FORMULAS
Array formulas are created by pressing the Ctrl, Shift, and Enter keys on the
keyboard at the same time once the formula has been typed in. They are
sometimes referred to as CSE formulas.
After pressing Ctrl-Shift-Enter the formula bar displays braces (curly brackets)
around the formula. Ex: {= A1:A4 * B1:B4}
Use the F9 key to evaluate portions of an array formula
ex: {=sum(if(A1:A4<4,A1:A4))} ->'=SUM({3;4;FALSE;FALSE})
To create a column array of constants, type the values separated by commas and
enclose them in braces, for example {1;2;3;4}. To create a row array of constants,
type the values separated by commas, for example {1,2,3,4}
To dynamically create a range of values in your CSE formula use the functions
row() or column(). For example
{=ROW(1:9)}
{=COLUMN(1:9)}
17-11-2015
28
ARRAY FORMULAS
Types of Array Formulas
1) MULTI-cell Array Formulas - formula entered in a range of cells. It returns several values.
{= A1:A4 * B1:B4}
2) SINGLE-cell Array Formulas - formula entered in a single cell although it processes ranges
of cells
{=MAX(A1:A4 * B1:B4) }
3) Excel Array Functions - There exist a few Excel array functions that are designed to
return multi-cell arrays
FREQUENCY, TRANSPOSE, TREND, MINVERSE, MMULT
17-11-2015
29
ARRAY FORMULAS
OPERATORS since they expect a fixed number of parameters
-> they can be used to create an intermediate virtual range!!
1. ARITMETIC: +, -, *, /, ^
{={1;2;3} + {3;2;1}}
{={1;2;3} * {3;2;1}}
-> {4; 4; 4}
-> {3; 4; 3}
2. TEXT: &
{={1;2;3} & {3;2;1}}
17-11-2015
30
ARRAY FORMULAS
Functions that expect a fixed number of parameters
-> they can be used to create an intermediate virtual range!!
1. IF, IFERROR
{=If( {True; True; False; True}, 5, 10)}
{=IF({1;1;0;1}, {1;3;5;7}, {2;4;6;8})}
{=IF( {7;3;6;7}>3; 1; 0)}
{=Iferror( {7; #VALUE!; TRUE; #REF!}, "")
-> {5;5;10;5}
-> {1;3;6;7}
-> {1;0;1;1}
-> {7;;True;}
3. COUNTIF, MATCH
{=countif({1;2;1}; {1;2;1})}
(how many times appears each element)
{=match({1; 3; 3; 2}, {1; 3; 3; 2}; 0} (first position of each element)
-> {2;1;2}
-> {1;2;2;4}
4. LARGE, SMALL
{=large({1;2;3}; {1;2})}
17-11-2015
-> {3; 2}
AE- Miguel Campos
31
ARRAY FORMULAS
Functions that expect several parameters and only return one value..
-> they cannot be used to create an intermediate virtual range!!
but they can be used for the final calculation in an array formula.
{=sum({1;2;3} ; {3;2;1})}
NOK
{=max({1;2;3} ; {3;2;1})}
{=average({1;2;3} ; {3;2;1})}
NOK
NOK
but
OK
OK
B. AND, OR
{=And({7;12;10} >=10; {9;7;15} >=10)} -> returns False and not {False; False; True}
{=Or({7;12;10} >=10; {9;7;15} >=10)} -> returns True and not {False; True; True}
NOK
NOK
Excel will evaluate this expression as => Or( 7>=10; 12>=10; 10>=10; 9>=10; 7>=10; 15>=10)
17-11-2015
32
ARRAY FORMULAS
How to work with multi-cell array formulas
1.
2.
3.
4.
5.
6.
Select the range of cells where you want to output the results before entering
the formula.
To delete a multi-cell array formula, either select all the cells containing it and
press DELETE
You cannot edit, move or delete the contents of an individual cell in an Excel
array formula. Nor can you insert new cells into or delete existing cells from a
multi-cell array formula.
To shrink an array formula, i.e. to apply it to fewer cells, you need to delete
the existing formula first and then enter a new one.
To expand an array formula, i.e. apply it to more cells, select all cells
containing the current formula plus empty cells where you want to have it,
press F2 to switch to the edit mode, adjust the references in the formula and
press Ctrl + Shift + Enter to update it.
If an array returned by the formula is smaller than the selected range, #N/A
errors will appear in extra cells.
17-11-2015
33
ARRAY FORMULAS
Examples of basic Array Formulas
1. The sum of the absolute value of each item in a list.
{=SUM(ABS(A1:A5000))}
2. Find the smallest non-zero value in a set of values.
{=MIN(IF(A1:A5000<>0; ABS(A1:A5000)))}
3. To count the number of cells that contain an error value.
{=SUM(IF(ISERROR(A1:A5000);1;0)}
4. Sum ignoring errors
{=SUM( IF(ISERROR(A1:A9); 0; A1:A9) )}
34
ARRAY FORMULAS
Statistical Functions with Multiple Conditions
AND : cannot be used -> we should use multiplication
OR : cannot be used -> we should use addition
*
+
17-11-2015
35
ARRAY FORMULAS
Statistical Functions with Multiple Conditions
8.
9.
17-11-2015
36
ARRAY FORMULAS
Returning Single/Multiple Matches Values
13. The name with more chars in a list of names
{=INDEX(B2:B9; MATCH(MAX( LEN(B2:B9 )); LEN(B2:B9); 0)) }
15. Which number in the range Sales is closest to a specified number XXX.
{=INDEX(Sales; MATCH(MIN(ABS(Sales XXX)), ABS(Sales - XXX),0))}
17-11-2015
37
ARRAY FORMULAS
Returning Single/Multiple Matches Values
17. Get the names when some conditions are verified
{=IFERROR(INDEX(Names, SMALL(IF((exame1>10) * (exame2>10)>0, ROW()-1, ""), ROW(names)1)), )}
-> student names when they have exam1>10 AND exam2>10
17-11-2015
38
ARRAY FORMULAS
Returning Single/Multiple Matches Values
19. Get values without duplicates from a list of values
{=INDEX(animals; SMALL((IF(MATCH(animals; animals;0)=Row(); Row();""); Row(animals)))
we store on our artificial range the row numbers where each element appears the first time
17-11-2015
39
ARRAY FORMULAS
Array Formulas Optimization
1. Multiplication by 1 when array of booleans to sum
2. Sumproduct
Can be used to sum values of ranges (or sum values from one range)
It is not an array formula
It is 10%-15% faster
Ex: = sumproduct((A1:A9 >10)*1)
1. Index( ;0)
17-11-2015
40
17-11-2015
41
4) CONSTRAINTS
5) SOLVER OPTIONS
Number of iterations
Method Used
17-11-2015
42