Excel Formula Function
Excel Formula Function
… cont’d
2
Table of Contents
05 | Lookup Formulas 06 | Conditional math formulas
• Overview of Lookup formulas • SUMIFS() - Conditional Summation
• What is VLOOKUP? • SUMIFS() – Operator for a date range
• HLOOKUP() vs. VLOOKUP() • SUMIFS() - ID based running total
• Use VLOOKUP with TRUE when 3 conditions met • COUNTIFS() - Conditional Counting
• Why 2-D Lookup? 07 | Misc. Formulas
• MATCH() – Basics & match_type: -1 vs. 0 vs. 1 • Hyperlinking (Ctrl + K)
• The chemistry between VLOOKUP & MATCH…
• How VLOOKUP & MATCH look like when they are together?
• How HLOOKUP & MATCH look like?
• Bonus: HLOOKUP (senior) with MATCH (junior)
• Why reverse Lookup?
• Reverse Lookup - INDEX() w. MATCH()
• Formula for INDEX() & MATCH() - simplified
• INDIRECT() – Applications [“RE-DIRECTION”]
• INDIRECT() basics - with Range Naming
3
01 | Data Cleaning formulas
Text Formulas – T(), N(), and REPT()
5
Text Formulas – LEFT(), RIGHT(), and MID()
6
Text Formulas –VALUE(), TRIM() and LEN()
• Removes excess spaces from text. Removes all leading & trailing
spaces. However, multiple spaces inside the sentences are
replaced with a single space.
• E.g., Converts “ HSBC Inc. ” TO “HSBC Inc.”
7
Text Formulas – SEARCH() vs. FIND()
▪ Case Sensitive? – No
▪ Can use wild characters in search terms? - Yes
8
Text Formulas – PROPER(), UPPER() & LOWER()
9
Text Formulas – SUBSTITUTE()
10
Joining data strings using CONCATENATE, &
Note:
11
02 | Essential math formulas
For Weighted Average & Compounding/Discounting
13
Used in Financial Modeling and Tax Computation
14
Used in pricing discovery processes
15
Using =SUBTOTAL() for calculations w. Filtered list.
16
For Counting
Counts the number of cells which have numeric value
Note: COUNTIFS() will be discussed later in the book. COUNTIFS() counts those cells that meet a certain
criteria.
17
For rounding numbers (1/2)
… cont’d
18
For rounding numbers (2/2)
Note: MROUND() do not work with +/– nos. simultaneously. It does not have the
option to choose between round up and round down.
19
PMT – Used to find the EMI amount of a loan
20
03 | Date formulas
Date Formulas - TODAY() and NOW()
▪ Returns the current date and time as per PC’s system clock
▪ Updates every time the file is opened (dynamic)
▪ Ctrl + Shift + ; and press Enter - for inserting current time (static)
22
Extracting date info with - DAY(), MONTH(), YEAR()
23
Extracting date info with - TEXT()
▪ Converts the date into Custom format. E.g., “mmmm-yyyy” will display June-2011
▪ Important: Resultant answer value is not a date value but a text value. Used for display
purposes and not for subsequent formula computations.
24
Use EOMONTH() and EDATE() for Financial Modeling, Due
Dates, Expiry Date
25
Date Formulas - WEEKDAY()
… cont’d
26
Project Management – WORKDAY() & NETWORKDAYS()
▪ Returns the date before or after a specified number of
weekdays (weekends excluded). It excludes start date in
computing final answer.
▪ E.g., If Cell A1 is 30-Dec-2011, then =WORKDAY(A7,5)-1 will
return 5-Jan-2012. 1-Jan-2012 is a Sunday and hence,
excluded.
▪ Scheduled public holidays can also be excluded
▪ Used to calculate deadline and due dates
27
WORKDAY.INTL()
28
NETWORKDAYS.INTL()
29
04 | Logical formulas
Not Equal To Operator <>
31
Logical formulas - generally used with IF()
32
Logical formulas – AND(), OR(), IF()
Example:
33
Logical formulas – AND(), OR(), IF()
Example:
34
Combine Logical formulas – AND(), OR(), IF()
Example:
[Bonus]
35
IFERROR() – what’s the message or action if error
▪ Nested IFERROR:
36
Absolute & Relative referencing using $ - locking the cell
or a range
After selecting a cell or a range of cells, keep pressing the function key <F4> or <Fn+F4> to
toggle between the four combinations of cell referencing (as indicated):
37
05 | Lookup Formulas
Overview of Lookup formulas
39
What is VLOOKUP?
When you are looking up for a name (ID) in a list (top
to down), then it’s a vertical lookup (VLOOKUP)
40
Step 1 – Whose details are you looking for?
41
Step 2 – Which table will you find the details in?
42
Step 3 – Which column of the table will you find the
details in?
3
SN ID Name Score col_index_num
ID Score
01 1222 Karl 76 2199 ?
02 2134 Jenny 56
lookup_value
03 2111 Sam 42
04 2199 John 71
05 1221 Carol 92
06 1009 Ray 62
table_array with ID as 1st column
43
Step 4 – False or True?
3
SN ID Name Score col_index_num
ID Score
01 1222 Karl 76 2199 71
02 2134 Jenny 56
lookup_value
03 2111 Sam 42
04 2199 John 71
• FALSE (0) is for EXACT match
05 1221 Carol 92
• TRUE (1) is for SLABS cases…
06 1009 Ray 62
to be discussed later
table_array with ID as 1st column
44
VLOOKUP Summarized
45
HLOOKUP() vs. VLOOKUP()
46
Use VLOOKUP with TRUE when 3 conditions met
47
Example: Let’s say you scored 77.
% Grades
93.00 - 100 A
91.00 - 92.99 A-
83.33 - 90.99 B+
79.00 - 83.32 B
76.67 - 78.99 B-
73.33 - 76.66 C+ What grade will you receive?
70.00 - 73.32 C
66.67 - 69.99 C-
63.33 - 66.66 D+
60.00 - 63.32 D
56.67 - 59.99 D-
0.00 - 56.66 F
48
Which formula will you prefer to write - 1 or 2?
% Grades
93.00 - 100 A
91.00 - 92.99 A-
83.33 - 90.99 B+ 1
79.00 - 83.32 B
76.67 - 78.99 B-
73.33 - 76.66 C+
70.00 - 73.32 C
66.67 - 69.99 C-
63.33 - 66.66 D+
OR
60.00 - 63.32 D
56.67 - 59.99 D- 2
0.00 - 56.66 F
49
Convert table format (left ⇾ right)
50
Let’s take a simpler example to understand…
51
Case Study
Situation: The table to assign the grade (A+ to E) based on the scores (0 to 5) have been
provided.
Complexity: To calculate the correct grade, it will take a complex Nested IF statement.
© YL Academy
© YL Academy
52
Solution: Use VLOOKUP with TRUE
1. Create a new column with ratings range (number) arranged in an ascending order and
where every value is read top to down with the meaning of >=
© YL Academy
© YL Academy
… cont’d
53
2. Use VLOOKUP with TRUE
© YL Academy
2 TRUE means 1
© YL Academy
54
Real-life use cases of VLOOKUP with TRUE
55
[Simple score grading]
56
[Debtors’ ageing]
57
[Dates]
58
Why 2-D Lookup?
VLOOKUP() with MATCH()
59
2-D Lookup - When you have to pull a value from a
cross-tab or pivoted table using two inputs
60
Option 1: Complex Nested IFs
© Excel Superstar
61
Option 2: VLOOKUP + MATCH
62
MATCH() – Basics & match_type: -1 vs. 0 vs. 1
63
The chemistry between VLOOKUP & MATCH…
64
How VLOOKUP & MATCH look like when they are together?
© Excel Superstar
0 (zero) for
exact match.
65
How HLOOKUP & MATCH look like?
66
Bonus: HLOOKUP (senior) with MATCH (junior)
67
Why reverse Lookup?
INDEX() with MATCH()
68
Reverse Lookup - INDEX() w. MATCH()
IMM vs VM: Both VM and IMM approaches are useful for pulling data from any 2x2
data matrix. However, IMM is useful for reverse Lookup. Unlike VM, IMM doesn’t require
the common link values to be in the left-most column of the database.
69
Formula for INDEX() & MATCH() - simplified
VLOOKUP’s parameter
col_index_num cannot be -1
70
INDIRECT() – Applications [“RE-DIRECTION”]
71
INDIRECT() basics - with Range Naming
72
Note:
▪ Use INDIRECT when you want to change the reference to a cell within a formula without
changing the formula itself.
▪ Named Cell/Range can be used as an input for INDIRECT
▪ Often used to create 3D Lookup formulas along with VLookup + Match
▪ INDIRECT() is used for references within the SAME workbook. Cross-linking different
workbook is best avoided as it works only when all relevant workbooks are open - Yields a
#REF! error if not done so.
Example:
73
06 | Conditional math formulas
SUMIFS() - Conditional Summation
Solution:
28,000 i.e., 8,000 + 20,000
Note:
(1) Use <F4> to lock
Criteria_range & Sum_range
75
SUMIFS() – Operator for a date range
▪ If cell A1 contains “21-May-2001”, then the Criteria_1 can be “>=”&A1 indicating date
21-May-2001 onwards.
▪ The operators (> < = etc.) has to be enclosed in a pair of double-quotes and
concatenated (&) with the cell reference containing valid date(s).
▪ For a date range, i.e., between {date1} and {date2}, two criteria will be needed. (1)
>=date1 and (2) <=date2
76
SUMIFS() - ID based running total
▪ Careful use of relative references ($) can help yield differential cumulative running
total. E.g., start of the range has been locked using <F4> -
77
COUNTIFS() - Conditional Counting
Solution: 2
78
07 | Misc. Formulas
Hyperlinking (Ctrl + K)
80