Advance Excel - Unit - I
Advance Excel - Unit - I
Advanced Excel
Basics of Excel- Customizing common options- Absolute and relative cells- Protecting and
un-protecting worksheets and cells- Working with Functions - Writing conditional
expressions - logical functions - lookup and reference functions- VlookUP with Exact
Match, Approximate Match- Nested VlookUP with Exact Match- VlookUP with Tables,
Dynamic Ranges- Nested VlookUP with Exact Match- Using VLookUP to consolidate Data
from Multiple Sheets.
MS Excel in brief.
Microsoft Excel is a spreadsheet or a computer application that allows the storage of data in
the form of a table. Excel was developed by Microsoft and can be used on various operating
systems such as Windows, macOS, IOS and Android.
Microsoft Excel is the go-to tool for working with data. There are probably a handful
of people who haven’t used Excel, given its immense popularity. Excel is a widely used
software application in industries today, built to generate reports and business insights. Excel
supports several in-built applications that make it easier to use.
One such feature that allows Excel to stand out is - Excel sheet formulas. Here, we will
look into the top 25 Excel formulas that one must know while working on Excel. The topics
that we will be covering in this article are as follows:
1
Excel Formula
In Microsoft Excel, a formula is an expression that operates on values in a range of
cells. These formulas return a result, even when it is an error. Excel formulas enable you to
perform calculations such as addition, subtraction, multiplication, and division. In addition to
these, you can find out averages and calculate percentages in excel for a range of cells,
manipulate date and time values, and do a lot more.
Formulas in Excel: An Overview
Choose a cell.
Enter the address of a cell in the selected cell or select a cell from the list.
Press Enter.
There is another term that is very familiar to Excel formulas, and that is "function". The two
words, "formulas" and "functions" are sometimes interchangeable. They are closely related,
but yet different. A formula begins with an equal sign. Meanwhile, functions are used to
perform complex calculations that cannot be done manually. Functions in excel have names
that reflect their intended use.
The example below shows how we have used the multiplication formula manually with the
‘*’ operator.
This example below shows how we have used the function - ‘PRODUCT’ to perform
multiplication. As you can see, we didn’t use the mathematical operator here.
2
Fig: Microsoft Excel Function
Excel formulas and functions help you perform your tasks efficiently, and it's time-saving.
Let's proceed and learn the different types of functions available in Excel and use relevant
formulas as and when required.
Let’s now look at the top 25 Excel formulas you must know. In this article, we have
categorized 25 Excel formulas based on their operations. Let’s start with the first Excel
formula on our list.
1. SUM
The SUM() function, as the name suggests, gives the total of the selected range of cell values.
It performs the mathematical operation which is addition. Here’s an example of it below:
Sum "=SUM(C2:C4)"
As you can see above, to find the total amount of sales for every unit, we had to
simply type in the function “=SUM(C2:C4)”. This automatically adds up 300, 385, and 480.
The result is stored in C5.
2. AVERAGE
3
The AVERAGE() function focuses on calculating the average of the selected range of cell
values. As seen from the below example, to find the avg of the total sales, you have to simply
type in:
It automatically calculates the average, and you can store the result in your desired location.
3. COUNT
The function COUNT() counts the total number of cells in a range that contains a
number. It does not include the cell, which is blank, and the ones that hold data in any other
format apart from numeric.
COUNT =COUNT(C1:C4)
4
4. SUBTOTAL
Moving ahead, let’s now understand how the subtotal function works. The
SUBTOTAL() function returns the subtotal in a database. Depending on what you want, you
can select either average, count, sum, min, max, min, and others. Let’s have a look at two
such examples.
In the example above, we have performed the subtotal calculation on cells ranging
from A2 to A4. As you can see, the function used is
SUBTOTAL =SUBTOTAL(1, A2: A4)
In the subtotal list “1” refers to average. Hence, the above function will give the average of
A2: A4 and the answer to it is 11, which is stored in C5. Similarly,
“=SUBTOTAL(4, A2: A4)”
This selects the cell with the maximum value from A2 to A4, which is 12. Incorporating “4”
in the function provides the maximum result.
5. MODULUS
The MOD() function works on returning the remainder when a particular number is divided
by a divisor. Let’s now have a look at the examples below for better understanding.
In the first example, we have divided 10 by 3. The remainder is calculated using the
function
MODULUS =MOD(A2,3)
5
The result is stored in B2. We can also directly type “=MOD(10,3)” as it will give the
same answer.
Similarly, here, we have divided 12 by 4. The remainder is 0 is, which is stored in B3.
6. POWER
The function “Power()” returns the result of a number raised to a certain power. Let’s have a
look at the examples shown below:
As you can see above, to find the power of 10 stored in A2 raised to 3, we have to type:
7. CEILING
Next, we have the ceiling function. The CEILING() function rounds a number up to its
nearest multiple of significance.
6
Fig: Ceiling function in Excel
8. FLOOR
Contrary to the Ceiling function, the floor function rounds a number down to the nearest
multiple of significance.
9. CONCATENATE
This function merges or joins several text strings into one text string. Given below are the
different ways to perform this function.
7
In this example, we have operated with the syntax:
"=CONCATENATE(A27&" "&B27)"
10. LEN
The function LEN() returns the total number of characters in a string. So, it will count
the overall characters, including spaces and special characters. Given below is an example of
the Len function.
Let’s now move onto the next Excel function on our list of this article.
11. REPLACE
As the name suggests, the REPLACE() function works on replacing the part of a text string
with a different text string.
8
REPLACE =REPLACE(A15,1,1,"B")
“=REPLACE(A16,1,1, "A2")”
“=REPLACE(A17,1,2, "Sa")”
12. SUBSTITUTE
The SUBSTITUTE() function replaces the existing text with a new text in a text
string.
The syntax is “=SUBSTITUTE(text, old_text, new_text, [instance_num])”.
Here, [instance_num] refers to the index position of the present texts more than once.
Given below are a few examples of this function:
9
Here, we are substituting “I like” with “He likes” by typing:
Next, we are substituting the second 2010 that occurs in the original text in cell A21 with
2016 by typing “=SUBSTITUTE(A21,2010, 2016,2)”.
That was all about the substitute function, let’s now move on to our next function.
10
In the example below, we use the function left to obtain the leftmost word on the sentence
in cell A5.
The UPPER() function converts any text string to uppercase. In contrast, the LOWER()
function converts any text string to lowercase. The PROPER() function converts any text
string to proper case, i.e., the first letter in each word will be in uppercase, and all the other
will be in lowercase.
11
Fig: Upper function in Excel
Now, we have converted the text in A6 to a full lowercase one, as seen in A7.
Finally, we have converted the improper text in A6 to a clean and proper format in A7.
Now, let us hop on to exploring some date and time functions in Excel.
15. NOW()
The NOW() function in Excel gives the current system date and time.
16. TODAY()
The TODAY() function in Excel provides the current system date.
12
Fig: Today function in Excel
The function DAY() is used to return the day of the month. It will be a number between 1 to
31. 1 is the first day of the month, 31 is the last day of the month.
17. TIME()
The TIME() function converts hours, minutes, seconds given as numbers to an Excel serial
number, formatted with a time format.
The HOUR() function generates the hour from a time value as a number from 0 to 23. Here, 0
means 12 AM and 23 is 11 PM.
13
The function MINUTE(), returns the minute from a time value as a number from 0 to 59.
The SECOND() function returns the second from a time value as a number from 0 to 59.
19. DATEDIF
The DATEDIF() function provides the difference between two dates in terms of years,
months, or days.
Below is an example of a DATEDIF function where we calculate the current age of a person
based on two given dates, the date of birth and today’s date.
20. VLOOKUP
Next up in this article is the VLOOKUP() function. This stands for the vertical lookup
that is responsible for looking for a particular value in the leftmost column of a table. It then
returns a value in the same row from a column you specify.
Below are the arguments for the VLOOKUP function:
lookup_value - This is the value that you have to look for in the first column of a table.
table - This indicates the table from which the value is retrieved.
col_index - The column in the table from the value is to be retrieved.
range_lookup - [optional] TRUE = approximate match (default). FALSE = exact match.
14
We will use the below table to learn how the VLOOKUP function works.
If you wanted to find the department to which Stuart belongs, you could use the VLOOKUP
function as shown below:
Here, A11 cell has the lookup value, A2: E7 is the table array, 3 is the column index number
with information about departments, and 0 is the range lookup.
If you hit enter, it will return “Marketing”, indicating that Stuart is from the marketing
department.
21. HLOOKUP
15
Given the below table, let’s see how you can find the city of Jenson using HLOOKUP.
Here, H23 has the lookup value, i.e., Jenson, G1:M5 is the table array, 4 is the row index
number, 0 is for an approximate match.
Our Data Analyst Master's Program will help you learn analytics tools and techniques to
become a Data Analyst expert! It's the pefect course for you to jumpstart your career. Enroll
now!
22. IF Formula
The IF() function checks a given condition and returns a particular value if it is TRUE. It will
return another value if the condition is FALSE.
In the below example, we want to check if the value in cell A2 is greater than 5. If it’s greater
than 5, the function will return “Yes 4 is greater”, else it will return “No”.
16
In this case, it will return ‘No’ since 4 is not greater than 5.
‘IFERROR’ is another function that is popularly used. This function returns a value if an
expression evaluates to an error, or else it will return the value of the expression.
Suppose you want to divide 10 by 0. This is an invalid expression, as you can’t divide a
number by zero. It will result in an error.
23. INDEX-MATCH
The INDEX-MATCH function is used to return a value in a column to the left. With
VLOOKUP, you're stuck returning an appraisal from a column to the right. Another reason to
use index-match instead of VLOOKUP is that VLOOKUP needs more processing power
from Excel. This is because it needs to evaluate the entire table array which you've selected.
With INDEX-MATCH, Excel only has to consider the lookup column and the return column.
Using the below table, let’s see how you can find the city where Jenson resides.
17
24. COUNTIF
The function COUNTIF() is used to count the total number of cells within a range that meet
the given condition.
Below is a coronavirus sample dataset with information regarding the coronavirus cases and
deaths in each country and region.
Let’s find the number of times Afghanistan is present in the table.
25. SUMIF
The SUMIF() function adds the cells specified by a given condition or criteria.
Below is the coronavirus dataset using which we will find the total number of cases in India
till 3rd Jun 2020. (Our dataset has information from 31st Dec 2020 to 3rd Jun 2020).
18
Fig: Sumif function in Excel
The SUMIFS() function adds the cells specified by a given set of conditions or criteria.
Let’s find the total cases in France on those days when the deaths have been less than 100.
PMT formula should now be entered in the cell that is the Payment cell adjacent.
Currently, there is no value in the rate of interest cell, Excel gives us the payment of
$3,333.33 because it assumes the rate of interest to be 0%. Ignore it.
19
Go to Data > What - If Analysis > Goal Seek
Set the monthly payment to -5,000. The deduction in amount signifies the negative value.
Set rate of interest as the changing cell.
Click OK. You will see the goal seek function automatically gives the interest rate that is
required to pay the loan amount.
20
Your outcome will look like below:
What-If Analysis is the method of changing the values to try out different scenarios
for formulas in Advanced excel.
Several different sets of values can be used in one or multiple of these Advanced excel
formulas to explore the different results.
A solver is ideal for what-if analysis. It is an add-in program in Microsoft Excel and is
helpful on many levels. The feature can be used to identify an optimal value for a formula in
the cell known as the objective cell. Some constraints or limits are however applicable on
other formula cell values on a worksheet.
Solver works with decision variables which are a group of cells used in computing the
formulas in the objective and constraint cells. The solver adjusts the value of decision
21
variable cells to work on the limits on constraint cells. This process aids in determining the
desired result for the objective cell.
22
In the Data tab, in the Analyze group, you can see the Solver option is added.
On the Data tab, in the Analysis group, click the Solver button.
In the set objective, select the income cell and set its value to $8000.
To Change the variable cell, select the C5, C6, and C10 cells.
23
Click Solve.
28. If-Else
IF function is used to test the condition and return a value if the condition is indeed
true and a predetermined different value if it turns out to be false.
If-Else =IF(test, true result, false result)
29. If-Error
24
The Excel IFERROR function returns an alternative result when a formula generates an error
and an expected result when no error is detected.
If-Error =IFERROR (value, value_if_error)
For example, Excel returns a divide by zero error when a formula tries to divide a number by
0.
By using the IFERROR function, you can add a message if the formula evaluates to an error.
This is an Advanced Excel function. MATCH function is designed to return the position of a
value in a specified range, while the INDEX function returns a specific value present in a uni-
dimensional range.
The MATCH function returns the position of the ID you are looking for. The INDEX
function will return the value of the salary corresponding to the position.
In this example we have a monthly sales data of two years. The goal is to find the sum of
sales for a specific month.
The OFFSET function returns a 1x2 range, 8 rows below cell A2, and 1 column right of cell
A2. The SUM function then calculates the sum of this range.
26
1. What are the basic formulas in Excel?
MS Excel formulas and functions are expressions used to perform calculations or manipulate
data in Excel. Formulas start with an equal sign (=) and can contain functions, mathematical
operations, cell references, and constants.
To write a formula in Excel, start with an equal sign (=), followed by the formula expression.
For example, to add two numbers in cells A1 and B1, write "=A1+B1" in another cell.
Entering data.
Formatting cells.
27
5. What is VLOOKUP in Excel?
VLOOKUP is a function in Excel used to search for a value in the first column of a table
range and return a related value from a specified column. It's commonly used for data lookup
and retrieval.
An Excel formula is a mathematical expression that works with values in a specific range of
cells. These formulas yield a result, even if it's an error. They empower you to carry out
addition, subtraction, multiplication, and division calculations within Excel.
3. COUNT: The COUNT formula calculates the quantity of cells that hold numeric values
within a designated range of cells.
4. IF: The IF formula assesses a condition and provides a specific output if the condition is
true, or an alternative output if the condition is false.
5. VLOOKUP: The VLOOKUP formula searches for a value in a table and returns the
corresponding value from another column in the table.
As shown above, the highlighted cell belongs to the column ‘D’ and row 5, so the cell
address is read as D5.
28
What is the shortcut to add a filter to a table?
The filter mechanism is used when you want to display only specific data from the entire
dataset. By doing so, there is no change being made to the data. The shortcut to add a filter to
a table is Ctrl+Shift+L.
To merge text strings present in multiple cells into one cell, you can use
the CONCATENATE(). Shown below is an example of the concatenate function.
Another way of combining cell values is by using the “&” operator, as shown below:
29
What is the use of VLOOKUP and how do we use it?
The function VLOOKUP in Excel is used to look up information in a table and extract the
corresponding data.
Syntax: VLOOKUP (value, table, col_index, [range_lookup])
value - Indicates the data that you are looking for in the first column of a
table.
table - Refers to the set of data (table) from which you have to retrieve the
above value.
col_index - Refers to the column in the table from where you are to
retrieve the value.
range_lookup - FALSE = exact match [optional] TRUE = approximate
match (default).
Shown below is an example of the VLOOKUP function. We are to find the Product related to
the Customer Name – “Richard”.
VLOOKUP LOOKUP
VLOOKUP lets the user look for a value in the left-most Meanwhile, the LOOKUP function
column of a table. It then returns the value in a left-to- enables the user to look for data in a
right way. row/column. It returns the value in
30
another row/column.
It is not very easy to use as compared to the LOOKUP
function. It is easier and can also be used to
replace the VLOOKUP function.
To merge text strings present in multiple cells into one cell, you can use
the CONCATENATE(). Shown below is an example of the concatenate function.
Another way of combining cell values is by using the “&” operator, as shown below:
Let’s now move onto the next question on our Excel interview questions list.
Parentheses
Exponentiation
Division/Multiplication
Addition
Subtraction
As seen above, first, the data in the parentheses is operated, followed by the exponentiation
operation. After that, it can be either the division or multiplication operations. The result is
then added and finally subtracted to give the final result.
Let’s look at an example of the PEMDAS precedence in the next question on our Excel
interview questions list.
Ex: = A1+A2+A3
Ex: = SUM(A1:A3)
In Excel, the IF() function performs a logical test. It returns a value if the test evaluates to
true and another value if the test result is false. It returns the value depending on whether the
condition is valid for the entire selected range.
As seen above, the IF function returns “Record is Valid” if age is greater than 20, and the
salary should be greater than $40000. Else, it will return “Record is Invalid”. Here the final
answer will be “Record is Valid” as the entire selected range qualifies both the conditions.
32
17. How do we use the SUMIF() function in Excel?
The SUMIF() function adds the cell values specified by a given condition or criteria. Given
below is an example of the sumif function.
********************
33