LabList PartA DA
LabList PartA DA
Rajajinagar, Bangalore-55
CA-C24L: Data Analytics Lab
Part A: Spreadsheet (Excel)
a) Conditional Formatting
iii) Select Highlight Cell Rules option → Select Greater than option from it → Enter the
value in the given text box for which profit you want to highlight the cells.
iv) In the similar way you can apply the other options such as Greater Than, Less that ,
Equal to , between etc.,
v) You can also select top “n” values for sales or profit by applying Top/ Bottom rules from
conditional formatting.
2. Click on the Conditional Formatting icon in the ribbon, from the Home menu
3. Select the Color Scales from the drop-down menu
There are 12 Color Scale options with different color variations.
The color on the top of the icon will apply to the highest values.
4. Click on the "Green - Yellow - Red Colour Scale" icon
Now, the sales value cells will have a colored background highlighting:
Orange is used for the highest values, and dark red for the lowest values.
All the cells in the range gradually change color from yellow, orange, pink , dark red etc.
b) IF Function
Explanation: The IF function is a premade function in Excel, which returns values
based on a true or false condition.
Syntax:
=IF(logical_test, [value_if_true], [value_if_false])
c) COUNTIF Function
Explanation:
The COUNTIF function is a premade function in Excel, which counts cells as specified.
Numbers (e.g. 90) and words (e.g. "Water") can be specified.
Syntax:
=COUNTIF(Range, criteria)
Where range = set of data on which count function is to be implemented
Criteria = condition that needs to be matched
On Sample Super Store Data Set,
Count the number of product that have sales more than 50 units as follows:
=countif(R2: End, “>50”)
d) SUMIF Function
Explanation:
The SUMIF function is a premade function in Excel, which calculates the sum of values
in a range based on a true or false condition.
Syntax:
Count the total of profit that has profit more than 1000 units as follows:
=sumif(V2: End, “>1000”)
e) AVERAGE Function
Explanation:
The AVERAGE function is a premade function in Excel, which calculates the average
(arithmetic mean).
It adds the range and divides it by the number of observations.
Example:
The average of (2, 3, 4) is 3.
3 observations (2, 3 and 4)
The sum of the observations (2 + 3 + 4 = 9)
(9 / 3 = 3)
The average is 3
Note: The AVERAGE function ignores cells with text.
Syntax:
AVERAGE(number1, [number2], ...)
▪ Number1 Required. The first number, cell reference, or range for which
you want the average.
▪ Number2, ... Optional. Additional numbers, cell references or ranges for
which you want the average, up to a maximum of 255.
f) CONCAT Function
Explanation:
The CONCAT function is used to link multiple cells without adding any delimiters
between the combined cell values.
Syntax:
CONCAT(text1, [text2],…)
Argument Description
text1 Text item to be joined. A string, or array of strings, such as a
(required) range of cells.
[text2, ...] Additional text items to be joined. There can be a maximum
(optional) of 253 text arguments for the text items. Each can be a string,
or array of strings, such as a range of cells.
Create a new column, label it as “Product Summary” and concat Product name, Sales
and Profit for each product in that column as follows:
= concat(Q2,R2,V2)
2. INDEX, MATCH, UNIQUE , IFS, COUNTIFS, SUMIFS,
AVERAGEIFS
a) Index
Explanation:
The Microsoft Excel INDEX function returns a value in a table based on the intersection
of a row and column position within that table. The first row in the table is row 1 and the
first column in the table is column 1.
The INDEX function is a built-in function in Excel that is categorized as
a Lookup/Reference Function. It can be used as a worksheet function (WS) in Excel. As
a worksheet function, the INDEX function can be entered as part of a formula in a cell of
a worksheet.
Syntax:
The syntax for the INDEX function in Microsoft Excel is:
INDEX( table, row_number, column_number )
Parameters or Arguments
Table: A range of cells that contains the table of data.
row_number:The row position in the table where the value you want to lookup is
located. This is the relative row position in the table and not the actual row number in the
worksheet.
column_number:The column position in the table where the value you want to lookup
is located. This is the relative column position in the table and not the actual column
number in the worksheet.
Returns
The INDEX function returns any datatype such as a string, numeric, date, etc.
O/P= Binders
b) Match
Explanation:
The MATCH function searches for a specified item in a range of cells, and then returns
the relative position of that item in the range.
Syntax:
MATCH(lookup_value, lookup_list, [match_type])
The MATCH function syntax has the following arguments:
▪ lookup_value Required. The value that you want to match in lookup_array. For
example, when you look up someone's number in a telephone book, you are using the
person's name as the lookup value, but the telephone number is the value you want.
The lookup_value argument can be a value (number, text, or logical value) or a cell
reference to a number, text, or logical value.
▪ lookup_list Required. The range of cells being searched.
▪ match_type Optional. The number -1, 0, or 1. The match_type argument specifies
how Excel matches lookup_value with values in lookup_array. The default value for
this argument is 1.
▪ The following table describes how the function finds values based on the setting of
the match_type argument.
Match_type Behavior
1 or omitted MATCH finds the largest value that is less than or equal
to lookup_value. The values in the lookup_array argument must
be placed in ascending order, for example: ...-2, -1, 0, 1, 2, ..., A-
Z, FALSE, TRUE.
0 MATCH finds the first value that is exactly equal
to lookup_value. The values in the lookup_array argument can
be in any order.
-1 MATCH finds the smallest value that is greater than or equal
tolookup_value. The values in the lookup_array argument must
be placed in descending order, for example: TRUE, FALSE, Z-
A, ...2, 1, 0, -1, -2, ..., and so on.
c) Unique
Explanation:
The UNIQUE function returns a list of unique values in a list or range.
Syntax:
=UNIQUE(array,[by_col],[exactly_once])
The UNIQUE function has the following arguments:
Argument Description
Array The range or array from which to return unique rows or
Required columns
Argument Description
[by_col] The by_col argument is a logical value indicating how to
Optional compare.
TRUE will compare columns against each other and return
the unique columns
FALSE (or omitted) will compare rows against each other
and return the unique rows
[exactly_once] The exactly_once argument is a logical value that will return
Optional rows or columns that occur exactly once in the range or
array. This is the database concept of unique.
TRUE will return all distinct rows or columns that occur
exactly once from the range or array
FALSE (or omitted) will return all distinct rows or columns
from the range or array
d) IFS
Explanation:
The IFS function checks whether one or more conditions are met, and returns a value
that corresponds to the first TRUE condition. IFS can take the place of multiple nested
IF statements, and is much easier to read with multiple conditions.
Syntax:
=IFS(logical_test1, value_if_true1, [logical_test2, value_if_true2], [logical_test3,
value_if_true3],…)
Argument Description
logical_test1 (required) Condition that evaluates to TRUE or
FALSE.
value_if_true1 (required) Result to be returned if logical_test1
evaluates to TRUE. Can be empty.
logical_test2…logical_test127 (optio Condition that evaluates to TRUE or
nal) FALSE.
value_if_true2…value_if_true127 (o Result to be returned
ptional) if logical_testN evaluates to TRUE.
Each value_if_trueN corresponds
with a condition logical_testN. Can
be empty.
Example:
e) COUNTIFS
Explanation:
The COUNTIFS function applies criteria to cells across multiple ranges and counts the
number of times all criteria are met.
COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]…)
The COUNTIFS function syntax has the following arguments:
▪ criteria_range1 Required. The first range in which to evaluate the associated criteria.
▪ criteria1 Required. The criteria in the form of a number, expression, cell reference, or
text that define which cells will be counted. For example, criteria can be expressed as 32,
">32", B4, "apples", or "32".
▪ criteria_range2, criteria2, ... Optional. Additional ranges and their associated criteria.
Up to 127 range/criteria pairs are allowed.
Syntax:
Example:
Data
1 5/1/2011
2 5/2/2011
3 5/3/2011
4 5/4/2011
5 5/5/2011
6 5/6/2011
f) SUMIFS
Explanation:
The SUMIFS function, one of the math and trig functions, adds all of its arguments that
meet multiple criteria.
Syntax:
Example:
Quantity Sold Product Salesperson
5 Apples Tom
4 Apples Sarah
15 Artichokes Tom
3 Artichokes Sarah
22 Bananas Tom
12 Bananas Sarah
10 Carrots Tom
33 Carrots Sarah
=SUMIFS(A2:A9, Adds the number of products that begin with A and were sold
B2:B9, "=A*", C2:C9, by Tom. It uses the wildcard character * in Criteria1, "=A*" to
"Tom") look for matching product names in Criteria_range1 B2:B9, and
looks for the name "Tom" in Criteria_range2 C2:C9. It then adds
the numbers in Sum_range A2:A9 that meet both conditions. The
result is 20.
g) AVERAGEIFS
Explanation:
Returns the average (arithmetic mean) of all cells that meet multiple criteria.
Syntax:
AVERAGEIFS(average_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)
The AVERAGEIFS function syntax has the following arguments:
▪ Average_range Required. One or more cells to average, including numbers or names,
arrays, or references that contain numbers.
▪ Criteria_range1, criteria_range2, … Criteria_range1 is required, subsequent
criteria_ranges are optional. 1 to 127 ranges in which to evaluate the associated criteria.
▪ Criteria1, criteria2, ... Criteria1 is required, subsequent criteria are optional. 1 to 127
criteria in the form of a number, expression, cell reference, or text that define which cells
will be averaged. For example, criteria can be expressed as 32, "32", ">32", "apples", or
B4.
Example:
a) VLOOKUP
Explanation:
VLOOKUP is uses to find things in a table or a range by row. For example, look up a
price of an automotive part by the part number, or find an employee name based on their
employee ID.
Syntax :
Syntax:
Syntax:
Argument Description
lookup_value The value to search for
Required*
*If omitted, XLOOKUP returns blank cells it finds
in lookup_array.
lookup_array The array or range to search
Required
return_array The array or range to return
Required
[if_not_found] Where a valid match is not found, return the [if_not_found]
Optional text you supply.
If a valid match is not found, and [if_not_found] is
missing, #N/A is returned.
[match_mode] Specify the match type:
Optional 0 - Exact match. If none found, return #N/A. This is the
default.
-1 - Exact match. If none found, return the next smaller item.
1 - Exact match. If none found, return the next larger item.
2 - A wildcard match where *, ?, and ~ have special
meaning.
[search_mode] Specify the search mode to use:
Optional 1 - Perform a search starting at the first item. This is the
default.
-1 - Perform a reverse search starting at the last item.
Argument Description
2 - Perform a binary search that relies on lookup_array being
sorted in ascending order. If not sorted, invalid results will
be returned.
-2 - Perform a binary search that relies on lookup_array
being sorted in descending order. If not sorted, invalid results
will be returned.
d) COUNT
Explanation:
The COUNT function counts the number of cells that contain numbers, and counts
numbers within the list of arguments. Use the COUNT function to get the number of
entries in a number field that is in a range or array of numbers.
Syntax:
COUNT(value1, [value2], ...)
The COUNT function syntax has the following arguments:
▪ value1 Required. The first item, cell reference, or range within which you want to
count numbers.
▪ value2, ... Optional. Up to 255 additional items, cell references, or ranges within
which you want to count numbers.
Note: The arguments can contain or refer to a variety of different types of data, but only
numbers are counted.
e) COUNTA
Explanation:
The COUNTA function counts the number of cells that are not empty in a range.
Syntax:
COUNTA(value1, [value2], ...)
The COUNTA function syntax has the following arguments:
▪ value1 Required. The first argument representing the values that you want to count.
▪ value2, ... Optional. Additional arguments representing the values that you want to
count, up to a maximum of 255 arguments.
Remarks
▪ The COUNTA function counts cells containing any type of information, including
error values and empty text (""). For example, if the range contains a formula that
returns an empty string, the COUNTA function counts that value.
The COUNTA function does not count empty cells.
▪ If you do not need to count logical values, text, or error values (in other words, if you
want to count only cells that contain numbers), use the COUNT function.
▪ If you want to count only cells that meet certain criteria, use the COUNTIF function
or the COUNTIFS function
b) MID
Explanation:
MID returns a specific number of characters from a text string, starting at
the position you specify, based on the number of characters you specify.
Syntax:
=MID(text,start_num,num_chars)
Text is the text string containing the characters you want to extract.
Start_num is the position of the first character you want to extract in text.
The first character in text has start_num 1, and so on.
Num_chars specifies the number of characters you want MID to return
from text.
Example:
= mid (“Data Analytics”, 3, 4)
O/P = “ta A”
c) RIGHT
Explanation:
RIGHT returns the last character or characters in a text string, based on the number
of characters you specify.
Syntax
=RIGHT(text,[num_chars])
▪ Text Required. The text string containing the characters you want to
extract.
▪ Num_chars Optional. Specifies the number of characters you want
RIGHT to extract.
▪ Num_chars must be greater than or equal to zero.
▪ If num_chars is greater than the length of text, RIGHT returns all of text.
▪ If num_chars is omitted, it is assumed to be 1.
Example:
= right (“Data Analytics”, 3)
O/P = “ics”
d) LEN
Explanation:
LEN returns the number of characters in a text string.
Syntax:
=LEN(text)
The LEN function syntax has the following arguments:
▪ Text Required. The text whose length you want to find. Spaces count as
characters.
Example:
= len(“Data Analytics”)
O/P = 14
e) SUBSTITUTE
Explanation:
Substitutes new_text for old_text in a text string. Use SUBSTITUTE when
you want to replace specific text in a text string; use REPLACE when you
want to replace any text that occurs in a specific location in a text string.
Syntax:
f) SEARCH
Explanation:
The SEARCH functions locate one text string within a second text string, and
return the number of the starting position of the first text string from the first
character of the second text string. For example, to find the position of the
letter "n" in the word "printer", you can use the following function:
=SEARCH("n","printer")
This function returns 4 because "n" is the fourth character in the word "printer."
You can also search for words within other words. For example, the function
=SEARCH("base","database")
returns 5, because the word "base" begins at the fifth character of the word
"database". You can use
Syntax:
= SEARCH(find_text,within_text,[start_num])
g) ISNUMBER
Explanation:
The ISNUMBER function returns TRUE when a cell contains a number, and
FALSE if not. You can use ISNUMBER to check that a cell contains a numeric
value, or that the result of another function is a number.
Syntax
=ISNUMBER(value)
Arguments
value - The value to check.
Example:
(1) =ISNUMBER(9.8) O/P= True
(2) =ISNUMBER(“AA”) O/P= False
b) Now
Returns current date and time
Syntax:
=now()
c) Year
Returns the year corresponding to a date. The year is returned as an integer in
the range 1900-9999.
Syntax
YEAR(serial_number)
The YEAR function syntax has the following arguments:
▪ Serial_number Required. The date of the year you want to find. Dates
should be entered by using the DATE function, or as results of other
formulas or functions. For example, use DATE(2008,5,23) for the 23rd day
of May, 2008. Problems can occur if dates are entered as text.
Example:
=year(today())
d) Month
Returns the month of a date represented by a serial number. The month is given
as an integer, ranging from 1 (January) to 12 (December).
Syntax
MONTH(serial_number)
The MONTH function syntax has the following arguments:
▪ Serial_number Required. The date of the month you are trying to find.
Dates should be entered by using the DATE function, or as results of other
formulas or functions.
e) Networkdays
Returns the number of whole working days between start_date and end_date.
Working days exclude weekends and any dates identified in holidays.
Syntax
NETWORKDAYS(start_date, end_date, [holidays])
The NETWORKDAYS function syntax has the following arguments:
▪ Start_date Required. A date that represents the start date.
▪ End_date Required. A date that represents the end date.
▪ Holidays Optional. An optional range of one or more dates to exclude
from the working calendar, such as state and federal holidays and floating
holidays. The list can be either a range of cells that contains the dates or an
array constant of the serial numbers that represent the dates.
Example
Copy the example data in the following table, and paste it in cell A1 of a new
Excel worksheet. For formulas to show results, select them, press F2, and then
press Enter. If you need to, you can adjust the column widths to see all the data.
Date Description
10/1/2012 Start date of project
3/1/2013 End date of project
11/22/2012 Holiday
12/4/2012 Holiday
1/21/2013 Holiday
Formula Description Result
=NETWORKDAYS(A Number of workdays between the start 110
2,A3) (10/1/2012) and end date (3/1/2013).
=NETWORKDAYS(A Number of workdays between the start 109
2,A3,A4) (10/1/2012) and end date (3/1/2013),
with the 11/22/2012 holiday as a non-
working day.
=NETWORKDAYS(A Number of workdays between the start 107
2,A3,A4:A6) (10/1/2012) and end date (3/1/2013),
with the three holidays as non-working
days.
f) Eomonth
Returns the serial number for the last day of the month that is the indicated
number of months before or after start_date. Use EOMONTH to calculate
maturity dates or due dates that fall on the last day of the month.
Syntax:
EOMONTH(start_date, months)
The EOMONTH function syntax has the following arguments:
▪ Start_date Required. A date that represents the starting date. Dates should
be entered by using the DATE function, or as results of other formulas or
functions. For example, use DATE(2008,5,23) for the 23rd day of May,
2008. Problems can occur if dates are entered as text.
▪ Months Required. The number of months before or after start_date. A
positive value for months yields a future date; a negative value yields a past
date.
Note: If months is not an integer, it is truncated.
Example
Copy the example data in the following table, and paste it in cell A1 of a new
Excel worksheet. For formulas to show results, select them, press F2, and then
press Enter. If you need to, you can adjust the column widths to see all the data.
Date
1-Jan-11
Formula Description Result
=EOMONTH(A2,1) Date of the last day of the month, one 2/28/2011
month after the date in A2.
=EOMONTH(A2,- Date of the last day of the month, three 10/31/2010
3) months before the date in A2.
Explanation:
The FILTER function allows you to filter a range of data based on criteria you
define.
Syntax:
=FILTER(array,include,[if_empty])
Argument Description
Include A Boolean array whose height or width is the same as the array
Required
[if_empty]
Optional
b) FREQUENCY
Explanation:
The FREQUENCY function calculates how often values occur within a range of
values, and then returns a vertical array of numbers.
Syntax:
FREQUENCY(data_array, bins_array)
The FREQUENCY function syntax has the following arguments:
▪ data_array Required. An array of or reference to a set of values for which you want to
count frequencies. If data_array contains no values, FREQUENCY returns an array of zeros.
▪ bins_array Required. An array of or reference to intervals into which you want to group
the values in data_array. If bins_array contains no values, FREQUENCY returns the number of
elements in data_array.
Example:
Use this Data Set for frequency:
Scores Bins
79 70
85 79
78 89
85
50 Steps:
81 1) Create column Bins = upper limit of your
95 class interval
88 2) Select cell array where you need formula.
97 Type following formula in the formula bar
and then press
SHIFT + CTRL + ENTER
Formula=frequency(A2:A10,B2:B4)
O/P-
interval Frequency
<70 1
71-79 2
80-89 4
90> 2
c) SEQUENCE
Explanation:
The SEQUENCE function allows you to generate a list of sequential numbers in an array, such as
1, 2, 3, 4.
Syntax:
=SEQUENCE(rows,[columns],[start],[step])
Argument Description
Required
Optional
Optional
Argument Description
[step]
Optional
Example:
d) RANDARRAY
Explanation:
The RANDARRAY function returns an array of random numbers. You can specify the number of
rows and columns to fill, minimum and maximum values, and whether to return whole numbers
or decimal values.
Syntax:
=RANDARRAY([rows],[columns],[min],[max],[whole_number])
Argument Description
Argument Description
[rows] The number of rows to be returned
Optional
[columns] The number of columns to be returned
Optional
[min] The minimum number you would like returned
Optional
[max] The maximum number you would like returned
Optional
[whole_number] Return a whole number or a decimal value
Example:
1) In the example shown, RANDARRAY is used to generate 50 values in a
range of 10 rows by 5 columns. The formula in B4 is:
=RANDARRAY(10,5)
2) To return a random array of integers, 5 rows by 2 columns, between 1
and 10, you can use a formula like this:
=RANDARRAY(5,2,1,10,TRUE)
e) IFERROR
Explanation:
You can use the IFERROR function to trap and handle errors in a formula. IFERROR returns a
value you specify if a formula evaluates to an error; otherwise, it returns the result of the
formula.
Syntax:
IFERROR(value, value_if_error)
Example:
Quota Units Sold
210 35
55 0
23
a) PIVOT TABLES
Explanation:
A PivotTable is a powerful tool to calculate, summarize, and analyze data that lets you see
comparisons, patterns, and trends in your data.
Steps:
1. Select the cells you want to create a PivotTable from.
Note: Selecting Add this data to the Data Model adds the table or range being used for
this PivotTable into the workbook’s Data Model. Learn more.
4. Choose where you want the PivotTable report to be placed. Select New Worksheet to place
the PivotTable in a new worksheet or Existing Worksheet and select where you want the
new PivotTable to appear.
5. Select OK.
b) WHAT IF ANALYSIS
Explanation:
Excel What-if Analysis is a procedure employed to the Excel sheets with formulas to see the tabular
data results when any variations are applied to the original values without having to recreate a new
sheet. We have three types of What-if Analysis as shown below.
Example:
To create an analysis report with Scenario Manager, follow the following steps, such as:
Step2: Go to the What-If Analysis button and click on the Scenario Manager from the
dropdown list.
Step 3: Now a scenario manager dialog box appears, click on the Add button to create a
scenario.
Step 4: Create the scenario, name the scenario, enter the value for each changing input cell
for that scenario, and then click the Ok button.
Step 5: Now, B3, B4, B5, B6, and B7 appear in the cells box.
Step 6: Now, change the value of B3to 500 and click the Add button.
Step 7: After clicking on the Add button, the add scenario dialog box appears again.
Step 12: Change the value of B7 to 10000 and click the Ok button.
The Scenario Manager Dialog box appears. In the box under Scenarios, You will find the
names of all the scenarios that you have created.
Step 13: Now, click on the Summary button. The Scenario Summary dialog box appears.
Goal Seek is a What-If Analysis tool that helps you to find the input value that results in a
target value that you want.
Example: Below are the following steps to use the Goal Seek feature in Excel.
Data Set
Internal1 Marks 45
Internal2 Marks 34
Assignment Marks 50
Lab Marks 35
Improvement Test Marks? 36
Grade 200
Step 1: On the Data tab, go What-If Analysis and click on the Goal Seek option.
Step 3: Type C9 in the Set cell box. This box is the reference for the cell that contains the
formula that you want to resolve.
Step 4: Type 57000 in the To value box. Here, you get the formula result.
Step 5: Type B9 in the By changing cell box. This box has the reference of the cell that
contains the value you want to adjust.
Step 6: This cell that the formula must reference goal Seek changes in the cell that you
specified in the Set cell box. Click Ok.
As you can observe, Goal Seek found the solution using B9, and it returns 0 in the B9 cell
because the target value and current value are the same.
Example:
1) Enter following data set Sales , unit price and month with data 500, 55, 11
2) Amount is calculated using formula in B6 : = sales * unitprice * month
= B2 * B3 * B4
3) In column D2 enter the following formula “ = B6
4) Enter values 500, 600 , 700 so on in cell D3, D4, D5, D6 …….
5) Enter month values in rows 1,2,3,4, in F2, G2, H2, I2, …….
6) Select table array from D2 to Iend.
7) Click Data Tab → select What if analysis →select Data Table
8) Give Row input → B5 (Cell address of month)
Give Column input → B3 (Cell address of sales)
9)Press Enter and you will get the Data table of the amount calculated for remaining
months.
A B C D E F G H I J
1
2 SALES 500
3 UNIT 55
PRICE
4 MONTH
1
5
6 AMOUNT
7
8
9
10
11
12
c) DATA VALIDATION
Explanation:
Data validation is used to restrict the type of data or the values that users enter into a cell,
like a dropdown list.
Steps:
Now, if the user tries to enter a value that is not valid, an Error Alert appears with your
customized message.
You can automatically calculate subtotals and grand totals in a list for a column by using
the Subtotal command.