0% found this document useful (0 votes)
31 views135 pages

Advanced Excel

The document discusses different ways to filter and sort data in an Excel sheet. It provides examples of single criteria, multiple criteria, and wildcard filters. It also demonstrates how to perform a custom sort by creating a custom list. The examples help analyze shipment company data by filtering on criteria like company name, unit price, and more.

Uploaded by

bhanuguddu123456
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views135 pages

Advanced Excel

The document discusses different ways to filter and sort data in an Excel sheet. It provides examples of single criteria, multiple criteria, and wildcard filters. It also demonstrates how to perform a custom sort by creating a custom list. The examples help analyze shipment company data by filtering on criteria like company name, unit price, and more.

Uploaded by

bhanuguddu123456
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 135

Section I: Operations in Excel

Filter – Advanced
You work for the shipping department of a leading shipment company. You have been asked to analyze the
data and report your findings.
Let us begin by looking at the data in the excel sheet.

The data is present in Cells A1:M13.


You would like to filter the data as per the below criteria:
1. Display the records where the CompanyName is “Speedy Express”.
2. Display the records where the CompanyName is “Speedy Express” and the UnitPrice is >90.
3. Display the records where the CompanyName is either “Speedy Express” or “Federal Shipping”.
4. Display the records where the CompanyName is “Speedy Express” or the UnitPrice is >35.
5. Display the records where the CompanyName is “Speedy Express” and the UnitPrice is >90 or the
CompanyName is “United Package” and the UnitPrice is >35.
6. Display the records where the CompanyName ends in “ss”.

1. Display the records where the CompanyName is “Speedy Express”.

Single Criteria Filter:

We will call this as single criteria filter as the filtering is based on only one condition i.e. the
CompanyName should be “Speedy Express”.

Let us put down the steps to accomplish the same.

Step 1
Copy the entire header row (the row that has the column headings in a different area of the work
sheet.) We have copied the header row in Row 16 from Cell A16 to M16.
We will have to specify the criteria below our header row i.e. after row 16.

Step 2
Let us type out the criteria in Cell C17.

Step 3
Select DATA on the menu bar and click on Advanced under the Sort & Filter group.

Step 4.

The Advanced dialog box shows up as follows:


Let us look at the options one by one and fill the dialog box appropriately.

We will filter the list, in-place which means at the place where the original data is present i.e. from
Cell A1 to M16.

Let us specify the List range and Criteria range as follows.

We would like to go for all records therefore we will keep the unique records only checkbox as
unchecked.

Clicking on OK gives the following output:


You can see that the data is filtered on CompanyName being “Speedy Express”.

Step 5.
If you wish to clear the filter, simply click on Clear in the Sort & Filter group.

2. Display the records where the CompanyName is “Speedy Express” and the UnitPrice is >90.
Multiple Criteria Filter:
We will call this as multiple criteria as there are two criteria that we need to filter on:
CompanyName “Speedy Express”
And
UnitPrice >90

Step 1 is similar as in the above case.


Step 2.
We will type out the criteria in Cell C17 and G17.

Step 3.
Select DATA on the menu bar and click on Advanced under the Sort & Filter group.
Step 4.

The Advanced dialog box shows up as follows:

Let us look at the options one by one and fill the dialog box appropriately.

We will filter the list, in-place which means at the same place where the original data is present i.e.
from Cell A1 to M16.

Let us specify the List range and Criteria range as follows.

We would like to go for all records therefore we will keep the unique records only checkbox as
unchecked.
Clicking on OK gives the following output:

You can see that the data is filtered on CompanyName being “Speedy Express” and the UnitPrice
is greater than 90.

3. Display the records where the CompanyName is either “Speedy Express” or “Federal Shipping”.
Single Criteria, Multiple Value Filter:
We will call this as single criteria but with multiple values as there is just one criteria that we need
to filter on but it can have value either as “Speedy Express” or “Federal Shipping”.
CompanyName “Speedy Express” or “Federal Shipping”.

Step 1 is similar as in the above case.


Step 2.
We will type out the criteria in Cell C17 and C18.

Step 3.
Select DATA on the menu bar and click on Advanced under the Sort & Filter group.
Step 4.

The Advanced dialog box shows up as follows:

Let us look at the options one by one and fill the dialog box appropriately.

We will filter the list, in-place which means where at the place the original data is present i.e. from
Cell A1 to M16.

Let us specify the List range and Criteria range as follows.

We would like to go for all records therefore we will keep the unique records only checkbox as
unchecked.
Clicking on OK gives the following output:

You can see that the data is filtered on CompanyName being “Speedy Express” or “Federal
Shipping”.

4. Display the records where the CompanyName is “Speedy Express” or the UnitPrice is >35.
Multiple Criteria Filter:
We will call this as multiple criteria as there are two criteria and either of it can be true for the record
to show up in the output.
CompanyName “Speedy Express”
or
UnitPrice >35
Step 1 is similar as in the above case.
Step 2.
We will type out the criteria in Cell C17 and G18.

Step 3.
Select DATA on the menu bar and click on Advanced under the Sort & Filter group.

Step 4.

The Advanced dialog box shows up as follows:


Let us look at the options one by one and fill the dialog box appropriately.

We will filter the list, in-place which means at the place where the original data is present i.e. from Cell
A1 to M16.

Let us specify the List range and Criteria range as follows.

We would like to go for all records therefore we will keep the unique records only checkbox as
unchecked.

Clicking on OK gives the following output:


You can see that the data is filtered on CompanyName being “Speedy Express” or UnitPrice >35.

5. Display the records where the CompanyName is “Speedy Express” and the UnitPrice is >90 or the
CompanyName is “United Package” and the UnitPrice is >35.

Multiple Criteria Filter:


We will call this as multiple criteria.
There are two criterias and either of it can be true for the record to show up in the output.
CompanyName “Speedy Express” and UnitPrice > 90
Or
CompanyName “United Package” and UnitPrice >35

Step 1 is similar as in the above case.


Step 2.
Type out the criteria in Cell C17, G17and C18, G18.
Step 3.
Select DATA on the menu bar and click on Advanced under the Sort & Filter group.

Step 4.

The Advanced dialog box shows up as follows:

Let us look at the options one by one and fill the dialog box appropriately.

We will filter the list, in-place which means at the place where the original data is present i.e. from Cell
A1 to M16.

Let us specify the List range and Criteria range as follows.

We will like to go for all records therefore we will keep the unique records only checkbox as unchecked.
Clicking on OK gives the following output:

You can see that the data is filtered on (CompanyName being “Speedy Express” and UnitPrice >90) or
(CompanyName being “United Package” and UnitPrice >35).

6. Display the records where the CompanyName ends in “ss”.


Single Criteria Wild Card Filter:
We will call this as single criteria wild card search.
There is just one criteria that needs to be true for the record to show up in the output.
CompanyName “*ss”

Step 1 is similar as in the above case.


Step 2.
We will type out the criteria in Cell C17.
Step 3.
Select DATA on the menu bar and click on Advanced under the Sort & Filter group.

Step 4.

The Advanced dialog box shows up as follows:


Let us look at the options one by one and fill the dialog box appropriately.

We will filter the list, in-place which means at the place where the original data is present i.e. from Cell
A1 to M16.

Let us specify the List range and Criteria range as follows.

We would like to go for all records therefore we will keep the unique records only checkbox as
unchecked.

Clicking on OK gives the following output:


You can see that the data is filtered on (CompanyName being “*ss”).
Custom Sort
You are the facilities manager of the finance verticals of a leading products company. It is nearer the QGM
(Quarterly General Meeting) date. You have been allocated budget to disperse a T-shirt each to the manager
participating in the QGM. You are reminded of the last time such an activity was conducted. The former
facilities manager at the last minute had ordered the same size (Size XL to be precise) for all with the result
that most of the participants were not left too happy with their T-shirts.
You have done some ground work before placing the order with a leading retail store. You had circulated
an excel sheet to capture first hand from the employees themselves, their preferences as regards the Neck
type and Size.
Here is the excel sheet.

You would like to sort the data as per size as follows:

 Extra Small
 Small
 Medium
 Large
 Extra Large
You decide to use Excel’s custom sort feature to implement the same. Here are the steps:
Step 1:
Select the data
Step 2:
Click “Sort & Filter” under editing group.

Step 3:
Click on Custom Sort.
The Custom Sort dialog box opens up.
Step 4
Fill in the required values.
Sorting has to be done on the Size column but the order has to be Custom Sort. Under Order Select Custom
List.
Click on Add.
The list comes under Custom lists.
Click on OK.
It will revert back to the previous screen.

Under sort by, select Size.


Click OK.
And here is the output.

Note: whenever the sorting is required NOT in ascending or descending order but in Custom Order, create
your own custom list.
Match – Multiple criteria – Single return value
I. You are the owner of a small-sized enterprise. There are several parts (widgets, screws, bolts) that your
company purchases from a list of suppliers. Your supervisor has just reported to you that the production
department is short of Steel Screws. You need to urgently place the order with the supplier of Steel
Screws to ensure smooth production and the delivery of finished products to your client on time.
You open the excel sheet that has the details on the suppliers and the parts that they supply. You are
interested in finding out who is the supplier (name of the supplier) for a particular part that is made of a
particular constituent, in our case “Steel Screws”.
Note: You have ensured that your company buys a particular part made of a particular constituent from one
Suppler ONLY.
This is a case of multiple criteria and a single return value.
Multiple Criteria, Single Return Value:
E.g. determine the name of the supplier who supplies Steel Screws to your company.
Let us place the data in an excel sheet and then provide the steps to accomplish the same.

Criteria:
Parts: Screws
Constituent: Steel
Expected return value: S2

Step 1:
Let us copy the two criteria into Cells F3 and F4.
Step 2:
We will use Match with multiple criteria (in our case two criteria – Parts and Constituent) and a single
return value (Supplier). Match will only return the row number. We are expecting it to return 10 (this is
inclusive of the column heading in Row 1). We will use MATCH() as an array formula, therefore after
tying out the formula, we will use press CTRL + SHIFT + ENTER to end the formula and to get the return
value.
We will type out the formula in Cell F5.
The formula is: =MATCH(1,(A1:A10=F3)*(B1:B10=F4),0)
Remember to press CTRL + SHIFT + ENTER.

Explanation of the formula:


MATCH function takes three arguments:
1. The lookup value: We have taken it as 1. The usage of 1 as the lookup value will become clear as
we look at the second argument to the function.
2. Lookup array: There are two lookup arrays
a) A1:A10 where we will look up the value of “Screws” as given in Cell F4
b) B1:B10 where we look up the value of “Steel”. If the value is found it returns 1 otherwise zero.

Notice the use of * between the two look up arrays. There can be a possible of 4 return values:
a) If both the parts is “Screws” and the constituent is “Steel”, it will return value is 1*1 = 1.
b) If the Parts was “Screws” but the constituent was NOT “Steel” it will return 1*0 = 0
c) If the Parts was NOT “Screws” but the Constituent was “Steel” then it will return 0*1 = 0
d) If the Parts was NOT “Screws” and the Constituent was NOT “Steel” it will return 0*0 = 0

3. Match Type: 0 for an EXACT Match.

Step 3:
We will now use INDEX () function to return the name of the supplier.
Let us type out the formula in Cell F6.
The formula is: =INDEX(A1:C10,F5,3)
Remember to press CTRL + SHIFT + ENTER because it is still an array formula owing to the use of
MATCH() function as an array formula.

So, it is Supplier “S2” that supplies Steel Screws to your company.


Explanation of the INDEX function.
The arguments used are:
1. Array: A1:C10 (including the column heading: - Parts, Constituent and Supplier in Row 1).
2. Row Number: it is 10 as returned by the MATCH function in Cell F5.
3. Column Number: It is 3 considering that Column 1 has Parts, Column 2 has Constituent and
Column 3 has Supplier.
Multiple criteria – Multiple return value
We will slightly modify the above scenario. The scenario now reads as:
II. You are the owner of a small-sized enterprise. There are several parts (widgets, screws, bolts) that your
company purchases from a list of suppliers. Your supervisor has just reported to you that the production
department is short of Steel Screws. You need to urgently place the order with the suppliers of Steel
Screws to ensure smooth production and the delivery of finished products to your client on time.
You open the excel sheet that has the details on the suppliers and the parts that they supply. You are
interested in finding out who are the suppliers (names of the supplier) for a particular part that is made of a
particular constituent, in our case “Steel Screws”.
Note: Your Company buys a particular part made of a particular constituent from MORE THAN ONE
Supplier.
This is a case of multiple criteria and multiple return values.
E.g. determine the names of the supplier who supplies Steel Screws to your company.
Let us place the data in an excel sheet and then provide the steps to accomplish the same.

Criteria:
Parts: Screws
Constituent: Steel
Expected return value: S2, S1 and S3

Step 1:
Let us copy the two criteria into Cells F3 and F4.
Step 2:
We will use the SMALL function in combination with IF and Row to take in multiple criteria (in our case
two criteria – Parts and Constituent) and return multiple value (names of Supplier). SMALL function will
only return the row number. We are looking at it returning 10, 11, 13 (this is inclusive of the column heading
in Row 1) . We will use SMALL () function as an array formula, therefore after typing out the formula, We
will press CTRL + SHIFT + ENTER to end the formula and to get the return value.
We will type out the formula in Cell E6.
The formula is: =
=SMALL(IF((A$1:$A$14=$F$3)*($B$1:$B$14=$F$4),ROW($A$1:$B$14)),ROW(1:1))
Remember to press CTRL + SHIFT + ENTER.
Explanation of the formula:
1. The IF function will look for those rows that match its two criteria (“Screws” in the range A1:A14
and “Steel” in the range B1:B14 and return the corresponding row numbers else return False.
2. The output from the IF function is then fed to the SMALL function as its first argument and asked
to return the smallest row number where the two criteria are satisfied with a ROW(1:1) serving as
the second argument to .
Step 3:
We will now use INDEX () function to return the names of the supplier.
Let us type out the formula in Cell F6.
The formula is: =INDEX($A$1:$C$14,E6,3)
So, the first supplier that supplies Steel Screws to your company is Supplier “S2”. We can see from the data
set that there are three suppliers who supply Steel Screws (we can find this out, by using COUNTIFS()
function). The formula to use with COUNTIFS() function is
=COUNTIFS(A2:A14,"Screws",B2:B14,"Steel").
Drag the formula in E6 and F6 to E7:F7 through E8:F8 to return the remaining two row numbers and
corresponding supplier names.

Explanation of the INDEX function.


The arguments used are:
4. Array: A1:C14 (including the column heading – Parts, Constituent and Supplier in Row 1).
5. Row Number: it is 10 as returned by the SMALL function in Cell E6.
6. Column Number: It is 3 considering that Column 1 has Parts, Column 2 has Constituent and
Column 3 has Supplier.
Do It Yourself
III. You are a teacher of grade IV class. You have a class list in an excel sheet called, “Class List”. The
class list has two columns, one which gives you the “Name of the Student” and another which gives
the “Gender”. The Class List is sorted on the “Name of the Student” in ascending order. You are
required to maintain the student’s attendance in another sheet called “Attendance Register”. Both the
sheets “Class List” and “Attendance Register” are in the same workbook. Your requirement is to have
the names of the “Male” student listed first followed by the names of the “Female” student. How will
you accomplish the same?
Class List at a glance:

As can be seen, it is sorted on “Name of Student” in ascending order.


The expected output:
Database functions
One question which I get asked frequently is “Is there a way to create a database in Excel”. The answer is
yes.
I will show you how.

Here I have entered the data for an employee data set. I have 6 columns. The columns are:

 EmployeeNo
 DeptNo
 ProjectNo
 Location
 TotalExperience
 Proficiency
I have just one numeric column, “TotalExperience”.
I also have 11 rows. The first row has column headings.
Let us convert this data set into a Table.
Select the data that you want included in the table.
Press CTRL + T. It opens up a Create Table dialog box. The data for the table is already selected.

Notice that the checkbox for “My table has headers” is also checked. Now, we do have headers for the
table, so we will continue to have it as checked.
On Clicking OK, you will notice the following display.
I will change the name of the table to “EmpDetails”

You will notice that we get filter with every column of the table.
Now that we have the table, let us find out answers to a few of our questions using database functions.
a) How many employees are skilled in BI?
We will use the DCOUNT function. What does it do?
It counts the cells containing numbers in the fields (columns) of records in the database that match the
criteria that we specify.
Syntax:
DCOUNT (database, field, criteria)
Database: is the name of the table
Field: Indicates which column is used in the function
Criteria: The range of cells that contains the conditions that you specify. You can use any range
for the criteria argument, as long as the argument includes at least one column label and at least one
cell below the column label in which you specify a condition for the column.
Here, the criteria is given in the Cell Range E14:E15.
The condition has to be specified below the column label.
The formula used is: =DCOUNT (EmpDetails[#All],"TotalExperience",E14:E15)
The output is displayed in cell F15.
As can be seen from the table, there are four employees who are proficient in BI.
b) How many employees belong to DeptNo, D3?

The formula used is =DCOUNT (EmpDetails[#All],"TotalExperience",E17:E18)


The output is 4.
c) Which location is Employee, E103 based out of?

The formula is: =DGET (EmpDetails[#All],"Location",E20:E21)


The output is Delhi.
d) What is average experience for employees of Dept, “D1”.

The formula is: =DAVERAGE (EmpDetails[#All],"TotalExperience",E23:E24)


The output is 8.25 years.
e) What is the maximum experience that any employee has for BI?

The formula is: =DMAX (EmpDetails[#All],"TotalExperience",E26:E27)


The output is 10.
f) What is the minimum experience that any employee has for Java?

The formula is: =DMIN (EmpDetails[#All],"TotalExperience",E29:E30)


The output is 6.
g) Multiple criteria: How many employees of DeptNo. D1 are skilled in BI?

The formula is =DCOUNT (EmpDetails[#All],"TotalExperience",E32:F33)


The output is 2.
h) How many employees are skilled either in “BI” or “Java”?

The formula is =DCOUNT (EmpDetails[#All],"TotalExperience",E35:E37)


The output is 7 (4 in BI and 3 in Java).
i) How many employees of (DeptNo, D1 are skilled in BI) or (belong to Deptno, D3)?

The formula used is =DCOUNT (EmpDetails[#All],"TotalExperience",E39:F41)


The output is 6.
j) How many employees are skilled in (BI and have Dept as D1) or skilled in (Oracle and have dept
as D3)
The formula is =DCOUNT (EmpDetails[#All],"TotalExperience",E43:F45)
The output is 4.
k) How many employees are based out of city whose name ends in an "e" and has u in the 2nd
character position?

The formula is =DCOUNT (EmpDetails[#All],"TotalExperience",E47:E48).


The output is 4.
Section II: Chart forms in Excel
Bubble Chart
Let us start by answering a few basic questions.
What is a bubble chart?
A bubble chart appears to be a variation of the scatter plot. In a scatter plot, one has data points which are
replaced with bubbles in a bubble chart.
A bubble chart has one additional dimension to provide the size for the bubbles.
Similar to a scatter plot, a bubble chart too does not have a category axis. Both the horizontal and vertical
axes are value axes.
A bubble chart plots x, y and z values.

Where is it most often used?


It is mostly used to plot financial data.

Let us show you how to go about plotting a bubble chart.


You are the head of a training institute. Your training institute offers a good number of courses in Business
Intelligence and Business Analytics such as “Data Analysis using Spreadsheets”, “Introduction to Business
Intelligence”, “Statistical Analysis”, etc. You maintain data about your instructors and have a good handle
on how many instructors are available for each course offering. Likewise you are quiet aware of the number
of students enrolled for each course offering. Based on the demand of the courses in the market over the
last five years, you have computed the market share % of your course offerings.
Step 1:
First, let us key in the data in the excel sheet.

We have three data series. The first data series is in the cell range B2:B6. This will constitute the x-values.
The second data series is in the cell range C2:C6. This will constitute the y-values. The third series is in the
cell range D2:D6. This will constitute the z-values. The z-values determines the bubble size.
Step 2:
Select the data to go into the bubble chart. Exclude the row and column headings.
We will exclude the cell range A1:D1 (column heading) and also the cell range A1:A6 (row heading). If
the row and column headings are included, the chart may be plotted incorrectly.

Step 3:
Go to INSERT on the menu bar. Under Scatter plot, select bubble chart.

Step 4:
Below is the chart after having dropped the grid lines, adding the chart title, horizontal and vertical axes
and data labels.
Sparklines
Edward Tufte coined the term Sparkline and defined it as “intense, simple, word-sized graphics”.
Sparklines are also referred to as micro-charts. It is commonly used to add visualization capability to tabular
data. It is aligned with rows of tabular data. It does not take up too much space and the impact is good.
There are three basic types of Sparklines:
1. Line
2. Column
3. Win / Loss
I will first go with the Line Sparklines.
A leading merchandise company with branches in some of the leading cities wants to count the number of
footfalls for every working day of a week.
Here is the data on an excel sheet for a week of June 2014.

Next, let us look at the steps to sketch the trend.


Step 1:
Select Cell I3.
Step 2:
Click on INSERT on the Menu Bar. From the Sparklines group, select Line.

Step 3:
The Sparklines dialog box opens up.
Select the Data Range as B3:H3 and click on OK. The following output is displayed.

Step 4:
Under Sparklines  Design  Show check the High Point and Low Point checkboxes.
The display is as follows:
Step 5:
Auto fill from I3 through I4 to I8. The display is as follows:

I have demonstrated how to get the basic Sparkline. I will leave it to you to explore the features on
formatting the Sparkline.
A few quick questions that demand our attention.

a) What if the Sparkline data source has non-numeric data? How will it be displayed?
I will deliberately introduce non-numeric data for the city of Pune.

And here is what you get.

b) What if the Sparkline data source has a few blank values? How will it be displayed?
This is how it will be plotted.

The blanks appear as the low points.


c) What if the Sparkline data source has few zero values? Actually the display does not change from when
the Sparkline data source had blank values.

d) I have introduced some error in the Sparkline data source and let us watch the display.
Column Sparklines
Let us now use the same data set as in the example above and get column Sparklines.

Step 1:
Select Cell I3.
Step 2:
Click on INSERT on the Menu Bar. From the Sparklines group, select Column.

Step 3:
The Sparklines dialog box opens up.

Select the Data Range as B3:H3 and click on OK. The following output is displayed.
Step 4:
Under Sparklines  Design  Show check the High Point and Low Point checkboxes.
The display is as follows:

Step 5:
Auto fill from I3 through I4 to I8. The display is as follows:
I have demonstrated how to get the basic Sparkline. I will leave it to you to explore the features on
formatting the Sparkline.
Again let us test it for the various incongruous data points.
a) What if the Sparkline data source has non-numeric data? How will it be displayed?
I will deliberately introduce non-numeric data for the city of Pune.

And here is what you get.

b) What if the Sparkline data source has a few blank values? How will it be displayed?
This is how it will be plotted.

c) What if the Sparkline data source has few zero values? Actually the display does not change from when
the Sparkline data source had blank values.

d) I have introduced some error in the Sparkline data source and let us watch the display.
Win/Loss Sparklines
Let us take an example of inter-collegiate fest. We have 6 teams: Team 1, Team 2, Team 3, Team 4, Team
5 and Team 6. Each of the team were required to play a game of basketball against the rest of the 5 teams.
A win has been represented with a 1, a loss with a -1 and a draw (no win – no loss) with a zero.
Here is the data in the excel sheet.

Let me explain the data for Team 1 and Team 5.


Team 1 has won its matches against Team 2 and Team 4. However it has lost its matches against Team 5
and Team 6.
Team 5 has won its matches against Team 1, Team 4 and Team 6. However it has lost its matches against
Team 2 and Team 3.
Likewise for the other teams.
Let me show you how to get the Win-Loss Sparklines for this data set.
Step 1:
Select Cell I3.

Step 2:
Go to INSERT on the menu bar and click on the Win-Loss Sparkline.
This brings up the Create Sparklines dialog box.
Type in the Data Range as follows:

Click on OK.
The display is as follows:

I will now add two extra columns to count the number of wins and number of losses.
Here is the final display.

Step 3:
Let me auto-fill for the remaining rows.
And here is the output:

Conclusion:

 Sparklines are miniature charts that fit into a single cell.


 It presents the data as cleaner and eye-catching.
 They are so compact that we can have one for each row. It can be place next to the data source
which makes it easier to see the relationship.
Scatter plot with trendline
Why Scatter plots?
Scatter plots are often used to determine if there is a relationship between variable X and Variable Y.
Let me show you how to plot a scatter chart?
Step 1
First let me get an appropriate data set onto an excel sheet.

As you can see from the above data set, we are trying to find the relationship between the applied force
(force exerted by the mass) and extension (of the spring) to eventually determine k (as per Hooke’s law)?
Step 2
Select the data set (A2:B7) as shown below.

Step 3
Click on INSERT on the menu bar. Select Scatter with Straight lines and Markers under Chart group.
You will see a chart as follows:

The first thing let us do away with the grid lines and set the titles appropriately.
The horizontal axis of a scatter chart is a value axis, so we have more axis scaling options (the same as a
vertical axis which always is a value axis).
Now for the trend line.
Step 4
Select the data series as shown below and right click to bring up the context menu.

Step 5
Select ADD Trendline.
Scroll down to select the following:

 Display equation on chart


 Display R-squared value on chart.
The chart appears as below:
Let us do a little formatting to the trend line.

We have select a different colour for the trendline, made the width as 1.25pt and the dash type is chosen
as “SOLID”.
The effect is as shown above.
The R-squared value is close to one, which means there is a strong relationship between Extension and
Force applied.
Let us find out if there is a relationship between X (a person's salary) and Y (his/her car price).
Step 1:
We place the data in the excel sheet as follows:

Step 2:
Select the data (A2:B10).

Step 3:
Select INSERT on the menu bar and then under CHART group, scatter with markers only.
Step 4:
Let me add the trend line to clearly see the relationship.

Step 5:
Let us change the shape of the marker.
Select Data Series.
Right click to pull up the context menu. Select Format Data Series. Select Fill & Line.

Select MARKER.
Select Marker Options.
I have chosen the built-in type as diamond and the size as 9. I have also removed the grid lines and added
the chart title. The result is as below:
Stem and Leaf plot
Let us first understand the advantage of sketching a stem and leaf plot. It is basically to organize numeric
data in a way that it becomes easily comprehensible. An example of this numeric data can be scores of the
students in a particular subject, etc.
How to construct a stem and leaf plot?
a) Separate out the last digit of the number and get it to constitute the leaf.
b) The remaining part of the number after having extracted the last digit (the leaf) will then constitute
the stem.
For e.g. if we have a score like 93, the leaf here will be the number 3 and the stem will be the number 9.
Actually the number 9 indicates all values between 90 and 99.
Likewise if we have a score like 82, the leaf will be the number 2 and the stem will be the number 8.

You are a trainer at a leading educational institute. You teach algebra to the VI grade class of 18 students.
Yesterday you had given a class test to your students. You have scored them. How should you organize
your data such that a quick glance tells you how your students have fared in the class test? How many have
scored above 80%, etc.? You run the various charts in your mind and decide on the stem and leaf plot.
The data…
You are looking to construct a stem and leaf plot as below:

The stem and leaf plot helps to quickly answer the following questions:
a) What is the highest score in Algebra in this class?
Ans: 99
b) What is the lowest score in algebra in this class?
Ans: 56
c) How many have scored above 80%?
Ans: 10
d) What are the scores in the range between 80 and 89?
Ans: 80, 84, 86, 88 and 89
Let us see how to proceed to construct the stem and leaf plot.

Step 1:
First, ensure the numbers (scores in algebra in our example) are arranged in ascending order.
Step 2:
Let us go for an intermediate display first.
It should be something like this:

Let us plot the stem first. Since the scores are spread between 56 and 99, we will make a stem of 50 (covers
all scores between 50 and 59), 60 (covers all scores between 60 and 69), 70 (covers all scores between 70
and 79), 80 (covers all scores between 80 and 89) and 90(covers all scores between 90 and 99). Had there
been a student who had a perfect score of 100, we would have added 100 to the stem as well.
Let us place 50, 60,70,80,90 (our stem) into cells E7 through E8 to E11.
Now is the turn for the leaves.
Let us pick (copy) the number 56 from the score and under the paste special options, select paste transpose.
We will repeat the same for all numbers between 60 and 69 (i.e. 65, 67, 68 and 69). Likewise for all the
remaining numbers as well.
Here is how the display would look like:

Step 3. Now for the actual stem and leaf plot.


If we remove the last digit from the scores, the remaining part of the number constitutes the stem. And as
we have already mentioned that if we have, say 5 in the stem, it is good enough to represent any number
between 50 and 59. Likewise a 6 on the stem will represent all numbers between 60 and 69.
How do we get the leaves done up for this plot? Well, we can use the MOD function.
The MOD function uses 2 arguments, a number and a divisor. It returns the remainder after the number is
divided by the divisor.
For e.g. to get the value 6 (leaf value) in Cell F15, we can use the MOD function as follows:
Cell F15  = MOD (F7, E7)
Likewise to get the leaves (5, 7, 8 and 9) against the stem value 6, we will use the formula = MOD (F8,
$E48) in Cell F16 and then drag the formula all the way up to Cell I16.
We will repeat the same step for all the row, and our stem and leaf plot is ready.
Stem and Leaf plot thus serves as an ideal plot to depict the distribution of scores.
Histogram
Why histogram?
This is because this is by far the best depiction of the frequencies for a data set.
How do we plot a histogram?
I will need a data set and a bin range.
I will take a small dataset of employee nos and their respective ages. Let me place it on an excel sheet.

The bin range that I have decided is as follows:

Let me explain the bin range.


The first value in the bin range is 10. This is the upper limit which means all values in the data set <=10
will fall in this category. The next value in the bin range is 20. This means that all values from the data set
which are >1 and <=20 will be in this category and so on. The last value in the bin range is 60. There will
be an extra category for all values > 60.
All in all the values from the data set will be classified into seven categories. It is actually the frequency
that we are interested in. This is to say how many or the count of the data values in each category.
Steps to get the histogram and the cumulative percentage.
Step 1:
Go to DATA on the menu bar. Select Data Analysis option.

If the Data Analysis option is not visible. Follow the below steps to add it.
a) Click on File.
b) Click on Options
c) Click on Add-Ins
d) Select Excel Add-ins. Click on Go.
e) Click OK.

Step 2:

Click on Data Analysis.

Click on OK.

Step 3:

The Histogram dialog box shows up.


Let us fill in the values for the Input Range, Bin Range and Output Range.

I have used the age of the employees as the input range ( $B$2:$B$11).
I have used the Bin Range as $A$14:$G$14.
I will go for the Cumulative percentage and also the chart output.
Click on OK.
Let me explain the display of cumulative percentage and frequency.
The bin ranges are to be interpreted as follows:
10: <=10
20: >10 and <=20
30: >20 and <=30
40: >30 and <=40
50: >40 and <=50
60: >50 and <=60
More: >60
If you look at the output, there is no employee with age in the first bin range. There are two values (19
and 20) in the second bin range and so on.
Let us do a bit of formatting to our chart…
I will alter the bin range and you will see the effect in the chart.
Type in as follows:
‘0-10 (precede it with apostrophe)
’10-20
’20-30
’30-40
’40-50
’50-60
In the example above our bin range was placed horizontally. What if we place the bin range vertically?

I will show the histogram dialog box below.


You will notice that there is absolutely no difference in the output.

Just one more thing.


You will notice that there is absolutely no difference in the output if the bin range is in descending
order.
Let me try another variation for bin range. I will try unequal intervals.

Let me also fill up the histogram dialog box.


The output is as follows:
Section III: Analysis in Excel
Re-Sampling for Data Analysis
Let me start off with sharing two data sets. One data set has average instructor feedback for a set of 11
senior evangelists of a prestigious institute. The other data set has the average instructor feedback for a set
of 9 junior evangelists of the same institute.
We would like to draw a conclusion on whether experience helps deliver a training better because the
evangelist is more familiar with pain points that students/learners experience while picking up difficult
topics and also are most familiar with frequently asked questions (FAQs).
On the other hand, junior evangelists are more likely to surf the internet more to get more and more
information. In other words they are likely to put in more hours of preparation to compensate for the lack
of experience.
We have just a sample data set and basing our conclusions on it would be unfair. At the same time
completing ignoring it is also not justified. What if we could be given 300 such samples to analyze? We
would be more confident while stating our conclusions.
Where to get these 300 samples from? Can we generate it ourselves? We will try to re-sample the sample
given to us.
Let us get started.

The average instructor feedback for senior evangelists is computed using the formula:
=AVERAGE (C3:C13)
Likewise the average instructor feedback for junior evangelist is computed using the formula:
=AVERAGE (G3:G11)

Based on the average instructor feedback, we can determine whether senior evangelists conduct more
effective sessions or junior evangelists. But based on one sample data, it is too preposterous to arrive at the
conclusion.
The formula used to determine the effectiveness is =IF (C15>G15, 1, 0).
Let us generate the second sample set ourselves.
To do this, I will use RANDBETWEEN () and VLOOKUP () functions.
I will pick the Cell where I need the next sample data set to be generated.
I will choose A21 and type the formula =RANDBETWEEN (1, 11)
And here are the numbers…

Let me now use the Vlookup in Cell B21.


The formula is =VLOOKUP(A21,$A$3:$C$13,3)

Auto fill from Cell B21through B22 to B31.

Likewise let us generate the sample data set for junior evangelists.
As before we use the VLOOKUP function to get the average instructor feedback for the sample for junior
evangelists.

Now to look at the formula to get the effectiveness of session delivery…


For this sample, we find that there is no conclusive answer.
The first sample gave us the answer in favor of senior evangelists. The Second sample is a tie between both
parties.
To be conclusive enough, we will have to repeat the same for a greater number of samples. I will go with
300 samples.
The problem is how you get 300 samples.
We will work with data tables to do the job for us.
Let me place the steps below:
Step 1:
I have generated natural numbers from 1 to 300 in Cell A39 to Cell A338.
Step 2:
In Cell A38, I make a reference to Cell E36.

Step 3:
Select the cell range – A38:A338. Go to DATA on the menu bar and click on What-if Analysis. Select Data
Table.
Click on column input cell. Once there click anywhere outside on a blank cell and that should do the trick
for you.
Click on OK. The display now looks like the below.
The output is visible till Cell A338.
Now to count how many 1’s do us have and how many 0’s. The greater the number of 1’s, we see the
outcome weighing in favor of senior evangelists.
We compute the average in Cell A338.
The formula is =AVERAGE (B39:B338).
The output is 0.71.
As per the output, at least 71% of the time (71% of the 300 samples that we have analyzed), the output is
in favor of the senior evangelists.
If one presses F9, the output is likely to change for the 300 resampling and you will end up seeing a different
estimate.
Scenario Manager
I will explain this with a simple example of planning a “get together” for a close group of friends. We are
budgeting for the same. We already have charted the menu for the evening with friends. We have also jotted
down the approximate pricing of each menu item. We are looking at ordering pizzas for everyone and we
are slightly confused as to how many pizzas should we order and what should be the pizza size that we
should go for. The cost of pizzas is as follows:
Small Size Pizza: $15.00/-
Medium Size Pizza: $20.00/-
Big Size Pizza: $25.00/-
We have three choices. We can order 4 Big Size Pizzas or 5 Medium Size Pizzas or 6 Small Size Pizzas.
We would like to know the total expense that we will have to expend if we order any of the above options
respectively.
I will first share the data that we will work with.

As of now, the no. of pizzas and the price of Pizza is given as NULL. Adding the approximate cost of the
remaining menu items, we get the total, $165.00/-
The formula used to compute the Total Cost is =SUM(C3:C5,C7*C6,C8:C9). Please make sure that you
use cell references and formulas as far as possible.
I will create a scenario which will take in the no. of Pizzas as 4 and the Prize of Pizza as $25 and then
compute the Total Cost.
Then we will go on to create another scenario to take in 5 as the value for No. of Pizzas and $20 as the price
of Pizzas respectively and get the corresponding Total Cost.
Finally we will create another scenario to take in 6 as the value for No. of Pizzas and $15 as the price of
Pizzas respectively and get the corresponding Total Cost.
How to create a scenario?
Step 1: Data on the Menu bar  What-If Analysis

What – If analysis has a drop down. There are three options available: Scenario Manager, Goal Seek and
Data Table.

Click on Scenario Manager. The following window is displayed.

We will click on Add to add our very first Scenario. I will name the scenario as “Order – 4”.
There is an option to cite “Changing Cells”. I have provided the input as C6:C7. Cell C6 will take in the
No. of Pizzas and Cell C7 takes in Prize of the Pizza. I response to “Changing Cells”, we can provide the
reference to a single cell or a range of cells.

When I click on OK, I am back to the previous screen.


Let us click on show to see the results.

We will create another scenario. We will call it “Order – 5”. It is created exactly the same way as the
previous scenario except for the value provided for C5 and C6. The values provided this time is 5 and 20
respectively. The below is the output for this scenario.
The last scenario called “Order – 6”. This again has been created the same way as the previous two
scenarios. The values for Cell C5 and C6 are 6 and 15 respectively.

Each time that it is required to check the values for any combination. We just have to pull open the scenario
manager and select the scenario and click on “Show”.
Likewise we can create several such scenarios.

Goal Seek

Let us take a step further. Assuming that we decide to go with Small Size Pizzas and we have an overall
budget of $255.00/- How many Small Size Pizzas should we order. Goal Seek comes to our rescue.
We will work with the same data for the party budget.
We have placed zero for the number of pizzas in Cell C6. We have placed $15.00, the price of Small Size
Pizza in Cell C7. The Total Cost is computed using the formula =SUM(C3:C5,C7*C6,C8:C9).
To be able to decide on the Number of Pizzas, given that we have an overall budget of $255, we will use
Goal Seek.
How to use Goal Seek?
Select the Data option on the menu Bar and then select What-If Analysis. Three options are visible in the
drop down menu.

The second option is “Goal Seek”. When we click on the Goal Seek option, the following dialog box opens.

Fill in the values as below.

The Cell C11 has the formula for computing the Total cost. We set this Cell to 255 as this is the overall
budget available with us. We will work towards getting the Total Cost to $255 by allowing changes to be
made to Cell C6. All other menu items are a must have.

When we click on OK, the following result is displayed.


So, we can go for 6 Small Sized Pizzas keeping the other menu items as is and maintain an overall budget
of $255.00/-
Waterfall chart in Excel
There is no ready-made waterfall chart available in excel. However we will make use of a workaround to
get us the same look and feel of a waterfall chart.
How shall I start?
Step 1:
Let me get an appropriate data set on the excel sheet. Given below is the data of Superstore Expenses and
Net Profit.

We consider the below categories of expenses/costs:


a) Cost of Sale of Products
b) Gross Profit on Sales
c) Management Costs
d) Cost of Sales
e) Other Operating Costs
f) Financial Costs

Now we calculated the residual profit. We start off with a Total Revenue of $1,000,000.00 in Cell C3. The
first expense is the “Cost of Sale of Products” which amounts to $350,000.00 in Cell C4. We deduct this
amount of $350,000.00 in Cell C4 from Total Revenue of $1,000,000.00 in Cell C3. The Profit left is
$650,000.00. This is the Gross Profit in Sales in Cell C5. From this we further deduct the Management
costs of $240,000.00 in cell C6. The profit left with us now is $410,000.00. And so on…
Towards the end, after all expenses we are left with a Net Profit of $8,000.00.
Step 2
Let us plot the above data in a waterfall chart.
a) Go to INSERT option on the Menu Bar. Go to Recommended charts and then select Stacked
Column
b) Drop the Chart Title, Grid Lines and Legend. Format the Axis Line to Solid Line.
The chart appears as below.
c) Select the lower portion of the stack column chart. Right click to pull up the context menu. Select
Format Data Series. Go to the Fill Option and Select No Fill.

d) While still in the Format Data Series, go to Series Option and reduce the Gap width to Zero
Percentage.
e) Format the Columns, “Total Revenue” and “Gross Profit on Sales” by filling in Solid Color
“Green”.
Solver

Let us start by solving a very simple equation.


X=0
Y=0
Z=X+ Y
We would like to know those values of X and Y that will give us a value of Z as equal to 10.
But yes, there are some constraints.
(i) X should be greater than 5
(ii) Y should be greater than 3
(iii) The value of Z computed after summing up the values of X and Y should be equal to 10
(iv) Both X and Y should be integer values only

Let us look at the possible values of X and Y as per the constraints:

Possible values of Possible values of


X Y
6 4
7 5
8 6
9 7
10 8
9
10

And what could be the possible combinations of X and Y that can give us the value of Z as equal to 10.

Possible combinations of X
and Y to get Z as equal to 10
X Y
10
9
8
7
6 4

Let us show how Excel can help us solve this problem.


We will call X and Y as the decision variables. These variables represent unknown quantities.
The objective here is expressed as a mathematical expression in decision variables.

Step 1:

Let us get the data on to the excel sheet.

In Cell B3, we have used the formula: =B1 + B2

Step 2:
Let us go to the menu bar and select the DATA menu option. Then click on the solver option.

If the solver option is not visible, do the following:


Go to FILE on the menu bar. Click on Options.

Click on Add-Ins.
Select Excel Add-ins and click on the Go button.

Click on the Solver Add-in. click on OK.


You will see Solver under Analysis Tab of DATA menu option.

Step 3:

Click on the Solver.


Step 4:

Let us do the settings:

Set Objective: $B$3


To a value of 10
By changing cells: $B$1, $B$2
Let us start to add the constraints.

Click on Add. It displays the following dialog box.

Let us add the constraints one by one.


Constraint 1: $B$1 >=6.

Constraint 2: $B$2 >= 4.

Constraint 3: $B$1 should be an integer.

Constraint 4: $B$2 should be an integer.

After all the constraints are keyed in, the Solver dialog box is as follows:
The output is as follows:

The Solver also displays the following message:


We will click on OK to keep the solver solution.
Now that we have done an example on the use of solver and have the basic understanding, let us use to
solve it a more complex problem.

We work for an investment bank. We have five different bond types with us. Let us call them as Bond A,
Bond B, Bond C, Bond D and Bond E. Each of these bonds have a specific returns on the amount invested.
Few of them are for short term between (6 months to 11 months) and few are long term (between 1 to 3
years). Again, few are low risk and few are high risk bonds. Few of these bonds also are tax exempted. Let
us call these as tax free bonds.

The challenge before us to invest in these bonds such that the following constraints apply:

a) The amount invested in short term bonds should be >=$50,000.00


b) The amount invested in high risk issues should be <=$50,000.00
c) The amount invested in tax free bonds should be >=$30,000.00
d) 40% of the total returns should be tax free
e) The investments made in every bond should be >=$0.
f) The amount invested in the various bonds should be equal to $100,000.00.
Where do we start?
Before we start to give you the steps, let us work out a general model to solve these optimization problems.
So, what are optimization problems? These are real world problems that one encounters in the field of
mathematics, engineering, science, business etc. The essence of solving these problems lies in finding the
most optimal or most efficient way of utilizing the limited resources to achieve the problem objective.
We will deal with the following:
Decision variables: the decisions of the problem are represented using symbols such as X1, X2, X3, X4…
Xn. These variables represent unknown quantities such as in the example above how much to invest in each
bond.
Let us say X1 is the amount to invest in Bond A, X2 is the amount to invest in Bond B, X3 is the amount to
invest in Bond C, X4 is the amount to invest in Bond D and X5 is the amount to invest in Bond E.
Objective function: the objective of the problem is expressed as a mathematical expression in decision
variables. E.g. the objective of the problem stated above is to maximize the return on investments made in
the various bonds.
Constraints: the limitations or requirements of the problem are expresses as equations in decision variables.
Now let us get started on the steps to solve the problem at hand.
Step 1:
Let us first get the data into the excel sheet.
Let us explain column E, G and I.
Colum E has the short term representation expressed as 1 or 0. It has a value 1 if it is a short term investment
else 0.
Column G has the high risk representation expressed as 1 or 0. It has a value 1 if it is a high risk issue else
0.
Likewise Colum I has the tax free representation expressed as 1 or 0. It has a value 1 if it is tax free else 0.

Column B11 has the formula to compute the “Total Returns on Amount Invested”.
The formula is as follows:
=((C6*B6)+(C7*B7)+(C8*B8)+(C9*B9)+(C10*B10))

Step 2:
Let us now get the constraints in:
Cells B6 to B10 will contain the amount to be invested for the various bonds.
Constraint 1:
The total amount available for investment is $100,000. This is to say that once you sum up the amounts to
be invested in all the bonds (Cell B6:B10), the total amount should be equal to $100,000.00
Constraint 2:
The investments made in short term bonds should be >=$50,000. Bond B and Bond E are short term
investments.
Therefore the amount invested in these two bonds (Cells B7 and B10) should be >=$50,000.

Constraint 3:
The investments made in high risk issues should be <=$50,000. Bond A, D and E are high risk bonds.
Therefore the amount invested in these three bonds (Cells B6, B9 and B10) should be <=$50,000.

Constraint 4:
The amount invested in all bonds (Bond A, B, C, D and E) should be >=$0.
Constraint 5:
The investments made in tax free bonds should be >= $30,000. Bond A, B and D are tax free bonds.
Therefore the amount invested in these three bonds (Cells B6, B7 and B9) should be >=30,000.

Constraint 6:
40% of the total returns should be tax free. How do we compute this?
Total Returns is given by the formula:
40%(9.5%X1 + 8.0% X2 + 9.0% X3 + 9.0% X4 + 9.0% X5)
Since Tax free bonds are Bond A, B and D, the constraint is spelled as:
9.5%X1 + 8.0% X2 + 9.0% X4 >= 40%(9.5%X1 + 8.0% X2 + 9.0% X3 + 9.0% X4 + 9.0% X5)
Cell C20 has the formula:
=0.4*((C6*B6) + (C7*B7)+(C8*B8) + (C9*B9) + (C10*B10))
Now our excel sheet is all set, let us invoke the solver.

Step 3:
Go to DATA on the menu bar and select Solver. We have filled in the solver dialog box with appropriate
constraints and have set the required values.
Now clicking on Solve, it returns the following output:
You can see from the above output that our total investments in all bonds is exactly equal to $100,000.00
Now let us use solver to decide on an optimal meal. Assume we are at McDonald’s and want to quickly fix
up a meal for ourselves. But we also watch our calories intake and are pretty particular about the amount
of carbohydrate, sugar and fat that we consume.
Here is some data on our favorite food items, together with the calories and the amount of carbohydrate,
sugar and fat that we are likely to consume.

Let us begin by defining the decision variables, objective function and the constraints/limitations.
Decision Variables:
X1: Unknown units of Hot Fudge Sundae
X2: Unknown units of McSwirl
X3: Unknown units of Mcflurry
X4: Unknown units of Chicken McGrill

Objective function: to keep the bill amount to the lowest possible considering the constraints.

Constraints:
a) Total Calories count should be greater than or equal to 500.
b) The amount of carbohydrate in gram for all food items chosen (all units taken together) should be
greater than or equal to 6.
c) The amount of sugar in gram for all food items chosen (all units taken together) should be greater
than or equal to 10.
d) The amount of fat in gram for all food items chosen (all units taken together) should be greater than
or equal to 8.
We have placed all the above in the excel sheet as follows:
Now let us jot down a few formulas:
We will go step by step with each constraint.
1. Total Calories count should be greater than or equal to 500.
The formula to get the total calories count is to multiply the units to order for each food item (Hot Fudge
Sundae, McSwirl, Mcflurry and Chicken Mcgrill) with the calories associated with each food item.
For. E.g. ((no. of units to order for Hot Fudge Sundae * 500 (calories for Hot Fudge Sundae)) + (no. of
units to order for McSwirl * 350 (calories for McSwirl)) + (no. of units to order for Mcflurry * 150 (calories
for Mcflurry)) + (no. of units to order for Chicken McGrill * 500 (calories for Chicken McGrill)))
The calories are placed in the Cell Range: B2:E2
The no. of units to order for the various food items are placed in the Cell Range: B9:E9

2. The amount of carbohydrate in gram for all food items chosen (all units taken together) should be
greater than or equal to 6.

The Carbohydrates (in gram) for various food items are placed in the Cell Range: B3:E3
The no. of units to order for the various food items are placed in the Cell Range: B9:E9
Working as above the formula is:
=((B3*B9) + (C3*C9) + (D3*D9) + (E9*E3))

3. The amount of sugar in gram for all food items chosen (all units taken together) should be greater than
or equal to 10.
The Sugar (in gram) for various food items are placed in the Cell Range: B4:E4
The no. of units to order for the various food items are placed in the Cell Range: B9:E9
Working as above the formula is:
=((B4*B9)+ (C4*C9) + (D4*D9) + (E4*E9))

4. The amount of fat in gram for all food items chosen (all units taken together) should be greater than or
equal to 8.
The Fat (in gram) for various food items are placed in the Cell Range: B5:E5
The no. of units to order for the various food items are placed in the Cell Range: B9:E9
Working as above the formula is:
=((B5*B9) + (C5*C9) + (D5*D9) + (E5*E9))

5. Lastly the formula to get the total cost of all ordered items:
The cost per one unit of various food items are placed in the Cell Range: B7:E7
The no. of units to order for the various food items are placed in the Cell Range: B9:E9
Working as above the formula is:
=((B9*B7) + (C7*C9) + (D7*D9) + (E7*E9))

Now that the excel sheet is good to go, let us enter the above mentioned constraints and objective in the
solver.
Go to DATA on the menu bar and select SOLVER
Given below are the settings in the solver:
Click on solve to get the below output:
Given the constraints, we will have to be happy ordering 1 unit of McSwirl and 2 units of Mcflurry. The
total bill amount comes out to be 80 cents and we have kept the calories and the other ingredients
(carbohydrates, sugar and fat) too in check.
Binomial Distribution
Let us answer a few quick questions.
What is Binomial distribution?
It is a discrete probability distribution.
When should one use binomial distribution?
One should use binomial distribution when there are exactly two mutually exclusive outcomes of a trial.
These outcomes are labelled as “Success” and “Failure”.
Now for the most important question…
Why should you be using binomial distribution?
The Binomial Distribution is used to obtain the probability of observing r successes in n trials, with the
probability of success on a single trial denoted by p.
P(X = r) = n C r p r (1-p) n-r where,
n = Number of events
r = Number of successful events
p = Probability of success on a single trial.

n C r = ( n! / (n-r)! ) / r!
1-p = Probability of failure.

You have enrolled for a course on statistics. There is a chapter on probability. You really want to learn it
well. You get yourself started on a simple problem. The problem statement asks you to toss a coin 3 times
and yes, here is the question “What is the probability of getting exactly 2 heads?”
Step 1:
Here, Number of trials n = 3.
Number of success r = 2.
Since we define getting a head as success, the Probability of success on any single trial p = 0.5.

Step 2:
To calculate n C r formula is used. n C r = ( n! / (n-r)! ) / r! = (3! / (3-2)! ) / 2! = (3! / 1! ) / 2! = (6 / 1) / 2 =
(6/2) = 3

Step 3:
Find p r. p r = 0.25
Step 4:
To find (1-p) n-r
Calculate 1-p and n-r. 1-p = 1-0.5 = 0.5, n-r = 3-2 = 1

Step 5:
Find (1-p) n-r
= 0.5

Step 6:
Solve P(X = r) = n C r p r (1-p) n-r = 3 * 0.25 * 0.5 = 0.375 the probability of getting exactly 2 heads is 0.375.

We will use excel to help me solve the above stated problem of determining the probability of getting
exactly 2 heads when 3 coins are flipped.
As we are all aware a coin has two sides, a head and a tail.
Let us look at the probabilities of getting n no. of heads when flipping three coins.
There are eight possible outcomes that we come across if three coins are flipped.
These eight outcomes are illustrated below:

What is evident is, one can get a maximum of three heads and a minimum of no heads (Zero heads) at all.
Let us add the probability in a column to the right of the combinations.
How did we compute the probabilities? You can see that a maximum of 8 such outcomes are possible, and
that each combination is just one from amongst the eight possible outcomes available, therefore the
probability can be computed as 1/8 which is equal to 0.125.
If we add up all these eight probabilities, we should get a 1.

Let us add another column to the side of the Probability column to give us the number of heads in each
outcome.
We will put together another table for better understanding.
Cell D16 has the formula/content as 0.125
Cell D17 has the formula as: =0.125*3
Likewise for Cell D18 and D19.
The sum of all probabilities is given by the formula: =SUM (D16:D19).
Let us now use the BINOMDIST function to return the individual term binomial distribution probability.
The formula and the explanation for the BINOMDIST function is as follows
Syntax
BINOMDIST (number_s, trials, probability_s, cumulative)
The BINOMDIST function syntax has the following arguments:
Number_s: Required. The number of successes in trials.
Trials: Required. The number of independent trials.
Probability_s: Required. The probability of success on each trial.
Cumulative: Required. A logical value that determines the form of the function. If cumulative
is TRUE, then BINOMDIST returns the cumulative distribution function, which is the probability that there
are at most number_s successes; if FALSE, it returns the probability mass function, which is the probability
that there are number_s successes.
The output is as follows:
a) Probability of getting zero head when 3 trials (3 coins are flipped) are conducted.

b) Probability of getting one head when 3 trials (3 coins are flipped) are conducted.

c) Probability of getting two heads when 3 trials (3 coins are flipped) are conducted.
And lastly,

d) Probability of getting three heads when 3 trials (3 coins are flipped) are conducted.

Note: The sum of all probabilities adds up to 1.

You might also like