Elementary Data Analysis
with MS Excel
Redwan Ferdous
Electrical Engineer| Tech Enthusiast| Robotics | Automobile| Data Science |
Tech-Entrepreneur & Investor |
redwan.contact@gmail.com | ferdousr@emk.com.bd
https://sites.google.com/view/redwanferdous
Day: 03 out of 06 | September 09, 2020
Today’s Agenda
(IF, Nested IF, VLOOKUP, HLOOKUP)
- Formulas and Functions
- List of Formulas [Practical]
- 15 Important Functions for Data Analysis+ Practice
- Error Handling
- Data Validation
- Macro
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
2
But before that….
•EXAM!!!!
• Access the questions from here:
https://forms.gle/AXcyWKmSc53dNuWb8
• It is a Closed-Book Exam.
• Total Time 10 Minutes. Total 09 Questions. Answer all.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
3
09-Sep-20 4
Elementary Data Analysis with MS Excel
Day-03
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
Formulas & Functions of MS Excel
There are two basic ways to perform calculations in Excel: Formulas and
Functions.
1. Formulas:
In Excel, a formula is an expression that operates on values in a range of cells
or a cell. For example, =A1+A2+A3, which finds the sum of the range of
values from cell A1 to cell A3.
2. Functions:
Functions are predefined formulas in Excel. They eliminate laborious manual
entry of formulas while giving them human-friendly names. For example:
=SUM(A1:A3). The function sums all the values from A1 to A3.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
5
List of Functions
• AutoSum
• Financial
• Logical
• Text
• Date & Time
• Lookup & Referencce
• Math & Triginimetry
• Statistical
• Engineering
• Cube
• Information
• Compatibility
• Web
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
6
List of Functions
• Let’s check 2/3 sample formulas from each section.
• Later, we will check 15 Most common/ important formulas separately.
Note:
• Formula syntax/ parameters are not case sensitive.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
7
List of 16 Important Functions
• CONCATENATE
• LEN
• COUNTA
• DAYS/NETWORKDAYS
• SUMIFS
• AVERAGEIFS
• VLOOKUP
• HLOOKUP
• FIND/SEARCH
• IFERROR
• COUNTIFS
• LEFT/RIGHT
• RANK
• MINIFS
• MAXIFS
• SUMPRODUCT
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
8
CONCATENATE
• =CONCATENATE is one of the easiest to learn but most powerful
formulas when conducting data analysis. Combine text, numbers,
dates and more from multiple cells into one. This is an excellent
function for creating API endpoints, product SKUs, and Java queries.
Formula:
• =CONCATENATE(SELECT CELLS YOU WANT TO COMBINE)
• example:
• =CONCATENATE(A2,B2)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
9
LEN
• =LEN quickly provides the number of characters in a given cell. LEN is
especially useful when trying to determine the differences between
different Unique Identifiers (UIDs), which are often lengthy and not in
the right order.
• Formula:
=LEN(SELECT CELL)
• example:
=LEN(A2)
• Quick Quiz: Why Len of any date is showing 05 in sample dataset?
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
10
LEN (cont.)
• Check the Length of different Decimal Points.
• Quick Quiz: Why there is variation of lengths though showing only 2
points after decimal?
• Check the length of the Sentence with all 26 Alphabets:
“The quick brown fox jumps over the lazy dog” or
“Pack my box with five dozen liquor jugs”
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
11
COUNTA
• =COUNTA identifies whether a cell is empty or not. In the life of a data
analyst, you’re going to run into incomplete data sets daily. COUNTA will
allow you to evaluate any gaps the dataset might have without having to
reorganize the data.
Formula:
• =COUNTA(SELECT CELL) / =COUNTA(SELECT RANGE)
• example:
• =COUNTA(A10) or =COUNTA(B:B)
Either Return 1 (for TRUE) or 0 (for FALSE) or Number of Values(for Range)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
12
COUNTA
• COUNTA: To count cells that are not empty.
• COUNT: To count cells that contain numbers.
• COUNTBLANK: To count cells that are blank.
• COUNTIF: To count cells that meets a specified criteria.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
13
DAYS/NETWORKDAYS
• =DAYS is exactly what it implies. This function determines the number of calendar days between
two dates. This is a useful tool for assessing the lifecycle of products, contracts, and run rating
revenue depending on service length – a data analysis essential.
=NETWORKDAYS is slightly more robust and useful. This formula determines the number of
“workdays” between two dates as well as an option to account for holidays. Even workaholics
need a break now and then! Using these two formulas to compare time frames is especially
helpful for project management.
• Formulas:
=DAYS(SELECT CELL, SELECT CELL)
• OR
=NETWORKDAYS(SELECT CELL, SELECT CELL,[numberofholidays])
note: [numberofholidays] is optional
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
14
DAYS/NETWORKDAYS (cont.)
• example:
• =DAYS(C8,B8)
• OR
• =NETWORKDAYS(B7,C7,3)
Check:
• What if we put Start Date before End Date in the argument of days()?
• How to mention todays date?
• How to series fill the date?
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
15
SUMIFS
• =SUMIFS is one of the “must-know” formulas for a data analyst. The
common formula used is =SUM, but what if you need to sum values based
on multiple criteria? SUMIFS is it. In the example below, SUMIFS is used to
determine how much each product is contributing to top-line revenue.
• Formula:
=SUMIFS (sum_range, range1, criteria1, [range2], [criteria2], ...)
• example:
= SUMIFS(F5:F11,C5:C11,"red") // sum if red
= SUMIFS(F5:F11,C5:C11,"red",D5:D11,"TX") // sum if red and TX
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
16
SUMIFS (cont.)
Arguments:
• sum_range - The range to be summed.
• range1 - The first range to evaluate.
• criteria1 - The criteria to use on range1.
• range2 - [optional] The second range to evaluate.
• criteria2 - [optional] The criteria to use on range2.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
17
< Cell Locks >
• When you write a cell reference in a formula immediately press F4 to
add a $ symbol. In this manner you lock row and column of the cell.
Press again F4 to lock only the column and again F4 to lock only the
row.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
18
AVERAGEIFS
• Much like SUMIFS, AVERAGEIFS allows you to take an average based
on one or more criteria.
Formula:
• =AVERAGEIF(SELECT CELL, CRITERIA,[AVERAGE_RANGE])
• note: [average_range] is optional
• example:
• =AVERAGEIF($C:$C,$A:$A,$F2)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
19
VLOOKUP
• VLOOKUP is one of the most useful and recognizable data analysis
functions. As an Excel user, you’ll probably need to “marry” data together
at some point. For example, accounts receivable might know how much
each product costs, but the shipping department can only provide units
shipped. This is the perfect use case for VLOOKUP.
Formula:
• =VLOOKUP(LOOKUP_VALUE,TABLE_ARRAY,COL_INDEX_NUM,
[RANGE_LOOKUP])
• example:
• =VLOOKUP(A5,$A$1:$G$44,3)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
20
VLOOKUP (cont.)
Arguments of VLOOKUP Function:
• lookup_value: It is a mandatory field, provides the value which the user wants to search
in the column or range. If the value is not found in the range or table array, then it will
return the ‘#N/A’ error.
• table_array: It is a mandatory field, the range where a user wants to look up the value. It
should contain all the value of the Col_index_num.
• col_index_num: It is a mandatory field, the column number in the table_array from the
first column of table_array. It will return ‘#REF!’ error if the number of
column_index_num is greater than the number of columns in table_array
• range_lookup: It is an optional field, by default it will take as an exact match. it has two
option either true or false.
• FALSE – It will check for the exact match in the range. For this provide value as 1. In this,
the column must be sorted numerically or alphabetically.
• TRUE – It will check for the approximate match in the range. For this provide value as 0.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
21
VLOOKUP (cont.)
• VLOOKUP can only look to the right.
• You should Sort first if possible.
• It can return only Unique Identity.
Check:
• If the Lookup object is out of range?
• If there is multiple entry in same lookup?
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
22
HLOOKUP
• Similar to VLOOKUP, Just consider ‘Horizontal’ data instead of
‘Vertical’.
• DIY (Do It Yourself) !!
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
23
FIND/SEARCH
• =FIND/=SEARCH are powerful functions for isolating specific text within a data
set. Both are listed here because =FIND will return a case-sensitive match, i.e. if
you use FIND to query for “Big” you will only return Big=true results. But a
=SEARCH for “Big” will match with Big or big, making the query a bit broader. This
is particularly useful for looking for anomalies or unique identifiers.
Formula:
• =FIND(TEXT,WITHIN_TEXT,[START_NUMBER]) OR
=SEARCH(TEXT,WITHIN_TEXT,[START_NUMBER])
• note: [start_number] is optional and is used to indicate the starting cell in the text
to search
• example:
• =(FIND(“Central”, B2))
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
24
IFERROR
• =IFERROR is something that any analyst who actively presents data should
take advantage of. Using the previous example, looking for specific
text/values in a dataset won’t return a match. This causes a #VALUE error,
and while harmless, it is distracting and an eyesore.
Use =IFERROR to replace the #VALUE errors with any text/value. In the
example above, the cell is blank so that data consumers can easily pick out
which rows returned a matching value.
Formula:
• =IFERROR(FIND“VALUE”,SELECT CELL,VALUE_IF_ERROR)
• example:
• =IFERROR((FIND("Central",B2)), "Error Found") or =IFERROR(E2/D2, “”)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
25
IFERROR
• The IFERROR function in Excel handles all error types including #DIV/0!,
#N/A, #NAME?, #NULL!, #NUM!, #REF!, and #VALUE!.
• Depending on the contents of the value_if_error argument, IFERROR can
replace errors with your custom text message, number, date or logical
value, the result of another formula, or an empty string (blank cell).
• If the value argument is a blank cell, it is treated as an empty string (''') but
not an error.
• IFERROR was introduced in Excel 2007 and is available in all subsequent
versions of Excel 2010, Excel 2013, and Excel 2016.
• To trap errors in Excel 2003 and earlier versions, use the ISERROR function
in combination with IF.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
26
IFERROR
Excel IFERROR with Vlookup:
• Set Any Date in any Cell.
• =IFERROR(VLOOKUP(K4,Sheet1!$A$1:$G$44,3,FALSE),"Not Found")
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
27
COUNTIFS
• =COUNTIFS is the easiest way to count the number of instances a
dataset meets a set of criteria. COUNTIFS is powerful because of the
limitless criteria you can input.
Formula:
• =COUNTIFS(RANGE,CRITERIA)
• example:
• =COUNTIFS(C:C,C10)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
28
COUNTIFS
• COUNTIFS formula with multiple criteria
=COUNTIFS($C:$C,"Jones",$E:$E,">50")
• COUNTIFS formula with the same criteria- Same as above except
condition allotment (>, <, = etc.)
• Add up two or more COUNTIF or COUNITFS formulas
=COUNTIFS($D:$D,"Pen")+COUNTIFS($D:$D,"Pencil")
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
29
COUNTIF vs. COUNTIFS
• COUNTIF() lets you count items based on ONE condition (example,
count fruits that are yellow) whereas COUNTIFS() lets you count items
based on MULTIPLE conditions (example, count fruits that are yellow
AND round AND taste sour)
• COUNTIF() was the first iteration in Excel of this conditional formula.
A few versions later COUNTIFS() was introduced (along with SUMIFS
and AVERAGEIFS). COUNTIF() was then made obsolete but was kept
for backward compatibility with older spreadsheets
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
30
LEFT/RIGHT
• =LEFT, =RIGHT are efficient and straightforward methods for extracting static data out of
cells. =LEFT will return the “x” number of characters from the beginning of the cell, while
=right will return the “x” number of characters from the end of the cell. In the example
below, =LEFT is used to extract the consumer’s area code from their phone number,
while =RIGHT is used to extract the last four digits.
Formula:
• =LEFT(SELECT CELL,NUMBER)
• OR
• =RIGHT(SELECT CELL,NUMBER)
• example:
• =LEFT(G2, 3)
• AND
• =RIGHT(G2,4)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
31
RANK
• =RANK is an ancient excel function, but that doesn’t downplay its
effectiveness for data analysis. =RANK allows you to quickly denote how
values rank in a dataset in ascending or descending order. In the example,
RANK is being used to determine which clients order the most product.
Formula:
• =RANK(SELECT CELL,RANGE_TO_RANK_AGAINST,[ORDER])
• note: [order] is optional
• example:
• =RANK(H1,$H$1:$H$43)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
32
RANK
• DIY- Try to Sort the Column Total According to the rank.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
33
MINIFS (office 365)/ Min(If())-Excel
• MINIFS (office 365)
• =MINIFS is very similar to the min function except it allows you to
take the minimum of a set of values, and match on criteria as well. In
the example, =MINIFS/Min(If()) is used to find the lowest value sold
by the particular representative.
Formula:
• =MINIFS(RANGE1,CRITERIA1,RANGE2)
• example:
• =MINIFS($B$B,$A:$A,$E5)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
34
MINIFS (office 365)/ Min(If())-Excel
• Min(If())-Excel
=MIN(IF($C$2:$C$44=$C$3,$G$2:$G$44))
You might not get correct answer(!!). If not, Let me know!!
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
35
MINIFS (office 365)/ Min(If())-Excel
• Press Ctrl+Shift+Enter to get desired result.
• You will see an extra {} on start and end of function. It will be added
automatically because of pressing CTRL+SHIFT+ENTER.
• The purpose: The If function will handle the arguments in array.
• DIY- Minimum if multiple criteria
• Generic formula :
{=MIN(IF(rng1=criteria1,IF(rng2=criteria2,values)))}
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
36
MINIFS (office 365)/ Min(If())-Excel
• MINIFS will return zero (0) if no cells match criteria.
• Criteria range(s) must be the same size as the min_range.
• MINIFS will return a #VALUE error if a criteria range is not the same
size as the min_range.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
37
MAXIFS (office 365)/ Max(If())-Excel
• =MAXIFS, like its counterpart minifs, allows you to match on criteria,
but this time it looks for the maximum number.
Formula:
• =MAXIFS(RANGE1,CRITERIA1,RANGE2)
• example:
• =MAXIFS($B$B,$A:$A,$E5)
• For Max(If))- DIY of the same example.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
38
SUMPRODUCT
• =SUMPRODUCT is an excellent function to calculate average returns, price
points, and margins. SUMPRODUCT multiples one range of values by its
corresponding row counterparts. It’s data analysis gold. In the example
below, we will create an array of (1:4) and (5:8) and then use this formula.
Formula:
• =SUMPRODUCT(RANGE1,RANGE2)
• example:
• =SUMPRODUCT(B2:B9,C2:C9)/C10 – If you wish to get the average value.
Or, =SUMPRODUCT(A2:A16,B2:B16)/SUM(B2:B16)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
39
Extra-01: XLOOKUP (Office365)
• The Excel XLOOKUP function is a modern and flexible replacement for
older functions like VLOOKUP, HLOOKUP, and LOOKUP. XLOOKUP
supports approximate and exact matching, wildcards (* ?) for partial
matches, and lookups in vertical or horizontal ranges.
• Syntax
=XLOOKUP (lookup, lookup_array, return_array, [not_found],
[match_mode], [search_mode])
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
40
Extra-01: XLOOKUP (cont.)
Arguments:
• lookup - The lookup value.
• lookup_array - The array or range to search.
• return_array - The array or range to return.
• not_found - [optional] Value to return if no match found.
• match_mode - [optional] 0 = exact match (default), -1 = exact match
or next smallest, 1 = exact match or next larger, 2 = wildcard match.
• search_mode - [optional] 1 = search from first (default), -1 = search
from last, 2 = binary search ascending, -2 = binary search descending.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
41
Extra-01: XLOOKUP (cont.)
• Match type:
By default, XLOOKUP will perform an exact match. Match behavior is
controlled by an optional argument called match_type, which has the
following options:
Match type Behavior
0 (default) Exact match. Will return #N/A if no match.
-1 Exact match or next smaller item.
1 Exact match or next larger item.
2 Wildcard match (*, ?, ~)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
42
Extra-01: XLOOKUP (cont.)
• Search mode:
By default, XLOOKUP will start matching from the first data value. Search behavior is
controlled by an optional argument called search_mode, which provides the following
options:
Search mode Behavior
1 (default) Search from first value
-1 Search from last value (reverse)
2 Binary search values sorted in ascending order
-2 Binary search values sorted in descending order
• Binary searches are very fast, but data must be sorted as required. If data is not sorted
properly, a binary search can return invalid results that look perfectly normal.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
43
Extra-01: XLOOKUP (cont.)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
44
Extra-01: XLOOKUP (cont.)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
45
Extra-01: XLOOKUP (cont.)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
46
Extra-01: XLOOKUP (cont.)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
47
Extra-01: XLOOKUP (cont.)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
48
Extra-01: XLOOKUP (cont.)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
49
Extra-01: XLOOKUP (cont.)
XLOOKUP benefits:
• XLOOKUP offers several important advantages, especially compared to
VLOOKUP:
• XLOOKUP can lookup data to the right or left of lookup values
• XLOOKUP can return multiple results (example #3 above)
• XLOOKUP defaults to an exact match (VLOOKUP defaults to approximate)
• XLOOKUP can work with vertical and horizontal data
• XLOOKUP can perform a reverse search (last to first)
• XLOOKUP can return entire rows or columns, not just one value
• XLOOKUP can work with arrays natively to apply complex criteria
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
50
Extra-01: XLOOKUP (cont.)
• XLOOKUP can work with both vertical and horizontal arrays.
• XLOOKUP will return #N/A if the lookup value is not found.
• The lookup_array must have a dimension compatible with the
return_array argument, otherwise XLOOKUP will return #VALUE!
• If XLOOKUP is used between workbooks, both workbooks must be
open, otherwise XLOOKUP will return #REF!.
• Like the INDEX function, XLOOKUP returns a reference as a result.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
51
Extra-02: Lower/ Upper/ Proper
• These three functions help to change the text to lower, upper, and
sentence case respectively (First letter of each word capital).
• Syntax: =Upper(Text)/ Lower(Text) / Proper(Text)
• In a data analysis project, these are helpful in converting classes of a
different case to a single case else these are considered as different
classes of the given feature.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
52
Extra-03: TRIM
• This is a handy function used to clean text that has leading and
trailing white space. Often when you get a dump of data from a
database the text you’re dealing with is padded with blanks. And if
you don’t deal with them, they are also treated as unique entries in a
list, which is certainly not helpful.
• Syntax: =Trim(Text)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
53
Extra-04: IF
• One of the most useful functions in excel. It lets you use conditional
formulas that calculate one way when a certain thing is true and
another way when false. For example, you want to mark each sales as
“High” and “Low”. If sales are greater than or equals to $5000 then
“High” else “Low”.
• Syntax: =IF(condition, True Statement, False Statement)
• =IF($G$2:$G$44>449.1, "High", "Low")
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
54
Error Handling
• Excel functions like VLOOKUP, MATCH, and INDEX are great tools, but
when they don’t work, they throw errors that can break an entire
spreadsheet if referenced incorrectly. Error messages can be
especially bad if they show up on end-user worksheets like reports
and dashboards.
• Fortunately, Excel has a way to catch errors like #VALUE!, #NUM!, and
#REF! before they show up.
• When you use functions in Excel, they expect their inputs to have
certain characteristics. When you use SUM to add cells together, Excel
assumes that the references are numbers. Whenever Excel doesn’t
find what it expects, it will return an error message.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
55
Error Handling- Excel Error Types
• #VALUE!
#VALUE! is likely the most common of errors. It occurs whenever the
data type a function is given doesn’t match what it is expecting. A
simple example would be adding a text value to a number:
="A"+1
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
56
Error Handling- Excel Error Types
• #REF!
#REF! errors happen when a cell reference is deleted or moved. Excel
tries to automatically update all references, but when it can’t do so, it
replaces the actual cell reference with the error. For example, if we
added the contents of cells A1 and B1, the function would look like this:
• =A1+B1
After deleting cell B1, the function would revert to this:
• =A1+#REF!
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
57
Error Handling- Excel Error Types
• #DIV/0!
#DIV/0! happens when a mathematical operation attempts to divide by
zero (which isn’t possible). Usually, this occurs because a COUNT or
SUM results in zero and another cell is operating on its result. A simple
example is dividing any number by zero:
=1/0
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
58
Error Handling- Excel Error Types
• #NAME?
#NAME? appears when Excel can’t find a named range. Excel assumes
that any un-quoted string that isn’t a function name is a named range.
You will most likely encounter this when you forget to quote a string or
mis-type a cell reference. For example:
=A+1
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
59
Error Handling- Excel Error Types
• #NULL!
#NULL! gets returned when Excel can’t figure out the range specified in
a cell. This can happen when you put a space between function inputs
instead of using a comma/colon. For example:
=SUM(A1 C1)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
60
Error Handling- Excel Error Types
• #N/A
#N/A happens when a function like MATCH or VLOOKUP cannot find
the value it is being asked to look for. For example:
=MATCH("A",{"B","C"},0)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
61
Error Handling- Excel Error Types
• #GETTING_DATA
#GETTING_DATA is a message that can appear in Excel when a large or
complex worksheet is being calculated. In Excel 2007 and newer,
operations are grouped so more complicated cells may finish after
earlier ones do. While the calculations are still processing, the
unfinished cells may display #GETTING_DATA. Because the message is
temporary and disappears when the calculations complete, this isn’t a
true error.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
62
Error Handling- Excel Error Handling Functions
• ISNA
The ISNA function evaluates an #N/A error and returns a TRUE boolean.
If the input isn’t an #N/A error, it returns FALSE. The syntax is as
follows:
• =ISNA(value)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
63
Error Handling- Excel Error Handling Functions
• ISERR
The ISERR function evaluates all error types except for #N/A. If the
input is a #VALUE!, #REF!, #DIV/0, #NAME?, or #NULL! error, ISERR
returns a TRUE boolean. If it is none of those error types, it returns
FALSE. The syntax is as follows:
• =ISERR(value)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
64
Error Handling- Excel Error Handling Functions
• ISERROR
The ISERROR function catches all error types and returns a TRUE
boolean. If the input is a #VALUE!, #REF!, #DIV/0, #NAME?, #NULL! or
#N/A error, it returns TRUE. If it is not an error, it returns FALSE. The
syntax is as follows:
• =ISERROR(value)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
65
Error Handling- Excel Error Handling Functions
• ERROR.TYPE
The ERROR.TYPE function will return a number from 1 through 8 that
corresponds to the type of error in it’s input cell reference. If the cell
reference doesn’t contain an error, the function returns it’s own #N/A
error. The possible output values for ERROR.TYPE are as follows:
For example, if cell A1 contains a #VALUE! error:
=ERROR.TYPE(A1)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
66
Error Handling- Excel Error Handling Functions
• IFERROR
The IFERROR function combines the IF and ISERROR functions to allow
an alternate function to be used if an error occurs. The syntax is as
follows:
• =IFERROR(value, value_if_error)
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
67
Error Handling-
Common Error Handling Techniques
• Catching Lookup Errors with IFERROR
When using VLOOKUP or HLOOKUP to fill fields from a lookup table,
these functions will give an error if a match is not found. Rather than
displaying an unsightly #VALUE!, IFERROR can catch the error and
display an alternate message. Look at the following example:
• =IFERROR(VLOOKUP(A1,C:C,1,FALSE),"No Match")
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
68
Error Handling-
Common Error Handling Techniques
• Nested IFERROR Lookups
If a lookup like MATCH errors out on the first attempt, nested IFERROR
functions can run a second or even a third lookup in its value_if_error field.
Look at the following example:
=IFERROR(MATCH(A1,F2:F11,0),IFERROR(MATCH(A1,G:G,0),"No Match"))
• In the above example, the first MATCH is trying to find the contents of cell
A1 in the cells F2:F11. If it can’t find a match, normally it would return an
error, but instead, we do another search for A1 in column G. Finally, if both
MATCH functions, then the second IFERROR displays “No Match”.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
69
Error Handling-
Common Error Handling Techniques
• VLOOKUP and #N/A errors
If you use VLOOKUP you will inevitably run into the #N/A error. The #N/A error just
means "not found". For example, in the screen below, the lookup value "Toy Story
2" does not exist in the lookup table, and all three VLOOKUP formulas return #N/A:
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
70
Error Handling-
Common Error Handling Techniques
• VLOOKUP and #N/A errors
One way to "trap" the NA error is to use the IFNA function like this:
The formula in H6 is:
=IFNA(VLOOKUP(H4,B5:E9,2,FALSE),"Not found")
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
71
Data Validation
• ‘Data Validation’ can be found on ‘Data’ Tab of MS Excel.
• Data validation is a feature in Excel used to control what a user can
enter into a cell. For example, you could use data validation to make
sure a value is a number between 1 and 6, make sure a date occurs in
the next 30 days, or make sure a text entry is less than 25 characters.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
72
Data Validation (cont.)
• Data validation can simply display a message to a user telling them
what is allowed as shown below:
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
73
Data Validation (cont.)
Data validation is defined in a window with 3 tabs: Settings, Input
Message, and Error Alert:
Let’s try it practically….
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
74
Macro
• If you have tasks in Microsoft Excel that you do repeatedly, you can record a
macro to automate those tasks. Kind of Robotic Process Automation [RPA]
• A macro is an action or a set of actions that you can run as many times as you
want. When you create a macro, you are recording your mouse clicks and
keystrokes.
• After you create a macro, you can edit it to make minor changes to the way it
works.
• Suppose, that every month, you create a report for your accounting manager. You
want to format the names of the customers with overdue accounts in red, and
also apply bold formatting. You can create and then run a macro that quickly
applies these formatting changes to the cells you select.
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
75
Macro (cont.)
• Before you use ‘Macro’, you need to activate ‘Developer’ tab in the
ribbon.
• The process is very simple, just follow:
MS Excel > File > Options > Customize Ribbon > Check the ‘Developer’
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
76
Macro (cont.)
1. Before Activating Developer
2. During Activating Developer
3. After Activating Developer
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
77
Macro (cont.)
CreatingaNewMacro
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
78
Macro (cont.)
• Example:
- In the given ‘Dataset-1’, We want to rename the ‘Desk’ in the item column.
The change is to add ‘top’ after ‘Desk’ and make it ‘Desktop’.
Process:
Select the Range> Start Macro> Put the name of macro > Assign Shotcut
Key> Small Description> CTRL+F > Find and Replace All with Desk-Desktop >
Stop Macro
- Let’s check How to create this Macro and apply it for several times.
- It will be interesting!!
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
79
Macro (cont.)
• Do you know, you can even Sell your ‘Custom-made’ Macro
online???
Let’s Check:
https://www.qimacros.com/hypothesis-testing/
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
80
Bibliography
• https://support.microsoft.com/en-us/office/quick-start-create-a-macro-
741130ca-080d-49f5-9471-1e5fb3d581a8’
• https://corporatefinanceinstitute.com/resources/excel/study/basic-excel-
formulas-beginners/
• https://excelwithbusiness.com/blog/15-excel-data-analysis-functions-
need/
• https://exceljet.net/excel-functions/excel-sumifs-function
• https://exceljet.net/excel-functions/excel-vlookup-function
• https://exceljet.net/excel-functions/excel-xlookup-function
• https://www.analyticsvidhya.com/blog/2020/04/excel-tips-tricks-data-
analysis/
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
81
Bibliography
• https://www.exceltactics.com/definitive-guide-excel-error-types-error-handling/
• https://magoosh.com/excel/sumproduct-formula-excel/
• https://exceljet.net/formula/minimum-if-multiple-criteria
• https://contexturesblog.com/archives/2011/07/27/finding-min-if-or-max-if-in-excel/
• https://www.excelforum.com/excel-general/1216870-maxifs-and-minifs-not-available.html
• https://exceljet.net/excel-functions/excel-minifs-function
• https://www.quora.com/Whats-the-difference-between-COUNTIF-and-COUNTIFS-in-Excel
• https://www.ablebits.com/office-addins-blog/2014/07/10/excel-countifs-multiple-criteria/
• https://exceljet.net/formula/basic-tax-rate-calculation-with-vlookup
• https://exceljet.net/excel-functions/excel-vlookup-function
• https://www.ablebits.com/office-addins-blog/2017/09/27/excel-iferror-function-with-formula-
examples/
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
82
Bibliography
• https://www.youtube.com/watch?v=gawMCJHpr8w
• https://www.digitalvidya.com/blog/how-to-analyze-data-in-excel/
• https://exceljet.net/formula/count-visible-rows-in-a-filtered-list
• https://exceljet.net/excel-data-validation-guide
09-Sep-20
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com
83
Anything you want me to tell?
Thank You
See you on next class…
09-Sep-20 84
Content sources are mentioned in bottom 03 Slides |
redwan.contact@gmail.com

Elementary Data Analysis with MS Excel_Day-3

  • 1.
    Elementary Data Analysis withMS Excel Redwan Ferdous Electrical Engineer| Tech Enthusiast| Robotics | Automobile| Data Science | Tech-Entrepreneur & Investor | redwan.contact@gmail.com | ferdousr@emk.com.bd https://sites.google.com/view/redwanferdous Day: 03 out of 06 | September 09, 2020
  • 2.
    Today’s Agenda (IF, NestedIF, VLOOKUP, HLOOKUP) - Formulas and Functions - List of Formulas [Practical] - 15 Important Functions for Data Analysis+ Practice - Error Handling - Data Validation - Macro 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 2
  • 3.
    But before that…. •EXAM!!!! •Access the questions from here: https://forms.gle/AXcyWKmSc53dNuWb8 • It is a Closed-Book Exam. • Total Time 10 Minutes. Total 09 Questions. Answer all. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 3
  • 4.
    09-Sep-20 4 Elementary DataAnalysis with MS Excel Day-03 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com
  • 5.
    Formulas & Functionsof MS Excel There are two basic ways to perform calculations in Excel: Formulas and Functions. 1. Formulas: In Excel, a formula is an expression that operates on values in a range of cells or a cell. For example, =A1+A2+A3, which finds the sum of the range of values from cell A1 to cell A3. 2. Functions: Functions are predefined formulas in Excel. They eliminate laborious manual entry of formulas while giving them human-friendly names. For example: =SUM(A1:A3). The function sums all the values from A1 to A3. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 5
  • 6.
    List of Functions •AutoSum • Financial • Logical • Text • Date & Time • Lookup & Referencce • Math & Triginimetry • Statistical • Engineering • Cube • Information • Compatibility • Web 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 6
  • 7.
    List of Functions •Let’s check 2/3 sample formulas from each section. • Later, we will check 15 Most common/ important formulas separately. Note: • Formula syntax/ parameters are not case sensitive. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 7
  • 8.
    List of 16Important Functions • CONCATENATE • LEN • COUNTA • DAYS/NETWORKDAYS • SUMIFS • AVERAGEIFS • VLOOKUP • HLOOKUP • FIND/SEARCH • IFERROR • COUNTIFS • LEFT/RIGHT • RANK • MINIFS • MAXIFS • SUMPRODUCT 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 8
  • 9.
    CONCATENATE • =CONCATENATE isone of the easiest to learn but most powerful formulas when conducting data analysis. Combine text, numbers, dates and more from multiple cells into one. This is an excellent function for creating API endpoints, product SKUs, and Java queries. Formula: • =CONCATENATE(SELECT CELLS YOU WANT TO COMBINE) • example: • =CONCATENATE(A2,B2) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 9
  • 10.
    LEN • =LEN quicklyprovides the number of characters in a given cell. LEN is especially useful when trying to determine the differences between different Unique Identifiers (UIDs), which are often lengthy and not in the right order. • Formula: =LEN(SELECT CELL) • example: =LEN(A2) • Quick Quiz: Why Len of any date is showing 05 in sample dataset? 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 10
  • 11.
    LEN (cont.) • Checkthe Length of different Decimal Points. • Quick Quiz: Why there is variation of lengths though showing only 2 points after decimal? • Check the length of the Sentence with all 26 Alphabets: “The quick brown fox jumps over the lazy dog” or “Pack my box with five dozen liquor jugs” 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 11
  • 12.
    COUNTA • =COUNTA identifieswhether a cell is empty or not. In the life of a data analyst, you’re going to run into incomplete data sets daily. COUNTA will allow you to evaluate any gaps the dataset might have without having to reorganize the data. Formula: • =COUNTA(SELECT CELL) / =COUNTA(SELECT RANGE) • example: • =COUNTA(A10) or =COUNTA(B:B) Either Return 1 (for TRUE) or 0 (for FALSE) or Number of Values(for Range) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 12
  • 13.
    COUNTA • COUNTA: Tocount cells that are not empty. • COUNT: To count cells that contain numbers. • COUNTBLANK: To count cells that are blank. • COUNTIF: To count cells that meets a specified criteria. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 13
  • 14.
    DAYS/NETWORKDAYS • =DAYS isexactly what it implies. This function determines the number of calendar days between two dates. This is a useful tool for assessing the lifecycle of products, contracts, and run rating revenue depending on service length – a data analysis essential. =NETWORKDAYS is slightly more robust and useful. This formula determines the number of “workdays” between two dates as well as an option to account for holidays. Even workaholics need a break now and then! Using these two formulas to compare time frames is especially helpful for project management. • Formulas: =DAYS(SELECT CELL, SELECT CELL) • OR =NETWORKDAYS(SELECT CELL, SELECT CELL,[numberofholidays]) note: [numberofholidays] is optional 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 14
  • 15.
    DAYS/NETWORKDAYS (cont.) • example: •=DAYS(C8,B8) • OR • =NETWORKDAYS(B7,C7,3) Check: • What if we put Start Date before End Date in the argument of days()? • How to mention todays date? • How to series fill the date? 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 15
  • 16.
    SUMIFS • =SUMIFS isone of the “must-know” formulas for a data analyst. The common formula used is =SUM, but what if you need to sum values based on multiple criteria? SUMIFS is it. In the example below, SUMIFS is used to determine how much each product is contributing to top-line revenue. • Formula: =SUMIFS (sum_range, range1, criteria1, [range2], [criteria2], ...) • example: = SUMIFS(F5:F11,C5:C11,"red") // sum if red = SUMIFS(F5:F11,C5:C11,"red",D5:D11,"TX") // sum if red and TX 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 16
  • 17.
    SUMIFS (cont.) Arguments: • sum_range- The range to be summed. • range1 - The first range to evaluate. • criteria1 - The criteria to use on range1. • range2 - [optional] The second range to evaluate. • criteria2 - [optional] The criteria to use on range2. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 17
  • 18.
    < Cell Locks> • When you write a cell reference in a formula immediately press F4 to add a $ symbol. In this manner you lock row and column of the cell. Press again F4 to lock only the column and again F4 to lock only the row. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 18
  • 19.
    AVERAGEIFS • Much likeSUMIFS, AVERAGEIFS allows you to take an average based on one or more criteria. Formula: • =AVERAGEIF(SELECT CELL, CRITERIA,[AVERAGE_RANGE]) • note: [average_range] is optional • example: • =AVERAGEIF($C:$C,$A:$A,$F2) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 19
  • 20.
    VLOOKUP • VLOOKUP isone of the most useful and recognizable data analysis functions. As an Excel user, you’ll probably need to “marry” data together at some point. For example, accounts receivable might know how much each product costs, but the shipping department can only provide units shipped. This is the perfect use case for VLOOKUP. Formula: • =VLOOKUP(LOOKUP_VALUE,TABLE_ARRAY,COL_INDEX_NUM, [RANGE_LOOKUP]) • example: • =VLOOKUP(A5,$A$1:$G$44,3) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 20
  • 21.
    VLOOKUP (cont.) Arguments ofVLOOKUP Function: • lookup_value: It is a mandatory field, provides the value which the user wants to search in the column or range. If the value is not found in the range or table array, then it will return the ‘#N/A’ error. • table_array: It is a mandatory field, the range where a user wants to look up the value. It should contain all the value of the Col_index_num. • col_index_num: It is a mandatory field, the column number in the table_array from the first column of table_array. It will return ‘#REF!’ error if the number of column_index_num is greater than the number of columns in table_array • range_lookup: It is an optional field, by default it will take as an exact match. it has two option either true or false. • FALSE – It will check for the exact match in the range. For this provide value as 1. In this, the column must be sorted numerically or alphabetically. • TRUE – It will check for the approximate match in the range. For this provide value as 0. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 21
  • 22.
    VLOOKUP (cont.) • VLOOKUPcan only look to the right. • You should Sort first if possible. • It can return only Unique Identity. Check: • If the Lookup object is out of range? • If there is multiple entry in same lookup? 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 22
  • 23.
    HLOOKUP • Similar toVLOOKUP, Just consider ‘Horizontal’ data instead of ‘Vertical’. • DIY (Do It Yourself) !! 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 23
  • 24.
    FIND/SEARCH • =FIND/=SEARCH arepowerful functions for isolating specific text within a data set. Both are listed here because =FIND will return a case-sensitive match, i.e. if you use FIND to query for “Big” you will only return Big=true results. But a =SEARCH for “Big” will match with Big or big, making the query a bit broader. This is particularly useful for looking for anomalies or unique identifiers. Formula: • =FIND(TEXT,WITHIN_TEXT,[START_NUMBER]) OR =SEARCH(TEXT,WITHIN_TEXT,[START_NUMBER]) • note: [start_number] is optional and is used to indicate the starting cell in the text to search • example: • =(FIND(“Central”, B2)) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 24
  • 25.
    IFERROR • =IFERROR issomething that any analyst who actively presents data should take advantage of. Using the previous example, looking for specific text/values in a dataset won’t return a match. This causes a #VALUE error, and while harmless, it is distracting and an eyesore. Use =IFERROR to replace the #VALUE errors with any text/value. In the example above, the cell is blank so that data consumers can easily pick out which rows returned a matching value. Formula: • =IFERROR(FIND“VALUE”,SELECT CELL,VALUE_IF_ERROR) • example: • =IFERROR((FIND("Central",B2)), "Error Found") or =IFERROR(E2/D2, “”) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 25
  • 26.
    IFERROR • The IFERRORfunction in Excel handles all error types including #DIV/0!, #N/A, #NAME?, #NULL!, #NUM!, #REF!, and #VALUE!. • Depending on the contents of the value_if_error argument, IFERROR can replace errors with your custom text message, number, date or logical value, the result of another formula, or an empty string (blank cell). • If the value argument is a blank cell, it is treated as an empty string (''') but not an error. • IFERROR was introduced in Excel 2007 and is available in all subsequent versions of Excel 2010, Excel 2013, and Excel 2016. • To trap errors in Excel 2003 and earlier versions, use the ISERROR function in combination with IF. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 26
  • 27.
    IFERROR Excel IFERROR withVlookup: • Set Any Date in any Cell. • =IFERROR(VLOOKUP(K4,Sheet1!$A$1:$G$44,3,FALSE),"Not Found") 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 27
  • 28.
    COUNTIFS • =COUNTIFS isthe easiest way to count the number of instances a dataset meets a set of criteria. COUNTIFS is powerful because of the limitless criteria you can input. Formula: • =COUNTIFS(RANGE,CRITERIA) • example: • =COUNTIFS(C:C,C10) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 28
  • 29.
    COUNTIFS • COUNTIFS formulawith multiple criteria =COUNTIFS($C:$C,"Jones",$E:$E,">50") • COUNTIFS formula with the same criteria- Same as above except condition allotment (>, <, = etc.) • Add up two or more COUNTIF or COUNITFS formulas =COUNTIFS($D:$D,"Pen")+COUNTIFS($D:$D,"Pencil") 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 29
  • 30.
    COUNTIF vs. COUNTIFS •COUNTIF() lets you count items based on ONE condition (example, count fruits that are yellow) whereas COUNTIFS() lets you count items based on MULTIPLE conditions (example, count fruits that are yellow AND round AND taste sour) • COUNTIF() was the first iteration in Excel of this conditional formula. A few versions later COUNTIFS() was introduced (along with SUMIFS and AVERAGEIFS). COUNTIF() was then made obsolete but was kept for backward compatibility with older spreadsheets 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 30
  • 31.
    LEFT/RIGHT • =LEFT, =RIGHTare efficient and straightforward methods for extracting static data out of cells. =LEFT will return the “x” number of characters from the beginning of the cell, while =right will return the “x” number of characters from the end of the cell. In the example below, =LEFT is used to extract the consumer’s area code from their phone number, while =RIGHT is used to extract the last four digits. Formula: • =LEFT(SELECT CELL,NUMBER) • OR • =RIGHT(SELECT CELL,NUMBER) • example: • =LEFT(G2, 3) • AND • =RIGHT(G2,4) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 31
  • 32.
    RANK • =RANK isan ancient excel function, but that doesn’t downplay its effectiveness for data analysis. =RANK allows you to quickly denote how values rank in a dataset in ascending or descending order. In the example, RANK is being used to determine which clients order the most product. Formula: • =RANK(SELECT CELL,RANGE_TO_RANK_AGAINST,[ORDER]) • note: [order] is optional • example: • =RANK(H1,$H$1:$H$43) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 32
  • 33.
    RANK • DIY- Tryto Sort the Column Total According to the rank. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 33
  • 34.
    MINIFS (office 365)/Min(If())-Excel • MINIFS (office 365) • =MINIFS is very similar to the min function except it allows you to take the minimum of a set of values, and match on criteria as well. In the example, =MINIFS/Min(If()) is used to find the lowest value sold by the particular representative. Formula: • =MINIFS(RANGE1,CRITERIA1,RANGE2) • example: • =MINIFS($B$B,$A:$A,$E5) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 34
  • 35.
    MINIFS (office 365)/Min(If())-Excel • Min(If())-Excel =MIN(IF($C$2:$C$44=$C$3,$G$2:$G$44)) You might not get correct answer(!!). If not, Let me know!! 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 35
  • 36.
    MINIFS (office 365)/Min(If())-Excel • Press Ctrl+Shift+Enter to get desired result. • You will see an extra {} on start and end of function. It will be added automatically because of pressing CTRL+SHIFT+ENTER. • The purpose: The If function will handle the arguments in array. • DIY- Minimum if multiple criteria • Generic formula : {=MIN(IF(rng1=criteria1,IF(rng2=criteria2,values)))} 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 36
  • 37.
    MINIFS (office 365)/Min(If())-Excel • MINIFS will return zero (0) if no cells match criteria. • Criteria range(s) must be the same size as the min_range. • MINIFS will return a #VALUE error if a criteria range is not the same size as the min_range. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 37
  • 38.
    MAXIFS (office 365)/Max(If())-Excel • =MAXIFS, like its counterpart minifs, allows you to match on criteria, but this time it looks for the maximum number. Formula: • =MAXIFS(RANGE1,CRITERIA1,RANGE2) • example: • =MAXIFS($B$B,$A:$A,$E5) • For Max(If))- DIY of the same example. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 38
  • 39.
    SUMPRODUCT • =SUMPRODUCT isan excellent function to calculate average returns, price points, and margins. SUMPRODUCT multiples one range of values by its corresponding row counterparts. It’s data analysis gold. In the example below, we will create an array of (1:4) and (5:8) and then use this formula. Formula: • =SUMPRODUCT(RANGE1,RANGE2) • example: • =SUMPRODUCT(B2:B9,C2:C9)/C10 – If you wish to get the average value. Or, =SUMPRODUCT(A2:A16,B2:B16)/SUM(B2:B16) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 39
  • 40.
    Extra-01: XLOOKUP (Office365) •The Excel XLOOKUP function is a modern and flexible replacement for older functions like VLOOKUP, HLOOKUP, and LOOKUP. XLOOKUP supports approximate and exact matching, wildcards (* ?) for partial matches, and lookups in vertical or horizontal ranges. • Syntax =XLOOKUP (lookup, lookup_array, return_array, [not_found], [match_mode], [search_mode]) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 40
  • 41.
    Extra-01: XLOOKUP (cont.) Arguments: •lookup - The lookup value. • lookup_array - The array or range to search. • return_array - The array or range to return. • not_found - [optional] Value to return if no match found. • match_mode - [optional] 0 = exact match (default), -1 = exact match or next smallest, 1 = exact match or next larger, 2 = wildcard match. • search_mode - [optional] 1 = search from first (default), -1 = search from last, 2 = binary search ascending, -2 = binary search descending. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 41
  • 42.
    Extra-01: XLOOKUP (cont.) •Match type: By default, XLOOKUP will perform an exact match. Match behavior is controlled by an optional argument called match_type, which has the following options: Match type Behavior 0 (default) Exact match. Will return #N/A if no match. -1 Exact match or next smaller item. 1 Exact match or next larger item. 2 Wildcard match (*, ?, ~) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 42
  • 43.
    Extra-01: XLOOKUP (cont.) •Search mode: By default, XLOOKUP will start matching from the first data value. Search behavior is controlled by an optional argument called search_mode, which provides the following options: Search mode Behavior 1 (default) Search from first value -1 Search from last value (reverse) 2 Binary search values sorted in ascending order -2 Binary search values sorted in descending order • Binary searches are very fast, but data must be sorted as required. If data is not sorted properly, a binary search can return invalid results that look perfectly normal. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 43
  • 44.
    Extra-01: XLOOKUP (cont.) 09-Sep-20 Contentsources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 44
  • 45.
    Extra-01: XLOOKUP (cont.) 09-Sep-20 Contentsources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 45
  • 46.
    Extra-01: XLOOKUP (cont.) 09-Sep-20 Contentsources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 46
  • 47.
    Extra-01: XLOOKUP (cont.) 09-Sep-20 Contentsources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 47
  • 48.
    Extra-01: XLOOKUP (cont.) 09-Sep-20 Contentsources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 48
  • 49.
    Extra-01: XLOOKUP (cont.) 09-Sep-20 Contentsources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 49
  • 50.
    Extra-01: XLOOKUP (cont.) XLOOKUPbenefits: • XLOOKUP offers several important advantages, especially compared to VLOOKUP: • XLOOKUP can lookup data to the right or left of lookup values • XLOOKUP can return multiple results (example #3 above) • XLOOKUP defaults to an exact match (VLOOKUP defaults to approximate) • XLOOKUP can work with vertical and horizontal data • XLOOKUP can perform a reverse search (last to first) • XLOOKUP can return entire rows or columns, not just one value • XLOOKUP can work with arrays natively to apply complex criteria 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 50
  • 51.
    Extra-01: XLOOKUP (cont.) •XLOOKUP can work with both vertical and horizontal arrays. • XLOOKUP will return #N/A if the lookup value is not found. • The lookup_array must have a dimension compatible with the return_array argument, otherwise XLOOKUP will return #VALUE! • If XLOOKUP is used between workbooks, both workbooks must be open, otherwise XLOOKUP will return #REF!. • Like the INDEX function, XLOOKUP returns a reference as a result. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 51
  • 52.
    Extra-02: Lower/ Upper/Proper • These three functions help to change the text to lower, upper, and sentence case respectively (First letter of each word capital). • Syntax: =Upper(Text)/ Lower(Text) / Proper(Text) • In a data analysis project, these are helpful in converting classes of a different case to a single case else these are considered as different classes of the given feature. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 52
  • 53.
    Extra-03: TRIM • Thisis a handy function used to clean text that has leading and trailing white space. Often when you get a dump of data from a database the text you’re dealing with is padded with blanks. And if you don’t deal with them, they are also treated as unique entries in a list, which is certainly not helpful. • Syntax: =Trim(Text) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 53
  • 54.
    Extra-04: IF • Oneof the most useful functions in excel. It lets you use conditional formulas that calculate one way when a certain thing is true and another way when false. For example, you want to mark each sales as “High” and “Low”. If sales are greater than or equals to $5000 then “High” else “Low”. • Syntax: =IF(condition, True Statement, False Statement) • =IF($G$2:$G$44>449.1, "High", "Low") 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 54
  • 55.
    Error Handling • Excelfunctions like VLOOKUP, MATCH, and INDEX are great tools, but when they don’t work, they throw errors that can break an entire spreadsheet if referenced incorrectly. Error messages can be especially bad if they show up on end-user worksheets like reports and dashboards. • Fortunately, Excel has a way to catch errors like #VALUE!, #NUM!, and #REF! before they show up. • When you use functions in Excel, they expect their inputs to have certain characteristics. When you use SUM to add cells together, Excel assumes that the references are numbers. Whenever Excel doesn’t find what it expects, it will return an error message. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 55
  • 56.
    Error Handling- ExcelError Types • #VALUE! #VALUE! is likely the most common of errors. It occurs whenever the data type a function is given doesn’t match what it is expecting. A simple example would be adding a text value to a number: ="A"+1 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 56
  • 57.
    Error Handling- ExcelError Types • #REF! #REF! errors happen when a cell reference is deleted or moved. Excel tries to automatically update all references, but when it can’t do so, it replaces the actual cell reference with the error. For example, if we added the contents of cells A1 and B1, the function would look like this: • =A1+B1 After deleting cell B1, the function would revert to this: • =A1+#REF! 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 57
  • 58.
    Error Handling- ExcelError Types • #DIV/0! #DIV/0! happens when a mathematical operation attempts to divide by zero (which isn’t possible). Usually, this occurs because a COUNT or SUM results in zero and another cell is operating on its result. A simple example is dividing any number by zero: =1/0 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 58
  • 59.
    Error Handling- ExcelError Types • #NAME? #NAME? appears when Excel can’t find a named range. Excel assumes that any un-quoted string that isn’t a function name is a named range. You will most likely encounter this when you forget to quote a string or mis-type a cell reference. For example: =A+1 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 59
  • 60.
    Error Handling- ExcelError Types • #NULL! #NULL! gets returned when Excel can’t figure out the range specified in a cell. This can happen when you put a space between function inputs instead of using a comma/colon. For example: =SUM(A1 C1) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 60
  • 61.
    Error Handling- ExcelError Types • #N/A #N/A happens when a function like MATCH or VLOOKUP cannot find the value it is being asked to look for. For example: =MATCH("A",{"B","C"},0) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 61
  • 62.
    Error Handling- ExcelError Types • #GETTING_DATA #GETTING_DATA is a message that can appear in Excel when a large or complex worksheet is being calculated. In Excel 2007 and newer, operations are grouped so more complicated cells may finish after earlier ones do. While the calculations are still processing, the unfinished cells may display #GETTING_DATA. Because the message is temporary and disappears when the calculations complete, this isn’t a true error. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 62
  • 63.
    Error Handling- ExcelError Handling Functions • ISNA The ISNA function evaluates an #N/A error and returns a TRUE boolean. If the input isn’t an #N/A error, it returns FALSE. The syntax is as follows: • =ISNA(value) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 63
  • 64.
    Error Handling- ExcelError Handling Functions • ISERR The ISERR function evaluates all error types except for #N/A. If the input is a #VALUE!, #REF!, #DIV/0, #NAME?, or #NULL! error, ISERR returns a TRUE boolean. If it is none of those error types, it returns FALSE. The syntax is as follows: • =ISERR(value) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 64
  • 65.
    Error Handling- ExcelError Handling Functions • ISERROR The ISERROR function catches all error types and returns a TRUE boolean. If the input is a #VALUE!, #REF!, #DIV/0, #NAME?, #NULL! or #N/A error, it returns TRUE. If it is not an error, it returns FALSE. The syntax is as follows: • =ISERROR(value) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 65
  • 66.
    Error Handling- ExcelError Handling Functions • ERROR.TYPE The ERROR.TYPE function will return a number from 1 through 8 that corresponds to the type of error in it’s input cell reference. If the cell reference doesn’t contain an error, the function returns it’s own #N/A error. The possible output values for ERROR.TYPE are as follows: For example, if cell A1 contains a #VALUE! error: =ERROR.TYPE(A1) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 66
  • 67.
    Error Handling- ExcelError Handling Functions • IFERROR The IFERROR function combines the IF and ISERROR functions to allow an alternate function to be used if an error occurs. The syntax is as follows: • =IFERROR(value, value_if_error) 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 67
  • 68.
    Error Handling- Common ErrorHandling Techniques • Catching Lookup Errors with IFERROR When using VLOOKUP or HLOOKUP to fill fields from a lookup table, these functions will give an error if a match is not found. Rather than displaying an unsightly #VALUE!, IFERROR can catch the error and display an alternate message. Look at the following example: • =IFERROR(VLOOKUP(A1,C:C,1,FALSE),"No Match") 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 68
  • 69.
    Error Handling- Common ErrorHandling Techniques • Nested IFERROR Lookups If a lookup like MATCH errors out on the first attempt, nested IFERROR functions can run a second or even a third lookup in its value_if_error field. Look at the following example: =IFERROR(MATCH(A1,F2:F11,0),IFERROR(MATCH(A1,G:G,0),"No Match")) • In the above example, the first MATCH is trying to find the contents of cell A1 in the cells F2:F11. If it can’t find a match, normally it would return an error, but instead, we do another search for A1 in column G. Finally, if both MATCH functions, then the second IFERROR displays “No Match”. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 69
  • 70.
    Error Handling- Common ErrorHandling Techniques • VLOOKUP and #N/A errors If you use VLOOKUP you will inevitably run into the #N/A error. The #N/A error just means "not found". For example, in the screen below, the lookup value "Toy Story 2" does not exist in the lookup table, and all three VLOOKUP formulas return #N/A: 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 70
  • 71.
    Error Handling- Common ErrorHandling Techniques • VLOOKUP and #N/A errors One way to "trap" the NA error is to use the IFNA function like this: The formula in H6 is: =IFNA(VLOOKUP(H4,B5:E9,2,FALSE),"Not found") 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 71
  • 72.
    Data Validation • ‘DataValidation’ can be found on ‘Data’ Tab of MS Excel. • Data validation is a feature in Excel used to control what a user can enter into a cell. For example, you could use data validation to make sure a value is a number between 1 and 6, make sure a date occurs in the next 30 days, or make sure a text entry is less than 25 characters. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 72
  • 73.
    Data Validation (cont.) •Data validation can simply display a message to a user telling them what is allowed as shown below: 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 73
  • 74.
    Data Validation (cont.) Datavalidation is defined in a window with 3 tabs: Settings, Input Message, and Error Alert: Let’s try it practically…. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 74
  • 75.
    Macro • If youhave tasks in Microsoft Excel that you do repeatedly, you can record a macro to automate those tasks. Kind of Robotic Process Automation [RPA] • A macro is an action or a set of actions that you can run as many times as you want. When you create a macro, you are recording your mouse clicks and keystrokes. • After you create a macro, you can edit it to make minor changes to the way it works. • Suppose, that every month, you create a report for your accounting manager. You want to format the names of the customers with overdue accounts in red, and also apply bold formatting. You can create and then run a macro that quickly applies these formatting changes to the cells you select. 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 75
  • 76.
    Macro (cont.) • Beforeyou use ‘Macro’, you need to activate ‘Developer’ tab in the ribbon. • The process is very simple, just follow: MS Excel > File > Options > Customize Ribbon > Check the ‘Developer’ 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 76
  • 77.
    Macro (cont.) 1. BeforeActivating Developer 2. During Activating Developer 3. After Activating Developer 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 77
  • 78.
    Macro (cont.) CreatingaNewMacro 09-Sep-20 Content sourcesare mentioned in bottom 03 Slides | redwan.contact@gmail.com 78
  • 79.
    Macro (cont.) • Example: -In the given ‘Dataset-1’, We want to rename the ‘Desk’ in the item column. The change is to add ‘top’ after ‘Desk’ and make it ‘Desktop’. Process: Select the Range> Start Macro> Put the name of macro > Assign Shotcut Key> Small Description> CTRL+F > Find and Replace All with Desk-Desktop > Stop Macro - Let’s check How to create this Macro and apply it for several times. - It will be interesting!! 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 79
  • 80.
    Macro (cont.) • Doyou know, you can even Sell your ‘Custom-made’ Macro online??? Let’s Check: https://www.qimacros.com/hypothesis-testing/ 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 80
  • 81.
    Bibliography • https://support.microsoft.com/en-us/office/quick-start-create-a-macro- 741130ca-080d-49f5-9471-1e5fb3d581a8’ • https://corporatefinanceinstitute.com/resources/excel/study/basic-excel- formulas-beginners/ •https://excelwithbusiness.com/blog/15-excel-data-analysis-functions- need/ • https://exceljet.net/excel-functions/excel-sumifs-function • https://exceljet.net/excel-functions/excel-vlookup-function • https://exceljet.net/excel-functions/excel-xlookup-function • https://www.analyticsvidhya.com/blog/2020/04/excel-tips-tricks-data- analysis/ 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 81
  • 82.
    Bibliography • https://www.exceltactics.com/definitive-guide-excel-error-types-error-handling/ • https://magoosh.com/excel/sumproduct-formula-excel/ •https://exceljet.net/formula/minimum-if-multiple-criteria • https://contexturesblog.com/archives/2011/07/27/finding-min-if-or-max-if-in-excel/ • https://www.excelforum.com/excel-general/1216870-maxifs-and-minifs-not-available.html • https://exceljet.net/excel-functions/excel-minifs-function • https://www.quora.com/Whats-the-difference-between-COUNTIF-and-COUNTIFS-in-Excel • https://www.ablebits.com/office-addins-blog/2014/07/10/excel-countifs-multiple-criteria/ • https://exceljet.net/formula/basic-tax-rate-calculation-with-vlookup • https://exceljet.net/excel-functions/excel-vlookup-function • https://www.ablebits.com/office-addins-blog/2017/09/27/excel-iferror-function-with-formula- examples/ 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 82
  • 83.
    Bibliography • https://www.youtube.com/watch?v=gawMCJHpr8w • https://www.digitalvidya.com/blog/how-to-analyze-data-in-excel/ •https://exceljet.net/formula/count-visible-rows-in-a-filtered-list • https://exceljet.net/excel-data-validation-guide 09-Sep-20 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com 83
  • 84.
    Anything you wantme to tell? Thank You See you on next class… 09-Sep-20 84 Content sources are mentioned in bottom 03 Slides | redwan.contact@gmail.com