0% found this document useful (0 votes)
15 views25 pages

Electronic Spreadsheet (Advanced) Notes

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

Electronic Spreadsheet (Advanced) Notes

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

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.

Key Components of a Spreadsheet


 Worksheet: A single sheet within a workbook, consisting of rows and columns.
 Workbook: A collection of worksheets within a single file.
 Cell: The intersection of a row and a column, identified by a cell reference (e.g., A1, B2).
 Range: A selection of two or more cells (e.g., A1:A12).

-----------------------------------------------------
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.

Excel provides two main methods for data consolidation:

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.

2. Consolidation by Category: This method consolidates data based on category labels or


headers. It is used when the data has different layouts but contains common labels or categories.

Let's explore both methods in detail with examples.

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.

Example Scenario: Monthly Sales Data

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 .

Steps to Consolidate by Position

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".

3. Go to the Data Tab : Click on the Data tab on the Ribbon.

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:

| A (Item) | B (January) | C (February) | D (March) |


|----------|-------------|--------------|-----------|
| Item 1 | 1500 | 1650 | 1800 |
| Item 2 | 900 | 960 | 1050 |
| Item 3 | 1200 | 1260 | 1350 |

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.

Example Scenario: Department Expenses

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 |

Steps to Consolidate by Category


1. Open Excel Workbook : Open the workbook with the sheets to consolidate.

2. Create a New Sheet : Insert a new worksheet named "Consolidated Expenses".

3. Go to the Data Tab : Click on the Data tab on the Ribbon.

4. Select Consolidate : Click the Consolidate button in the Data Tools group.

5. Choose Function : Select the desired function, such as Sum .

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.

8. Click OK : Excel consolidates data by matching 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.

Why Use Subtotals?

 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.

How to Use Subtotals in Excel

Step 1: Prepare Your Data

Ensure that your data is organized in a tabular format with headers. Each column should have a
unique header name.

Example - Sales Data

Region Salesperson Product Sales


North John Doe Laptop 1200
North Jane Smith Tablet 900
Region Salesperson Product Sales
South Alice Brown Laptop 1500
South Bob White Smartphone 1100
East Charlie Black Laptop 1300
East Diana Green Tablet 950
West Evan Yellow Smartphone 1600
West Fiona Blue Laptop 1400

Step 2: Sort Your Data

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 any cell in the Product column.


2. Go to the Data tab on the Ribbon.
3. Click on Sort A to Z or Sort Z to A to sort the data alphabetically.

Step 3: Apply Subtotals

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.

3. Configure the Subtotal Options:


o At each change in: Select the column by which you want to group the data (e.g.,
Product).
o Use function: Choose the function you want to use for the subtotal (e.g., Sum).
o Add subtotal to: Select the column(s) where you want the subtotal to be applied (e.g.,
Sales).

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.

Key Features of Scenario Manager

 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.

When to Use Scenario Manager

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.

How to Use Scenario Manager

1. Open Scenario Manager:


o Go to the Data tab on the Ribbon.
o Click on What-If Analysis and select Scenario Manager.
2. Create a Scenario:
o Click Add in the Scenario Manager dialog box.
o Name your scenario and select the cells that will change for this scenario.
o Enter the new values for the scenario and click OK.

3. View Scenarios:
o In the Scenario Manager dialog, select the scenario you want to view and click
Show.
Scenario Summary

To generate a Scenario Summary:

 Click on Summary in the Scenario Manager.


 Choose Scenario Summary and select Result cells (e.g., B6 for Net Profit).
 Click OK to generate a summary sheet.

A new summary sheet with all scenarios are seen as below:


Example: Budget Planning

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.

Category Base Case


Sales $100,000
Expenses $70,000
Net Profit =B1-B2

Steps:

1. Open Excel and enter the dataset into a spreadsheet.


2. Go to Data > What-If Analysis > Scenario Manager.
3. Click Add to create a new scenario called "High Sales".
o Changing Cells: Select the cell with sales value (e.g., B1).
o New Value: Enter 120,000.
4. Add another scenario called "Low Expenses".
o Changing Cells: Select the cell with expenses value (e.g., B2).
o New Value: Enter 60,000.
5. Select a scenario and click Show to see the impact on Net Profit.

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.

There are other 3 constraints also

a) Fixed costs will remain at 2000


b) Extra costs will not exceed 1000
c) Total cost of each project should note exceed 9600

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

1. Goto ‘Data’ & open ‘Solver’


2. Set the ‘Target cell’ to Total Costs (E14)
3. Choose 'Value of ' and set it to 65000
4. Select the range of cells for 'By changing variable cells' to range of cells for extra cost
(D5:D13) and Production cost (B5:B13).
We cannot choose Total cost as we have 4th constraint that it should not exceed 9600
5. Add the constraints
a) Extra costs range (D5:D13) <= 1000 (E20)
b) Fixed costs range (C5:C13) <= 2000 (E21)
c) Total cost range (E5:E13) <= 9600 (E22)
6. Now click on solve and you get the below solver results.
You can either keep its solution or restore original values.

Multiple sheets updation at once in MS excel


a. Open a new excel workbook & add as many new sheets inside it
b. Using CTRL, select all sheets at once (it forms a group)
c. Go to any sheet and in the formula bar type the data you want to see in A1 cell.
d. Now all sheets will have the same data in A1 cell.
Comparing sheets
When working with Excel, you might find yourself with two versions of a workbook and need to
identify the differences between them.

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

 Visual Comparison: Highlight differences in data, formulas, and formatting.


 Merge Workbooks: Combine changes from multiple files into one.
 Formula Comparison: Spot differences in complex formulas.
 Report Generation: Create detailed reports of differences for documentation.

Password protected file

If xlCompare tool throws an error as below, it means the second file is password protected.

To solve, unprotect the file and reopen it.


Macros
Macros in Excel are like recorded instructions that automate repetitive tasks. Imagine having a
list of steps you frequently do in Excel, such as formatting data, applying formulas, or generating
reports. Instead of doing these tasks manually every time, you can record a macro that does them
automatically for you.

Why Use Macros?

 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.

How Do Macros 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.

Steps to Record a Macro for Inserting a Pie Chart

Step 1: Open the Excel File

1. Open Excel: Open the provided Excel file, which contains salary details for different
positions.

Step 2: Analyze the Data

Before proceeding, let's review the structure of your Excel data.

 Columns: Make sure you have the following columns:


o Position: Details of various position in the department
o Salary: Salary values.

Step 3: Enable the Developer Tab

If you haven't already enabled the Developer tab, do so by:

1. Go to File > Options.


2. Click on Customize Ribbon.
3. Check the Developer option.

Step 4: Record a Macro

1. Select the Developer Tab:


o Go to the Developer tab on the Excel ribbon.
2. Start Recording a Macro:
o Click on Record Macro.
o Name your macro (e.g., InsertPieChart).
o Assign a shortcut key if desired (e.g., Ctrl + Shift + P).
o Choose to store the macro in This Workbook.
o Click OK to start recording.
3. Insert a Pie Chart for a Specific Department:
o Filter the Data for a Department:
 Click on the Data tab.
 Use the Filter feature to select a specific department (e.g., "Finance
department").
o Select the Data:
 Highlight the Position and Salary columns for the filtered department.
o Insert the Pie Chart:
 Go to the Insert tab.
 Click on the Pie Chart button and select the type of pie chart you want
(e.g., 3-D Pie).
 A pie chart will be created showing the salary distribution for the
"Finance" department.
4. Stop Recording the Macro:
o Go back to the Developer tab.
o Click on Stop Recording.

Step 5: Run the Recorded Macro for Other Departments

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.

1. Select the next sheet for HR Department:


o Apply a filter to another department (e.g., "HR department").
2. Run the Macro:
o Go to the Developer tab.
oClick on Macros.
oSelect the recorded macro (e.g., InsertPieChart) and click Run.
oAlternatively, use the assigned shortcut key (Ctrl + Shift + P) to execute the
macro.
3. Repeat for Other Departments:
o Continue applying the filter to different departments and run the macro for
each.

Macro as a Function

Steps to Create a VBA Function for Calculating Discounted Price

Step 1: Open the Excel Workbook

Step 2: Enable the Developer Tab

If the Developer tab is not enabled, you need to enable it:

1. Go to File > Options.


2. Select Customize Ribbon.
3. Check the Developer option on the right panel.
4. Click OK to apply the changes.

Step 3: Open the VBA Editor

1. Access the Developer Tab:


o Click on the Developer tab in the Excel ribbon.
2. Open VBA Editor:
o Click Visual Basic or press ALT + F11 to open the VBA editor.

Step 4: Insert a New Module

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.

Step 5: Write the DiscountedPrice Function

Now, you will write the function that calculates the discounted price.

Function DiscountedPrice(TotalPrice As Double, Discount As Double) As Double


DiscountedPrice = TotalPrice - (TotalPrice * Discount)
End Function
Step 6: Using DiscountedPrice Function in the excel

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

Macro to accept value

Steps to Create a Macro to accept a value

Step 1: Open the Excel Workbook

Step 2: Open the VBA Editor


o Access the Developer Tab:
o Click on the Developer tab in the Excel ribbon.
o Open VBA Editor:
o Click Visual Basic or press ALT + F11 to open the VBA editor.

Step 3: Insert a New Module

o In the VBA editor, go to Insert > Module.


o This creates a new module where you can write your function.

Step 4: Write the Macro below to accept a message and display it

Now, you will write the macro to accept message from user and display it

Sub DisplayMessageBox()
Dim userInput As String

' Prompt the user for input


userInput = InputBox("Enter your message:", "User Input")

' Check if the user pressed Cancel


If userInput = "" Then
MsgBox "No input was entered.", vbExclamation, "No Input"
Else
' Display the user input in a message box
MsgBox "You entered: " & userInput, vbInformation, "Your Message"
End If
End Sub

Step 5: Using DisplayMessageBox macro in the excel

Go back to excel sheet and under Developer tab – click on Macros.

Macro Dialog box opens up as below. Click on Run


It will ask for your input message. Type your message as per your wish.

Output displayed

Macro to sort sheet data by multiple columns


Sub SortMultipleColumns()
Dim ws As Worksheet
Dim rng As Range

' Set the worksheet where your data is located


Set ws = ThisWorkbook.Sheets("Sheet1") ' Change "Sheet1" to your sheet name

' Set the range to sort


Set rng = ws.Range("A1:H245")

' Sort by Region (Column B) and then by Quantity(Column F)


rng.Sort Key1:=ws.Range("B2"), Order1:=xlAscending, _
Key2:=ws.Range("F2"), Order2:=xlAscending, Header:=xlYes

' Notify the user


MsgBox "Data sorted by Region and Quantity!", vbInformation, "Sort Complete"

End Sub

You might also like