Unit I
Unit I
BASICS OF EXCEL
MS-EXCEL is a part of Microsoft Office suite software. It is an electronic
spreadsheet with numerous rows and columns, used for organizing data, graphically
representing data(s), and performing different calculations. It consists of 1048576
rows and 16384 columns, a row and column together make a cell. Each cell has an
address defined by column name and row number example A1, D2, etc. This is also
known as a cell reference.
What is MS Excel ?
Microsoft Excel is a software application designed for creating tables to input and
organize data. It provides a user-friendly way to analyze and work with data. The
image below provides a visual representation of what an Excel spreadsheet typically
appears like
Excel Interface
What is a Cell
A spreadsheet takes the shape of a table, consisting of rows and columns. A cell is
created at the intersection point where rows and columns meet, forming a
rectangular box. Here’s an image illustrating what a cell looks like:
Absolute reference is the cell reference in which the row and column are made
constant by adding the dollar ($) sign before the column name and row number. The
absolute reference does not change as you copy the formula from one cell to other. If
either the row or the column is made constant then it is known as a mixed reference.
You can also press the F4 key to make any cell reference constant. $A$1, $B$3 are
examples of absolute cell reference.
+
Features of MS Excel
Ribbon
Th eRibbon in MS-Excel is the topmost row of tabs that provide the user with
different facilities/functionalities. These tabs are:
Home Tab
It provides the basic facilities like changing the font, size of text, editing the cells in
the spreadsheet, autosum, etc.
Insert Tab
It provides the facilities like inserting tables, pivot tables, images, clip art, charts,
links, etc.
Page layout
It provides all the facilities related to the spreadsheet-like margins, orientation,
height, width, background etc. The worksheet appearance will be the same in the
hard copy as well.
Formulas
It is a package of different in-built formulas/functions which can be used by user just
by selecting the cell or range of cells for values.
Data
The Data Tab helps to perform different operations on a vast set of data like analysis
through what-if analysis tools and many other data analysis tools, removing
duplicate data, transpose the row and column, etc. It also helps to access data(s)
from different sources as well, such as from Ms-Access, from web, etc.
Review
This tab provides the facility of thesaurus, checking spellings, translating the text,
and helps to protect and share the worksheet and workbook.
View
It contains the commands to manage the view of the workbook, show/hide ruler,
gridlines, etc, freezing panes, and adding macros.
Ms-Excel shortcuts
1. Ctrl+N: To open a new workbook.
2. Ctrl+O: To open a saved workbook.
3. Ctrl+S: To save a workbook.
4. Ctrl+C: To copy the selected cells.
5. Ctrl+V: To paste the copied cells.
6. Ctrl+X: To cut the selected cells.
7. Ctrl+W: To close the workbook.
8. Delete: To remove all the contents from the cell.
9. Ctrl+P: To print the workbook.
10. Ctrl+Z: To undo.
Customizing common options
1 Change the Default Font Type and Size
Sometimes while sharing your spreadsheets you may not want the receiver to change
the content of your worksheet or perhaps change only specific content and leave the
rest untouched. To protect your worksheet from being edited by other people, Excel
offers a protection feature. By following a couple of steps you can set protection to
your work.
Protect an entire workbook from editing: A workbook can be protected by
encrypting the workbook with a password, making the workbook read-only, or
protecting the structure of a workbook.
Encrypt a workbook with a password:
To prevent other people from accessing your Excel files, protect them with a password .
Basic functions
Common functions
Let’s look at some of the most commonly used functions in ms excel
formulas. We will start with statistical functions.
S/N FUNCTION CATEGORY DESCRIPTION USAGE
01 SUM Math & Trig Adds all the values in a range of cells =SUM(E4:E8)
2. A conditional formula returns one value if the condition is True and a different value
if the condition is False.
Examples:
A3>14 Whether the contents of cell A3 are larger than the number 14
D5<=2 Whether the contents of cell D5 are less than or equal to the number 2
T47=”cheese” Whether the cell T47 contains the the word cheese
There are six types of conditional functions covered by this course. Each has a
specific use and syntax.
IF
=if(condition,value_if_true,value_if_false)
If the given condition is true, the cell will be set to the “value_if_true.” If the
condition is false, the cell will be set to the “value_if_false,” if “value_if_false” is left
blank, the cell will be set to “FALSE” by default.
Example:
Reads: If A2>3 is true, then set the cell to 32. Otherwise, set the cell to “Number too
small”
Nested IF Functions
An interesting addition to the “if” function is the ability to nest one “if” function
inside of another. A single “if” function, without the use of any other functions, can
only test for a single condition. A nested if statement can be more specific by testing
another condition.
Example:
Test the condition of whether the contents of cell A2 are between 1 and 3.
The completed function will test whether the value of A2 is larger than 3. If it is, the
active cell will be set to “Number too large.” If A2 is less than 3, it will be tested to
see if the value of A2 is less than 1. If it is, the active cell is set to “Number too
small.” Otherwise, we know that the value of A2 must be between 1 and 3, so the
active cell is set to “Just right!”
COUNTIF
The COUNTIF function in Excel counts the number of cells that meet a condition. The
formula for COUNTIF is =COUNTIF(range, criteria).
How to use COUNTIF
Select a cell
Type =COUNTIF
Select a range of cells
Type a comma
Select the cell that contains the criteria
Press Enter
COUNTIF arguments
Range: The cells to count
Criteria: The condition to test against each cell in the range
COUNTIF limitations
COUNTIF can't handle more than one condition at a time
COUNTIF is not case-sensitive
COUNTIF with logical operators
COUNTIF supports logical operators like >, <, <>, <=, and >=
COUNTIF also supports wildcards like * and ? for partial matchingIf a cell in F1:F230
satisfies “=red”, then increment the active cell by one.
SUMIF
The SUMIF formula in Excel adds up the values in a range of cells that meet certain criteria.
The criteria can be based on numbers, dates, or text.
Formula
=SUMIF(range, criteria, [sum_range])Arguments
Range: The range of cells to apply the criteria to
Criteria: The criteria to determine which cells to add
Sum_range: An optional array of numeric values to add together
Examples
=SUMIF(B2:B5, "John", C2:C5): Sums only the values in the range C2:C5 where the
corresponding cells in the range B2:B5 equal "John"
=SUMIF(B2:B10, "=", C2:D10): Sums sales for undefined regions, where a cell in column B
is blank
=SUMIF(B2:B10, "<>", C2:D10): Sums sales for all the regions, where column B is not
blank
Tips
The SUMIF function supports logical operators such as >, <, <>, and =
The SUMIF function supports wildcards such as *, ?, and ~
If you intend on using your initial cell range as part of your calculation, you'll need to close
the formula with a closing parenthesis logical functions
"Logical functions are used to compare more than one condition or multiple conditions. It
returns the result as TRUE or FALSE by evaluating the arguments."
These functions are used for calculating the result and help to elect any one of the given data.
Based on the requirement, the contents in the cell are evaluated using the respective logical
condition. Here in this tutorial, the types of Logical Functions used are,
o AND
o OR
o NOT
o XOR
AND
The AND function tests single or multiple conditions. It returns the value true if all the values
evaluate to true and return false if any one of the value evaluates to false. This condition
evaluates more than one condition, accepting 255 conditions called arguments. Arguments
include expressions, constants, arrays, and cell references.
Syntax
Arguments
logical 1- The condition or value to be evaluated, which is called the first logical condition
logical 2- The condition or value to be evaluated, which is called the second logical condition
Similarly, the arguments are evaluated in the respective serial wise based on the number of
conditions.
Example
To evaluate the data using certain conditions, the steps to be followed are
OR Function
The OR function returns the result as True if any arguments evaluate to true and return False
if all the arguments evaluate to False. It acts on multiple testing conditions. It is combined
with AND function and IF condition based on the requirement.
Syntax
Parameters
The OR function syntax accepts up to 255 conditions entered as arguments. Arguments such
as expressions, cell references, constant and logical expressions, and arrays are accepted.
NOT Function
NOT is one of the logical functions which return the reversed logical value. An inbuilt
function in Excel is used along with the formula based on the requirement.
Syntax
Parameters
As described before, the NOT function reverses the value of the argument. Therefore, if the
logical value is TRUE, the result will be false, and if the logical value is FALSE, the result
will be TRUE.
To evaluate the data using the NOT condition, the steps to be followed are
Step 2: Here, the data present in A1:A4 are calculated, which greater than 75 is.
Step 3: Select a new cell and enter the formula as = NOT (A1>75). Press Enter.
Step 4: The result will be displayed as either TRUE or FALSE in the selected cell. To get the
result for the remaining cells, drag the formula toward cell A4.
LOOKUP AND REFERENCE FUNCTIONS
Microsoft Excel, VLOOKUP primarily stands for the 'Vertical Lookup', meaning the
function only works vertically for the organized or structured table to be searched for the
desired value as well. It is a built-in Excel function that searches for a specific value in the
desired column to retrieve the respective value from a different column but on the same row.
VLOOKUP Formula
VLOOKUP(lookup_value, Table_array, col_index_num,[range lookup])
Arguments
lookup_value(Required): This is the lookup value that should be
provided by the user and must be in the first column of the selected table.
table_array(Required): This is the table where the lookup_value and our
desired output both exist(Not necessarily the output exits all the time. In
that case, it returns N/A error.). VLOOKUP() function uses
this table_array argument to find the result.
col_index_num(Required): This is the column number of
the table_array where VLOOKUP() will search for its output. If it gets the
result, it then returns the specific value.
[range_lookup](optional): This argument is completely optional. The user
may or may not provide this according to his or her needs. This argument
value may be True or False. If this is ‘True’, it means an approximate
match and if it’s ‘False’, it searches for an exact match. If nothing is
specified by the user, by default this value is set to be ‘True’ and it
searches for an approximate match.
Microsoft Excel whether we want to lookup for the exact match or an approximate match.
And for this, we just need to enter TRUE (or 1) for an approximate match and FALSE (or 0)
for the exact match.
VLOOKUP makes it effortless to look for an exact match from the table. Let’s take a look at
how to do this with the help of an example:
In the example below, we are using the VLOOKUP function to find the value of
the exact match of ID from the given table. So, we set the first parameter as the
lookup value, which is the cell H5.
We specify the location of the table in the second argument. As you can see, the
table location is A2:F11.
The third argument specifies the Column Index number. This tells us what value
should be returned from the row that we are looking up for. In the example, the
product column is 3.
The last argument is a Boolean Expression. Here, the value is set to FALSE for the
VLOOKUP function to return an exact match for the value. An N/A error is
displayed in case the exact value is not found.
In the example below, we use the VLOOKUP function to find out how much
RAM specification a laptop priced 1300 EUR has. Also, we know this value
is not present in the table. So, let's use the Approximate Match to find the
solution. We need to sort the first column in ascending order. If not,
VLOOKUP will return incorrect values.
First, copy the price and RAM details to a new location, and
specify your lookup value. Here, the lookup value is $1300.
Next, select your data range and click on the filter option to sort the
values of the first column based on ascending order. After you click on the
filter option, you will see the filter buttons enabled on your column
headers.
Consider the following dataset. In the Result Table, we want to get the Price based on the
product ID. But both of them are not together in any single table. ID is in Table 1 and Price is
in Table 2. So what we are going to do here is, we will search for the ID in Table 1, and based
on the match value, we will extract the Price from Table 2 and show the result in the Price
column in the Result Table.
Click on the cell that you want the Price of the ID (e.g. cell beside ID A101 in the
Result Table, I5)
Write the following formula,
=VLOOKUP(VLOOKUP(H5, $B$5:$C$9, 2, FALSE), $E$5:$F$9, 2, FALSE)
Here,
H5 = A101, the ID that we stored in the Result Table as the lookup value
$B$5:$C$9 = Data range in Table 1 to search the lookup value
$E$5:$F$9 = Data range in Table 2 to search the lookup value
2= Column index number to search the lookup value
FALSE = As we want an exact match, so we put the argument as FALSE.
Please pay attention that we lock the range with absolute cell
references to prevent it from changing when copying the formula to
other cells.
Col_index_num is 2 because we want to copy a value from column
B, which is the 2nd column in the table array.
Drag the formula down the column and you will get this result: