MS Excel Module
MS Excel Module
MS Excel Module
Hundreds of millions
of people around the world use Microsoft Excel. You can use Excel to enter all sorts of data and perform
financial, mathematical or statistical calculations.
1 Range: A range in Excel is a collection of two or more cells. This chapter gives an overview of some very
important range operations.
2 Formulas and Functions: A formula is an expression which calculates the value of a cell. Functions are
predefined formulas and are already available in Excel.
BASICS
1 Ribbon: Excel selects the ribbon's Home tab when you open it. Learn how to use the ribbon.
2 Workbook: A workbook is another word for your Excel file. When you start Excel, click Blank workbook to
create an Excel workbook from scratch.
3 Worksheets: A worksheet is a collection of cells where you keep and manipulate the data. Each Excel
workbook can contain multiple worksheets.
4 Format Cells: When we format cells in Excel, we change the appearance of a number without changing the
number itself.
5 Find & Select: Learn how to use Excel's Find, Replace and Go To Special feature.
6 Templates: Instead of creating an Excel workbook from scratch, you can create a workbook based on a
template. There are many free templates available, waiting to be used.
7 Data Validation: Use data validation in Excel to make sure that users enter certain values into a cell.
8 Keyboard Shortcuts: Keyboard shortcuts allow you to do things with your keyboard instead of your mouse
to increase your speed.
9 Print: This chapter teaches you how to print a worksheet and how to change some important print settings
in Excel.
10 Share: Learn how to share Excel data with Word documents and other files.
11 Protect: Encrypt an Excel file with a password so that it requires a password to open it.
FUNCTIONS
Discover how functions in Excel help you save time. If you are new to functions in Excel, we recommend you
to read our introduction to Formulas and Functions first.
1 Count and Sum: The most used functions in Excel are the functions that count and sum. You can count
and sum based on one criteria or multiple criteria.
2 Logical: Learn how to use Excel's logical functions, such as IF, AND, OR and NOT.
3 Cell References: Cell references in Excel are very important. Understand the difference between relative,
absolute and mixed reference, and you are on your way to success.
4 Date & Time: To enter a date in Excel, use the "/" or "-" characters. To enter a time, use the ":" (colon). You
can also enter a date and a time in one cell.
5 Text: Excel has many functions to offer when it comes to manipulating text strings.
6 Lookup & Reference: Learn all about Excel's lookup & reference functions, such as VLOOKUP, HLOOKUP,
MATCH, INDEX and CHOOSE.
7 Financial: This chapter illustrates Excel's most popular financial functions.
8 Statistical: An overview of some very useful statistical functions in Excel.
9 Round: This chapter illustrates three functions to round numbers in Excel. ROUND, ROUNDUP and
ROUNDDOWN.
10 Formula Errors: This chapter teaches you how to deal with some common formula errors in Excel.
11 Array Formulas: This chapter helps you understand array formulas in Excel. Single cell array formulas
perform multiple calculations in one cell.
DATA ANALYSIS
1 Sort: You can sort your Excel data on one column or multiple columns. You can sort in ascending or
descending order.
2 Filter: Filter your Excel data if you only want to display records that meet certain criteria.
3 Conditional Formatting: Conditional formatting in Excel enables you to highlight cells with a certain color,
depending on the cell's value.
4 Charts: A simple Excel chart can say more than a sheet full of numbers. As you'll see, creating charts is
very easy.
5 Pivot Tables: Pivot tables are one of Excel's most powerful features. A pivot table allows you to extract the
significance from a large, detailed data set.
6 Tables: Master Excel tables and analyze your data quickly and easily.
7 What-If Analysis: What-If Analysis in Excel allows you to try out different values (scenarios) for formulas.
8 Solver: Excel includes a tool called solver that uses techniques from the operations research to find optimal
solutions for all kind of decision problems.
9 Analysis ToolPak: The Analysis ToolPak is an Excel add-in program that provides data analysis tools for
financial, statistical and engineering data analysis.
VBA
Excel VBA (Visual Basic for Applications) is the name of the programming language of Excel.
1 Create a Macro: With Excel VBA you can automate tasks in Excel by writing so called macros. In this
chapter, learn how to create a simple macro.
2 MsgBox: The MsgBox is a dialog box in Excel VBA you can use to inform the users of your program.
3 Workbook and Worksheet Object: Learn more about the Workbook and Worksheet object in Excel VBA.
4 Range Object: The Range object, which is the representation of a cell (or cells) on your worksheet, is the
most important object of Excel VBA.
5 Variables: This chapter teaches you how to declare, initialize and display a variable in Excel VBA.
6 If Then Statement: Use the If Then statement in Excel VBA to execute code lines if a specific condition is
met.
7 Loop: Looping is one of the most powerful programming techniques. A loop in Excel VBA enables you to
loop through a range of cells with just a few codes lines.
8 Macro Errors: This chapter teaches you how to deal with macro errors in Excel.
9 String Manipulation: In this chapter, you'll find the most important functions to manipulate strings in
Excel VBA.
10 Date and Time: Learn how to work with dates and times in Excel VBA.
11 Events: Events are actions performed by users which trigger Excel VBA to execute code.
12 Array: An array is a group of variables. In Excel VBA, you can refer to a specific variable (element) of an
array by using the array name and the index number.
13 Function and Sub: In Excel VBA, a function can return a value while a sub cannot.
14 Application Object: The mother of all objects is Excel itself. We call it the Application object. The
application object gives access to a lot of Excel related options.
15 ActiveX Controls: Learn how to create ActiveX controls such as command buttons, text boxes, list boxes
etc.
16 Userform: This chapter teaches you how to create an Excel VBA Userform.
RANGE
Cell, Row, Column | Range Examples | Fill a Range | Move a Range | Copy/Paste a Range | Insert Row,
Column
A range in Excel is a collection of two or more cells. This chapter gives an overview of some very important
range operations.
Cell, Row, Column
Let's start by selecting a cell, row and column.
1. To select cell C3, click on the box at the intersection of column C and row 3.
Range Examples
A range is a collection of two or more cells.
1. To select the range B2:C4, click on cell B2 and drag it to cell C4.
2. To select a range of individual cells, hold down CTRL and click on each cell that you want to include in the
range.
Fill a Range
To fill a range, execute the following steps.
1a. Enter the value 2 into cell B2.
1b. Select cell B2, click on the lower right corner of cell B2 and drag it down to cell B8.
Result:
This dragging technique is very important and you will use it very often in Excel. Here's another example.
2a. Enter the value 2 into cell B2 and the value 4 into cell B3.
2b. Select cell B2 and cell B3, click on the lower right corner of this range and drag it down.
Excel automatically fills the range based on the pattern of the first two values. That's pretty cool huh!? Here's
another example.
3a. Enter the date 6/13/2030 into cell B2 and the date 6/16/2030 into cell B3.
3b. Select cell B2 and cell B3, click on the lower right corner of this range and drag it down.
Note: visit our page about AutoFill for many more examples.
Move a Range
To move a range, execute the following steps.
1. Select a range and click on the border of the range.
2. Drag the range to its new location.
Copy/Paste a Range
To copy and paste a range, execute the following steps.
1. Select the range, right click, and then click Copy (or press CTRL + c).
2. Select the cell where you want the first cell of the range to appear, right click, and then click Paste under
'Paste Options:' (or press CTRL + v).
The rows below the new row are shifted down. In a similar way, you can insert a column.
Cell A3 below contains the SUM function which calculates the sum of the range A1:A2.
Enter a Formula
To enter a formula, execute the following steps.
1. Select a cell.
2. To let Excel know that you want to enter a formula, type an equal sign (=).
3. For example, type the formula A1+A2.
Tip: instead of typing A1 and A2, simply select cell A1 and cell A2.
4. Change the value of cell A1 to 3.
Excel automatically recalculates the value of cell A3. This is one of Excel's most powerful features!
Edit a Formula
When you select a cell, Excel shows the value or formula of the cell in the formula bar.
1. To edit a formula, click in the formula bar and change the formula.
2. Press Enter.
Operator Precedence
Excel uses a default order in which calculations occur. If a part of the formula is in parentheses, that part will
be calculated first. It then performs multiplication or division calculations. Once this is complete, Excel will
add and subtract the remainder of your formula. See the example below.
First, Excel performs multiplication (A1 * A2). Next, Excel adds the value of cell A3 to this result.
Another example,
First, Excel calculates the part in parentheses (A2+A3). Next, it multiplies this result by the value of cell A1.
Copy/Paste a Formula
When you copy a formula, Excel automatically adjusts the cell references for each new cell the formula is
copied to. To understand this, execute the following steps.
1. Enter the formula shown below into cell A4.
2a. Select cell A4, right click, and then click Copy (or press CTRL + c)...
...next, select cell B4, right click, and then click Paste under 'Paste Options:' (or press CTRL + v).
2b. You can also drag the formula to cell B4. Select cell A4, click on the lower right corner of cell A4 and drag
it across to cell B4. This is much easier and gives the exact same result!
Result. The formula in cell B4 references the values in column B.
Insert Function
Every function has the same structure. For example, SUM(A1:A4). The name of this function is SUM. The part
between the brackets (arguments) means we give Excel the range A1:A4 as input. This function adds the
values in cells A1, A2, A3 and A4. It's not easy to remember which function and which arguments to use for
each task. Fortunately, the Insert Function feature in Excel helps you with this.
To insert a function, execute the following steps.
1. Select a cell.
2. Click the Insert Function button.
4. Click OK.
The 'Function Arguments' dialog box appears.
5. Click in the Range box and select the range A1:C2.
6. Click in the Criteria box and type >5.
7. Click OK.
Result. The COUNTIF function counts the number of cells that are greater than 5.
Note: instead of using the Insert Function feature, simply type =COUNTIF(A1:C2,">5"). When you arrive at:
=COUNTIF( instead of typing A1:C2, simply select the range A1:C2.
RIBBON
Tabs | Groups | Use the Ribbon | Collapse the Ribbon
Excel selects the ribbon's Home tab when you open it. Learn how to use the ribbon.
Tabs
The tabs on the ribbon are: File, Home, Insert, Page layout, Formulas, Data, Review, View and Help. The
Home tab contains the most frequently used commands in Excel.
Groups
Each tab contains groups of related commands. For example, the Page Layout tab contains the Themes
group, the Page Setup group, etc.
Use the Ribbon
Let's use the ribbon to create a table. Tables allow you to analyze your data in Excel quickly and easily.
1. Open data-set.xlsx.
2. Click any single cell inside the data set.
3. On the Insert tab, in the Tables group, click Table.
Result.
WORKBOOK
Open an Existing Workbook | Close a Workbook | Create a New Workbook | Turn off the Start screen
A workbook is another word for your Excel file. When you start Excel, click Blank workbook to create an
Excel workbook from scratch.
Close a Workbook
To close a workbook (and Excel), click the upper right X. If you have multiple workbooks open, clicking the
upper right X closes the active workbook.
WORKSHEETS
Select a Worksheet | Insert a Worksheet | Rename a Worksheet | Move a Worksheet | Delete a
Worksheet | Copy a Worksheet | SHEETS function
A worksheet is a collection of cells where you keep and manipulate the data. Each Excel workbook can
contain multiple worksheets.
Select a Worksheet
When you open an Excel workbook, Excel automatically selects Sheet1 for you. The name of the worksheet
appears on its sheet tab at the bottom of the document window.
Insert a Worksheet
You can insert as many worksheets as you want. To quickly insert a new sheet, click the plus sign at the
bottom of the document window.
Result:
Rename a Worksheet
To give a worksheet a more specific name, execute the following steps.
1. Right click on the sheet tab of Sheet1.
2. Choose Rename.
Result:
Delete a Worksheet
To delete a worksheet, right click on a sheet tab and choose Delete.
1. For example, delete Sheet2.
Result:
Copy a Worksheet
Imagine, you have got the sales for 2024 ready and want to create the exact same sheet for 2025, but with
different data. You can recreate the worksheet, but this is time-consuming. It's a lot easier to copy the entire
worksheet and only change the numbers.
1. Right click on the sheet tab of Sales 2024.
2. Choose Move or Copy.
The 'Move or Copy' dialog box appears.
3. Select (move to end) and check Create a copy.
4. Click OK.
Result:
Note: you can even copy a worksheet to another Excel workbook by selecting the specific workbook from the
drop-down list (see the dialog box shown earlier).
SHEETS function
To count the total number of worksheets in a workbook, use the SHEETS function in Excel (without any
argument).
1. For example, select cell A1.
2. Type =SHEETS() and press Enter.
FORMAT CELLS
When we format cells in Excel, we change the appearance of a number without changing the number itself.
We can apply a number format (0.8, $0.80, 80%, etc) or other formatting (alignment, font, border, etc).
1. Enter the value 0.8 into cell B2.
By default, Excel uses the General format (no specific number format) for numbers. To apply a number
format, use the 'Format Cells' dialog box.
2. Select cell B2.
3. Right click, and then click Format Cells (or press CTRL + 1).
The 'Format Cells' dialog box appears.
4. For example, select Currency.
Note: Excel gives you a live preview of how the number will be formatted (under Sample).
5. Click OK.
Cell B2 still contains the number 0.8. We only changed the appearance of this number. The most frequently
used formatting commands are available on the Home tab.
6. On the Home tab, click the percentage symbol to apply a Percentage format.
8. On the Home tab, in the Font group, add outside borders and change the font color to blue.
Result:
You can use Excel's Find and Replace feature to quickly find specific text and replace it with other text. You
can use Excel's Go To Special feature to quickly select all cells with formulas, notes, conditional formatting,
constants, data validation, etc.
Find
To quickly find specific text, execute the following steps.
1. On the Home tab, in the Editing group, click Find & Select.
2. Click Find.
The 'Find and Replace' dialog box appears.
3. Type the text you want to find. For example, type Ferrari.
4. Click 'Find Next'.
Replace
To quickly find specific text and replace it with other text, execute the following steps.
1. On the Home tab, in the Editing group, click Find & Select.
2. Click Replace.
The 'Find and Replace' dialog box appears (with the Replace tab selected).
3. Type the text you want to find (Veneno) and replace it with (Diablo).
4. Click 'Find Next'.
Excel selects the first occurrence. No replacement has been made yet.
Go To Special
You can use Excel's Go To Special feature to quickly select all cells with formulas, notes, conditional
formatting, constants, data validation, etc. For example, to select all cells with formulas, execute the following
steps.
1. Select a single cell.
2. On the Home tab, in the Editing group, click Find & Select.
3. Click Go To Special.
Note: Formulas, Notes, Conditional formatting, Constants and Data Validation are shortcuts. They can also be
found under Go To Special.
4. Select Formulas and click OK.
TEMPLATES
Existing Templates | Create a Template
Instead of creating an Excel workbook from scratch, you can create a workbook based on a template. There
are many free templates available, waiting to be used.
Existing Templates
To create a workbook based on an existing template, execute the following steps.
1. On the File tab, click New.
2. Use the search box to search for online templates or click a template from one of the Office templates.
Note: you can search for cells with formulas that return Numbers, Text, Logicals (TRUE and FALSE) and
Errors. These check boxes are also available if you select Constants.
Excel selects all cells with formulas.
General note: if you select a single cell before you click Find, Replace or Go To Special, Excel searches the
entire worksheet. To search a range of cells, first select a range of cells.
DATA VALIDATION
Data Validation Example | Create a Data Validation Rule | Input Message | Error Alert | Data Validation
Result
Use data validation in Excel to make sure that users enter certain values into a cell.
Data Validation Example
In this example, we restrict users to enter a whole number between 0 and 10.
Error Alert
If users ignore the input message and enter a number that is not valid, you can show them an error alert.
On the Error Alert tab:
1. Check 'Show error alert after invalid data is entered'.
2. Enter a title.
3. Enter an error message.
4. Click OK.
Note: to remove data validation from a cell, select the cell, on the Data tab, in the Data Tools group, click Data
Validation, and then click Clear All. You can use Excel's Go To Special feature to quickly select all cells with
data validation.
KEYBOARD SHORTCUTS
Basic | Moving | Selecting | Formulas | Formatting | Workbook
Keyboard shortcuts allow you to do things with your keyboard instead of your mouse to increase your speed.
Basic
Select cell B2.
1. To select the entire range, press CTRL + a (if you press CTRL + a one more time Excel selects the entire
sheet).
2. To copy the range, press CTRL + c (to cut a range, press CTRL + x).
3. Select cell A6 and press CTRL + v to paste this range.
Moving
Select cell B2.
1. To quickly move to the bottom of the range, hold down CTRL and press ↓
2. To quickly move to the right of the range, hold down CTRL and press →
Try it yourself. Hold down CTRL and press the arrow keys to move from edge to edge.
Selecting
Select cell A1.
1. To select cells while moving down, hold down SHIFT and press ↓ a few times.
2. To select cells while moving to the right, hold down SHIFT and press → a few times.
Formulas
Select cell F2.
1. To quickly insert the SUM function, press ATL + =, and press Enter.
2. Select cell F2, hold down SHIFT and press ↓ two times.
Note: in a similar way, you can fill a formula right by pressing CTRL + r (right).
Formatting
Select the range B2:F4.
Workbook
Open a workbook. A workbook is another word for your Excel file.
1. To save an existing workbook, press CTRL + s (F12 opens the Save As dialog box).
2. To create a new workbook, press CTRL + n
3. To open an existing workbook, press CTRL + o
4. To close the active workbook, press CTRL + w
5. To close Excel (and many other applications), press ALT + F4
The workbook below has 3 worksheets. Click Sheet2 to make it the active sheet.
6. To quickly move to the next worksheet (Sheet3), press CTRL + Page Down.
7. To quickly move to the previous worksheet (Sheet1), press CTRL + Page Up.
PRINT
Print a Worksheet | What to Print | Multiple Copies | Orientation | Page Margins | Scaling
This chapter teaches you how to print a worksheet and how to change some important print settings in Excel.
Print a Worksheet
To print a worksheet in Excel, execute the following steps.
1. On the File tab, click Print.
2. To preview the other pages that will be printed, click 'Next Page' or 'Previous Page' at the bottom of the
window.
3. To print the worksheet, click the big Print button.
What to Print
Instead of printing the entire worksheet, you can also print the current selection.
1. First, select the range of cells you want to print.
2. Next, under Settings, select Print Selection.
3. To print the selection, click the big Print button.
Note: you can also print the active sheets (first select the sheets by holding down CTRL and clicking the sheet
tabs) or print the entire workbook. Use the boxes next to Pages (see first screenshot) to only print a few pages
of your document. For example, 2 to 2 only prints the second page.
Multiple Copies
To print multiple copies, execute the following steps.
1. Use the arrows next to the Copies box.
2. If one copy contains multiple pages, you can switch between Collated and Uncollated. For example, if you
print 6 copies, Collated prints the entire first copy, then the entire second copy, etc. Uncollated prints 6
copies of page 1, 6 copies of page 2, etc.
Orientation
You can switch between Portrait Orientation (more rows but fewer columns) and Landscape Orientation (more
columns but fewer rows).
Page Margins
To adjust the page margins, execute the following steps.
1. Select one of the predefined margins (Normal, Wide or Narrow) from the Margins drop-down list.
2. Or click the 'Show Margins' icon at the bottom right of the window. Now you can drag the lines to manually
change the page margins.
Scaling
If you want to fit more data on one page, you can fit the sheet on one page. To achieve this, execute the
following steps.
1. Select 'Fit Sheet on One Page' from the Scaling drop-down list.
Note: you can also shrink the printout to one page wide or one page high. Click Custom Scaling Options to
manually enter a scaling percentage or to fit the printout to a specific number of pages wide and tall. Be
careful, Excel doesn't warn you when your printout becomes unreadable.
SHARE
Paste | Paste Link
Learn how to share Excel data with Word documents and other files.
Paste
Most of the time, you'll simply need to paste static Excel data in a Word document.
1. Select the Excel data.
2. Right click, and then click Copy (or press CTRL + c).
3. Open a Word document.
4. Press CTRL + v.
5. Click the icon in the upper left corner of the table and add borders.
Result.
Note: To delete the table, right click the icon in the upper left corner, and then click Delete Table.
Paste Link
You can also link the source data in Excel with the destination data in Word. If you change the data in Excel,
the data in Word is updated automatically.
1. Repeat steps 1 to 3 above.
2. In Word, on the Home tab, in the Clipboard group, click Paste.
Result.
Note: In Word, right click the icon in the upper left corner of the table, and then click Linked Worksheet
Object, Links to launch the Links dialog box. Here, you can break the link, change the location of the Excel
file, etc.