Electronic Spreadsheet (Advanced) Notes
Electronic Spreadsheet (Advanced) Notes
Introduction to Spreadsheets
A spreadsheet is a digital tool used for organizing, analyzing, and storing data in a tabular form.
It consists of a grid made up of rows and columns, which can be used to perform calculations,
create charts, and automate tasks.
-----------------------------------------------------
Data Consolidation in Excel
Data consolidation in Excel is a powerful feature that allows you to combine data from multiple
worksheets or workbooks into a single, cohesive summary. This is particularly useful when you
need to analyze or report on data spread across different sheets, such as monthly sales reports
from different branches, or when you want to aggregate data from various sources.
1. Consolidation by Position: This method consolidates data based on the position of the cells.
It assumes that data from different sheets or workbooks are arranged in the same order and have
the same layout.
Consolidation by Position
Consolidation by Position is ideal when data in all source ranges are organized in the same order
and format. The position of data in each worksheet is crucial because Excel aggregates data
based on cell references.
Imagine you have monthly sales data for three different branches stored in separate worksheets,
each having the same structure.
Data Structure:
| A (Item) | B (January) | C (February) | D (March) |
|----------|---------------|------------------|-----------|
| Item 1 | 500 | 550 | 600 |
| Item 2 | 300 | 320 | 350 |
| Item 3 | 400 | 420 | 450 |
Let's assume this structure is replicated in three sheets: Branch1, Branch2 , and Branch3 .
1. Open Excel Workbook : Open the workbook containing the sheets you want to consolidate.
2. Create a New Sheet : Insert a new worksheet where the consolidated data will appear, e.g.,
"Consolidated Sales".
4. Select Consolidate : Click the Consolidate button in the Data Tools group.
5. Choose Function : In the Consolidate dialog box, choose the function you want to use (e.g.,
Sum , Average ).
6. Add References :
- Click Add to select the range from each worksheet.
- For example, in Branch1 , select `B2:D4`.
- Repeat for Branch2 and Branch3 .
7. Check Top Row and Left Column : Ensure Top row and Left column are unchecked as
data is consolidated by position, not by label.
8. Click OK : Excel will consolidate the data into the new sheet based on the specified function.
Result:
Explanation : The values for each item are summed across all branches for each month.
Consolidation by Category
Consolidation by Category is used when the data contains category labels, but the layout might
differ. This method consolidates data based on matching labels across different sheets.
Suppose you have expense reports from three departments, each with different structures but
common category labels.
Department1:
| A (Category) | B (Amount) |
|--------------|------------|
| Rent | 2000 |
| Utilities | 500 |
| Supplies | 300 |
Department2:
| A (Category) | B (Amount) |
|--------------|------------|
| Supplies | 400 |
| Rent | 2200 |
| Utilities | 600 |
Department3:
| A (Category) | B (Amount) |
|--------------|------------|
| Utilities | 550 |
| Rent | 2100 |
| Supplies | 350 |
4. Select Consolidate : Click the Consolidate button in the Data Tools group.
6. Add References :
- For Department1 , select the range `A2:B4`.
- Repeat for Department2 and Department3 .
7. Check Top Row and Left Column : Check Top row and Left column to match data based
on category labels.
Result:
| A (Category) | B (Amount) |
|--------------|------------|
| Rent | 6300 |
| Utilities | 1650 |
| Supplies | 1050 |
Explanation : Values are aggregated based on matching category labels across departments.
Automatic vs manual updation
In the consolidate dialog box, when you check the ‘Create links to source data’ any changes to
data in source sheets will automatically update the destination sheet too.
When you uncheck the ‘Create links to source data’ any changes to data in source sheets will not
reflect in destination sheet and will have be done manually.
Note – Create links to source data works only when source and destination areas are on
different sheets.
NOTE – If any labels in the source sheets do not match with each other, it results in separate
rows or columns in the consolidation.
-----------------------------------------------------
Creating Subtotals in Excel
Subtotals in Excel allow you to summarize data within a list or a range by automatically adding
subtotal rows for groups of data. This feature is particularly useful for analyzing large datasets by
grouping related data and calculating aggregates like sums, averages, counts, and more for each
group.
Data Analysis: Subtotals help in breaking down complex datasets into manageable
groups, making it easier to analyze and interpret the data.
Automatic Calculation: Excel automatically inserts subtotal rows, eliminating the need
for manual calculations.
Multiple Functions: You can use various functions such as SUM, AVERAGE, COUNT,
MIN, MAX, etc., to calculate subtotals.
Visibility and Organization: Subtotals make it easy to see totals and summaries, aiding
in decision-making and data presentations.
Ensure that your data is organized in a tabular format with headers. Each column should have a
unique header name.
Before applying subtotals, you should sort your data by the column you want to group by.
For example, if you want to calculate subtotals for each Product, sort the data by the Product
column.
1. Select the Data Range: Highlight the entire data range, including the headers.
2. Open the Subtotal Dialog Box:
o Go to the Data tab on the Ribbon.
o Click on Subtotal in the Outline group.
4. Check Options:
o Replace current subtotals: Check this box if you want to replace any existing subtotals.
o Page break between groups: Check this box if you want a page break after each group
(useful for printing).
o Summary below data: Ensure this box is checked if you want the subtotal to appear
below each group.
5. Click OK: Excel will automatically insert subtotal rows and calculate the specified
function for each group.
Step 4: View and Analyze the Results
Excel will display a structured view with subtotal rows for each group. You can expand or
collapse these groups using the outline buttons (plus and minus signs) on the left side of the
worksheet.
Note - Subtotals do not work on MS excel tables. If it is a table, subtotal button will be disabled.
Note – For subtotal to work, the field on which you want the subtotal to work is to be sorted.
-----------------------------------------------------
Using What-if analysis in Excel
What-If Analysis is a decision-making tool that allows you to change the values in your
spreadsheet to see how those changes will affect the results of your formulas. It is particularly
useful for exploring various scenarios and understanding how different inputs can affect
outcomes.
Types of What-If Analysis - Excel provides three main types of What-If Analysis tools:
1. Scenario Manager
2. Data Tables
3. Goal Seek
1. Scenario Manager
Scenario Manager allows you to create and save different groups of input values, called
scenarios, and then switch between these scenarios to view the possible outcomes.
Multiple Scenarios: Create multiple scenarios with different values for the same set of
variables.
Scenario Summary: Generate a summary report to compare all scenarios side by side.
Easy Management: Easily add, edit, and delete scenarios as needed.
Scenario Manager is best used when you need to analyze the impact of changing multiple
variables on a set of formulas or results. Examples include:
Budgeting and Financial Planning: Assess the impact of different expense and revenue
scenarios on profitability.
Sales Forecasting: Explore the effects of different sales volumes and pricing strategies
on total revenue.
Project Management: Evaluate project timelines and budgets under various
assumptions.
3. View Scenarios:
o In the Scenario Manager dialog, select the scenario you want to view and click
Show.
Scenario Summary
Imagine you are creating a budget for a small business. You want to see how different sales
levels and expense levels affect your net profit.
Steps:
By switching between scenarios, you can quickly compare the outcomes of different business
strategies.
Solver in MS excel
The Solver in MS Excel is a powerful tool used for optimization problems.
It helps you find the best solution for a given problem by changing different variables while considering
certain constraints. You can use it to maximize or minimize a particular value, such as profit or cost.
Key terms
Objective Cell: The cell that contains the formula you want to optimize (maximize,
minimize, or set to a specific value).
Variable Cells: The cells that Excel will change to optimize the objective cell.
Constraints: The restrictions or limits on the values that variable cells can take.
Example :
Given a budget of 65000, you need to allocate it to projects A to I such that the total costs of all
projects does not exceed 65000.
I have allocated the costs in such a way that its total cost is 60700. Now I need Excel Solver tool
to give me a solution such that the total cost is 65000.
Steps to solve
This is common when multiple people work on the same file or when you are comparing updated data
with previous records.
xlCompare is the best Spreadsheet Compare tool. Compare Excel spreadsheets for difference.
Compare two and three Excel spreadsheets for unique and duplicate rows. Merge Excel spreadsheets.
Step 1 – Open the xlCompare software and browse the two files as below
Step 2 – Click on ‘Compare files’ button on the top, it opens up a dialog box.
Then click on ‘Compare’ button (red button) inside the dialog box as below.
Step 3 – Once the comparison is completed, it displays the result as below.
Step 4 – You can see the detailed comparison at the bottom like below:
Total 4 differences found
a) Added row – Shows a unique row that is present in first file and not in second
file
b) Updated row – Three rows that are changed between first file and second file
is shown below.
The values are also shown with the cell number
Eg. $C$22 - ‘San Diego’ is changed to ‘Los Angeles’
Step 5 – You can also look at the Unique rows by clicking on the button ‘Unique rows’ at the
top bar as shown below
What all can we compare in xlCompare tool?
a) Entered values
b) Calculated values
c) Formulas
d) Hidden columns
e) Hidden items
XLCompare Features
If xlCompare tool throws an error as below, it means the second file is password protected.
Save Time: Automate repetitive tasks, saving you from doing the same thing over and
over.
Reduce Errors: Ensure consistency by having Excel perform tasks in the exact same
way every time.
Improve Productivity: Focus on more important tasks by letting Excel handle routine
work.
Macros are created using a programming language called VBA (Visual Basic for Applications).
However, you don't need to know VBA to record simple macros, as Excel provides a Macro
Recorder to capture your actions.
Recording a Macro
When you record a macro, Excel tracks each action you take and converts it into a VBA code.
Later, you can run the macro to perform all the recorded steps automatically.
1. Open Excel: Open the provided Excel file, which contains salary details for different
positions.
Now that you've recorded a macro to create a pie chart for one department, you can use it to
create similar charts for other departments.
Macro as a Function
1. Insert a Module:
o In the VBA editor, go to Insert > Module.
o This creates a new module where you can write your function.
Now, you will write the function that calculates the discounted price.
On the excelsheet, under the column J (DiscountedPrice) use the function created by
using = symbol, DiscountedPrice will automatically appear since its created in step 5.
Pass the two parameters (TotalPrice & 10% discount) to function DiscountedPrice and
press Enter.
You can see the result i.e. discounted price. Copy to rest of the cells
Now, you will write the macro to accept message from user and display it
Sub DisplayMessageBox()
Dim userInput As String
Output displayed
End Sub