Excel Functions and Formulas
Contents
Introduction
Who is this Book Aimed For?
Who is this book NOT for?
Chapter 1: Basic Excel Formulas and Functions
Formulas VS Functions
Entering and Editing Formulas
Elements of a formula
The Function Wizard
Inputting a formula
Formula limits
Formula editing
Operators in Formulas
Copying or Moving Formulas
Chapter 2: Get to Know Worksheet Functions
Arguments in Functions
How to Enter a Function in a Formula
Manual Input
Function Library
Insert Function dialog box
Chapter 3: Text Functions
How to input numbers as text
Text Functions
To know if a cell contains text
To know if two strings are identical
To join two or more cells
To display formatted values as text
To remove excess spaces and nonprinting characters
Changing the case of text
To replace text with another text
To find and search text within a string
Chapter 4: Date and Time Functions
Dates and Times in Excel
To Enter dates in Excel
How to Format Date and Time
Date Functions
Excel DATE Function
The Secret Excel DATEDIF Function
Generating a series of dates
How to calculate the number of days between two dates
How to calculate the number of work days between two dates
How to calculate a person’s age
How to create a (drop-down and printable) calendar in Excel
In Excel, how do you insert a calendar? (Date Picker control)
How to Register Calendar control on your Computer
How to make a calendar in Excel based on a template
Time Functions
How to display the current time
Chapter 5: Number Functions
Count Functions
The COUNT Function
The COUNTA Function
The COUNTBLANK Function
The COUNTIF Function
Functions for Sum
The SUM function
How to sum all cells in a range
Running Totals
Sum cells that match criteria
Percentage Formulas
Excel's basic percentage formula
How to Calculate in Excel the percentage of the total
How to Calculate Percentage Changes in Excel
Chapter 6: Lookup Functions
Basic Excel Functions for Searching
The VLOOKUP function
The HLOOKUP function
The LOOKUP function
Chapter 7: Statistic Functions
AVERAGE Function
LARGE Function
MAX function
MEDIAN Function
Chapter 8: Other Popular Functions (According to Microsoft)
IF function
Using the And/Or Criteria
INDEX function
The Array Format of the INDEX Function
Reference form of INDEX
IS Functions
ISBLANK Function
ISERROR function
ISNUMBER Function
ISTEXT Function
Chapter 9: EXCEL'S TOP 10 TRICKS
Contextual formatting
Pivot Tables
Distinctive Paste
How to Add several lines
Bibliography in total
Printing optimization
Formula Extend Across/Down
Flash Filling
INDEX-MATCH
Filters
Chapter 9: How to Develop Custom Functions
Macro
How to activate the Developer tab
Record a macro
How to Store macros in your Personal Macro Workbook
How to run VBA macros in Excel
INTRODUCTION
Microsoft Excel is a tabular app that helps store, modify, and manipulate data in
a collection of table-like structures called a workbook. Users can input charts
and graphs into their worksheets to illustrate their entered data in various ways.
A wоrkbооk employs a cоllеctiоn оf wоrkshееts to organize data into rows and
columns divided into cеlls. Users can еntеr dаtа оr numbеrs into thеsе cеlls tо
crеаtе еаsy wаys tо calculаtе simplе оr cоmplеx fоrmulаs.
Knowing how to use Microsoft Excel's built-in functions will turn you into a
power user! There are hundreds of functions, and the list can be overwhelming at
first.
Even as a Microsoft Office Expert in Excel 2013, I am not familiar with all of
the available Excel functions. While writing this eBook, I discovered several
new functions that I have now incorporated into my daily use and have improved
the efficiency of my data analysis. I hope that this eBook will help you learn
more about Excel functions and gain control over your spreadsheets.
There's no denying that formulas are Excel's engines. Formulas allow Excel
specialists to create consolidated reporting, complicated calculation engine
components, clever dashboard concepts, and more by utilizing various Excel
functions. Indeed, as their knowledge of Excel functions and formulas grows,
Excel experts become more productive.
However, mastering Excel functions and formulas takes time. Given that Excel
has over 400 functions, you could spend months, if not years, learning which
functions are best for specific tasks and can be combined with others.
This is where this book enters the picture. This book will discuss the world of
Excel formulas by walking you through the various built-in functions that Excel
offers. Each chapter builds on the previous one, progressing you from basic math
functions to creating your own custom functions.
As you'll see, utilizing Excel functions will increase your productivity. It will
also allow you to complete tasks that you didn't realize could be handled with
Excel formulas.
Who is this Book Aimed For?
This book is intended for those who want to discover the true power of Excel
formulas. Read this book if:
you already learn how to design formulas but want to learn how to create more
advanced formulas,
are familiar with some Excel functions, but like to learn more advanced
functions,
you want to move your Excel skills from beginner to intermediate to advanced
or expert,
you have learned of array formulas but have no idea what they are or how
powerful they are,
you want a reference to formulas and functions in Microsoft Excel.
Who is this book NOT for?
This book is not intended for those just learning how to use Excel for the first
time. Unless you're one of the rare breeds who can instantly know a new
software product, this isn't the book for you.
To get the most out of this book, you should be familiar with Excel. We assume
you know how to create workbooks, insert sheets, save files, and perform other
essential tasks.
Navigate through a workbook.
Use the Excel Ribbon and dialog boxes to your advantage.
Utilize fundamental Windows capabilities such as file systems and copy-and-
paste.
CHAPTER 1: BASIC EXCEL FORMULAS AND
FUNCTIONS
This chapter will go over some of the most valuable Excel functions and show
you how to use them. This is not an exhaustive list of Excel functions but rather
a selection of the most popular functions that many Excel experts use regularly
and have not yet been covered in the following chapters.
This chapter discusses how to use formulas in Excel. Although it is primarily
aimed at newbies to Excel, seasoned users may also find this information useful.
Formulas VS Functions
You're probably familiar with the Excel terms Formulas and Functions. What is
the distinction between them?
A formula is a math statement that is used to determine the value of a cell. A
Function is a predefined formula that Excel makes available for use.
Entering and Editing Formulas
This section describes the fundamental components of a formula. Additionally, it
demonstrates how to enter and edit your formulas in a variety of ways.
Elements of a formula
A formula entered into a cell can have five components:
Operators: These include the + (for addition) and * (for subtraction) symbols
(for multiplication).
Cell references are named cells and ranges that point to cells in the current
worksheet, another worksheet in the same workbook, or cells in a different
workbook.
7.5 (a numerical value) and "Year-End Results" (a quoted string) are two
examples of text strings.
Functions of the spreadsheet and their arguments: These include the SUM and
AVERAGE functions, as well as their associated arguments. Parentheses-
separated function arguments serve as input for the function's calculations.
Parenthesis: These indicate the order in which a formula's expressions are
evaluated.
The Function Wizard
If you're unsure which formula to use in your Spreadsheet, this Insert Function
can assist you. This feature will help you find a formula for your needs.
Before clicking the Insert Function button, denoted by the symbol fx, ensure that
a cell is selected. Then, within this window above, you can try searching for the
function.
Input the arguments required by your selected function. Click OK.
Inputting a formula
When you type an equal sign into an empty cell, Excel assumes you're entering a
formula, as a formula must always begin with an equal sign. Excel, on the other
hand, always inserts the equal leading sign after the formula is entered.
Additionally, due to Excel's flexibility, you can begin your formula with a minus
or a plus sign.
Entering a formula manually entails, well, entering a formula manually. Simply
select a cell and type the formula, followed by an equal sign (=). As you type,
the characters appear in both the cell and the Formula bar. Naturally, you can use
all of the standard editing keys when typing a formula.
After you've entered the formula, hit Enter.
Formula limits
A formula can contain up to 8,000 characters. If you require a formula that
exceeds this limit, you must divide it into multiple formulas. Additionally, you
can create a custom function using Visual Basic for Applications (VBA).
Formula editing
If you make changes to your worksheet, you may need to edit formulas.
Alternatively, consider the case where a formula returns one of the error values
discussed later in this chapter. In that case, you may need to modify the formula
to make the correction. Naturally, you can edit your formulas just like any other
cell.
Several methods are available for entering cell editing mode:
Double-click the cell to select it. This enables you to edit the contents of the cell
directly within the cell. This technique is only applicable if the Advanced tab of
the Excel Options dialog box's Double-click Allow Editing Directly in Cells
check box is selected.
F2 is pressed. This enables you to edit the contents of the cell directly within the
cell. Without selecting the Allow Editing Directly in Cells check box, editing
occurs in the Formula bar.
To edit a formula cell, first select it and then click in the Formula bar. This
enables you to modify the contents of the Formula bar's cells.
Multiple characters can be selected while editing a formula by dragging the
mouse over them or by using the arrow keys while holding Shift down.
Additionally, you can use the Home or End keys to navigate to the start or end of
the current line of the formula.
Operators in Formulas
An operator is a fundamental component of a formula. An operator is a symbol
for an operation. The following are the operators in Excel Formulas:
Symbol Operation
+ Addition
- Subtraction
/ Division
* Multiplication
& Text joiner/ connection
^ Raising one quantity to the power of
another.
= Equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
<> Not equal to
Reference operators
: A range of all the cells between two
references.
, To merge multiple cell or range references
into one reference.
(Single To give one reference to cells common to
space) two references.
You may have noticed that the worksheet's formulas are instantly calculated. If
you modify any of the formula's cells, the formula automatically generates a new
result.
This occurs when Excel's Calculation mode is set to Automatic. Excel follows
the following rules when calculating your worksheet in this mode (the default
mode):
When you make a change (for example, when you enter or edit data or
formulas), Excel automatically calculates any formulas that are dependent on the
new or edited data. When you are working on a lengthy calculation, Excel
suspends it temporarily to allow you to perform other worksheet tasks; it
resumes when you are finished. Formulas are evaluated in the order in which
they appear. For instance, if the result of a formula in cell D12 is dependent on
the result of a formula in cell F12, cell F12 is calculated first.
However, there are times when you may wish to exercise some control over how
Excel calculates formulas. For instance, if you create a worksheet that contains
thousands of complex formulas, you may notice that performance slows to a
crawl while Excel works its magic. In this case, you can switch Excel's
Calculation mode to Manual. To accomplish this, select Formulas Calculation
Calculation Options Manual.
When working in manual Calculation mode, if any formulas remain
uncalculated, Excel displays Calculate in the status bar.
Calculate Now and Calculate Sheet are two controls located in the Formulas
Calculation group that perform calculations when clicked. Additionally to these
controls, you can recalculate the formulas by clicking the Calculate word in the
status bar or by using the shortcut keys listed below:
F9: Calculates formulas in all open workbooks (same as the Calculate Now
control).
Only the formulas in the active worksheet are calculated when Shift+F9 is
pressed. Additional worksheets contained within the same workbook are not
calculated (same as the Calculate Sheet control).
Ctrl+Alt+F9: Completely recalculates all open workbooks. Utilize it if Excel
does not appear to be returning accurate calculations. Ctrl+Shift+Alt+F9:
Rechecks all dependent formulas and then forces all open workbooks to
recalculate.
Caution
Contrary to popular belief, Excel's Calculation mode is not bound to a specific
workbook. Excel's Calculation mode setting affects all open workbooks, not just
the active ones. Additionally, the initial Calculation mode is determined by the
Calculation mode saved with the first workbook that you open.
Copying or Moving Formulas
When creating a worksheet, you may find that you need to copy or move data
between locations. For instance, excel simplifies the process of copying and
moving cell ranges. The following are some examples of what you could do:
Copies a cell to a new location. The source cell's contents are copied to the
destination cell.
Copy a single cell to a collection of cells. Each cell in the destination range is
copied identically to the source cell.
Copies a range from one to another. Both ranges must be identical in size.
Transfer a group of cells to a new location. The source cell's contents are
removed and copied to the destination cell.
The primary distinction between copying and moving a range is the effect on the
source range of the operation. When you copy a range, the source range remains
unchanged. When you move a range, the source range's contents are deleted.
Note
When you copy a cell, the contents of the cell are copied as well as any
formatting applied to the original cell (including conditional formatting and data
validation), as well as the cell comment (if it has one). When you copy a cell that
contains a formula, the copied formulas' cell references are automatically
changed to be relative to their new destination.
Copying or moving is a two-step process (though there are shortcuts):
1. After selecting the cell or range to copy, copy it to the Clipboard (the source
range). To move the range rather than copying it, cut it.
2. Paste the contents of the Clipboard by dragging the cell pointer to the range
containing the copy (the destination range).
Caution
When you paste data, Excel automatically overwrites any cells that get in the
way. If you discover that pasting deleted some critical cells, click Undo in the
Quick Access toolbar (or press Ctrl+Z).
When you copy a cell or range, Excel automatically adds an animated border
around the copied area. The copied data is pasteable as long as the animated
border remains. If you press Esc to cancel the animated border, Excel deletes the
information from the Clipboard.
When you copy a range that contains formulas, the formulas' cell references are
changed. When you move a formula-containing range, the formulas' cell
references remain unchanged. Almost always, this is what you want.
Making an Exact Replication of a Formula
When you copy a formula and paste it elsewhere, Excel adjusts the cell
references. Typically, changing the cell references is exactly what you want.
Occasionally, however, you may wish to create an exact copy of the formula.
This can be accomplished by converting cell references to absolute references,
but this is not always desirable.
It is preferable to select the formula while in edit mode and then copy it to the
Clipboard as text. There are several ways to approach this. Here is an example of
how to duplicate the formula in A1 and paste it into A2:
1. Select cell A1 and press F2 to enter edit mode.
2. Press Ctrl+Home to begin the formula, then Ctrl+Shift+End to select the
entire formula text.
You can also drag the mouse to select the entire formula.
While holding down the Ctrl key is required for formulas longer than one line, it
is not required for single-line formulas.
3. Right-click on the Home Clipboard and choose Copy (or Ctrl+C).
The clipboard is copied with the selected text.
4. Press Esc to exit edit mode.
5. Activate cell A2.
6. Press F2 to enter edit mode.
7. Press Enter after selecting Home Clipboard Paste (or pressing Ctrl+V).
This operation precisely duplicates the formula text in cell A2.
Additionally, you can use this technique to copy a portion of a formula and paste
it into another. Simply drag the mouse or press Shift+arrow keys to highlight the
section of the formula you want to copy. Then, using one of the available
techniques, copy the selection to the Clipboard. Following that, the text can be
copied and pasted into another cell.
When you paste formulas (or portions of formulas) that have been copied in this
manner, their cell references are not altered. This is because you are copying the
formulas as text and not as actual formulas.
Another way to create an exact duplicate of the formula is to edit it and delete
the equal sign at the beginning. This converts the formula to plain text. After
that, the "nonformula" file should be copied to a new location. Finally, in both
the original and copied formulas, insert the initial equal sign.
CHAPTER 2: GET TO KNOW WORKSHEET FUNCTIONS
Anyone interested in mastering the art of formulas should be familiar with
Excel's worksheet functions. This chapter discusses the various functions we can
use in Excel formulas.
A worksheet function is a pre-programmed component of a formula that you can
use. Worksheet functions allow you to perform calculations and operations that
would be otherwise impossible. A typical function (for instance, SUM) takes one
or more arguments and returns one or more values. For instance, the SUM
function takes a range argument and returns the sum of the values contained
within it.
Functions are advantageous because they: Simplify complex mathematical
expressions, Allow formulas to perform calculations that would be impossible
otherwise. Accelerate some editing tasks, and Excel functions can also be used
to execute formulas conditionally. As a result, they are advantageous for
rudimentary decision-making.
Arguments in Functions
If you examine the preceding examples in this chapter, you will notice that they
all contain a pair of parentheses. The information enclosed in parentheses refers
to the arguments to the function. The way functions use arguments varies. A
function can take
no arguments,
a fixed number of arguments,
an indeterminate number of arguments, and
optional arguments.
For example, the RAND function, which returns a random integer between 0 and
1, does not accept an argument. Even if a function does not require an argument,
it must be used in a formula with a set of empty parentheses.
If a function accepts multiple arguments, a comma is used to separate them. For
example, the LARGE function takes two parameters and returns the nth largest
value in a range. The first argument specifies the range, and the second specifies
the value for n. The following formula returns the third-largest value in the
interval A1:A100:
=LARGE (A1:A100,3)
Note
In some non-English versions of Excel, the character used to separate function
arguments may be something other than a comma, such as a semicolon. In the
examples in this book, a comma is used as the argument separator character.
As demonstrated, functions can accept cell or range references as parameters.
When Excel calculates the formula, it does so using the cell's or range's current
contents.
SUM returns the sum of the arguments passed to it (s). This formula can be used
to find the sum of the values in A1:A20:
=SUM (A1:A20)
As expected, if you've given A1:A20 a name (for example, Sales), you can use it
in place of the reference:
=SUM(Sales)
Additionally, expressions can be used as arguments. Consider an expression to
be a subscripted formula within a subscripted formula (minus the equal leading
sign). Excel evaluates an expression that is passed as an argument to a function.
It assigns the value of the argument to the result. Consider the following
illustration:
=SQRT((A1^2)+(A2^2))
This formula utilizes the SQRT function and has a single argument: (A1^2)+
(A2^2).
Excel evaluates the formula by evaluating the argument expression first and then
computing the result's square root. This expression squares the value of cell A1
and adds it to the square of the value of cell A2.
How to Enter a Function in a Formula
You can manually enter a function into a formula, use the commands in the
Function Library or the Insert Function dialog box.
Manual Input
If you are familiar with a particular function and are aware of its correct spelling
and the arguments it accepts, you can simply type the function and its arguments
into your formula. Frequently, this is the most efficient method.
However, you can make use of the convenient Formula AutoComplete feature.
When you type an equal sign followed by the first letter of a function in a cell,
Excel displays a drop-down list box containing all functions that begin with that
letter, as well as a ScreenTip containing a brief description of the function.
Continue typing the function to narrow the list, or use the arrow keys to select it.
After selecting the desired function, press Tab to insert it into the formula, along
with its opening parenthesis.
When you press Tab to insert the function and its opening parenthesis, Excel
displays another ScreenTip with the function's arguments displayed. That is the
audacious argument into which you are venturing. The square bracketed
arguments are optional. You'll notice that the ScreenTip's text contains a
hyperlink for each argument you entered. To select an argument, click on a
hyperlink. You can drag that ScreenTip to a new location if it becomes a
hindrance.
Function Library
Another option is to use the Formulas Function Library group icons to insert a
function into a formula. The screenshot below depicts these icons, which are all
drop-down controls.
Each category of Functions is devoted to a particular subject.
Financial functions: The financial functions enable you to perform standard
business calculations involving money. For example, you can use the PMT
function to determine the monthly payment on a car loan. You must include the
loan amount, interest rate, and term of the loan as arguments.
Date and time functions enable you to perform analysis and manipulation on
date and time values contained in formulas. For instance, the TODAY function
returns the current date (as stored in the system clock).
Functions of lookup and reference: These functions are used to locate (look up)
values contained within lists or tables. A typical example is a tax table. For
instance, you can use the VLOOKUP function to determine the tax rate
applicable to a particular income level.
Mathematics and trigonometry functions: This category includes a number of
functions that perform mathematical and trigonometric calculations.
Statistical functions: These functions analyze data ranges statistically. You can
compute statistics such as the mean, mode, standard deviation, and variance, for
example.
Within formulas, text functions enable you to manipulate text strings. You can
use the MID function, for example, to extract any number of characters
beginning with any character position. Additional functions enable you to
change the case of text, for example, by converting it to uppercase.
Only seven functions fall under the category of logical functions. These
functions allow you to test a logical TRUE or FALSE condition. The IF function
is advantageous because it enables your formulas to make simple decisions.
Information functions include the following: These functions can be used to
determine the type of data contained within a cell. For example, the ISTEXT
function returns TRUE if a cell reference contains text. Additionally, you can use
the ISBLANK function to determine whether a cell is empty. The CELL function
returns a large amount of information about a single cell that may be useful.
Functions of engineering: The functions in this category are used in engineering.
They enable the manipulation of complex numbers and the conversion between
different numbering and measurement systems.
Cube functions: These functions enable you to manipulate OLAP data cube data.
Compatibility functions: Excel 2010 introduced the Compatibility category.
Statistical functions in this category have been replaced with improved versions
of themselves. These older functions are kept in Excel for backward
compatibility with Excel 2007 and earlier versions.
Web functions: The Web category was launched in Excel 2013 and includes
three functions that deal with Internet-related tasks such as URL encoding and
web service parsing.
Excel opens the Function Arguments dialog box when you select a function from
one of these lists to assist you in entering the arguments. The section "Using the
Insert Function dialog box" contains additional information about the Function
Arguments dialog box.
Insert Function dialog box
Additionally, you can use the Insert Function dialog box to insert a function into
a formula. By using the Insert Function dialog box, you can ensure that the
function is spelled correctly and has the correct number and order of arguments.
The image below demonstrates how to insert a function by using the Insert
Function dialog box to select it.
This dialog box can be accessed in several ways:
From the Formulas Function Library group, select Insert Function. Select any
icon category from the Formulas Function Library group and then click the drop-
down list next to Insert Function.
After clicking the fx icon to the left of the Formula bar, press Shift+F3.
The Insert Function dialog box includes a drop-down list of categories. When a
category is selected from the list, the list box displays the functions contained
within that category. The Most Recently Used category keeps track of the
functions you've used recently. The All category contains a complete list of all
available functions across all categories. If you know the name of a function but
not its category, navigate to this section.
If you're unsure which function to use, you can perform a search. Use the field
near the top of the Insert Function dialog box. Enter a keyword or multiple
keywords and click the Go button. Excel will then display a list of functions that
match the criteria you specified. For instance, if you're looking for functions that
calculate loan payments, type loan into the search box.
When you select a function from the Select a Function list box, the dialog box
displays the function (along with its argument names) and a brief description of
what the function does.
Additionally, you can use the Help on This Function button to access the Excel
Help system and learn more about the selected function.
Once you've located the function you're looking for, click OK. As illustrated in
Figure 4-5, the Function Arguments dialog box appears, allowing you to specify
the function's arguments. Simply point to a cell or range on the worksheet and
click to specify it as an argument. Notably, each argument is described.
When selecting Formulas Function Library AutoSum from the Formulas
Function Library menu, Excel performs a quick check of the adjacent cells (or
Home Editing AutoSum). Following that, it suggests a formula that makes use of
the SUM function. If Excel predicted your intentions correctly, simply press
Enter to accept the proposed formula (s). If Excel's recommendation is incorrect,
simply select the range with your mouse to override it (or press Esc to cancel the
AutoSum).
Rather than letting Excel determine which cells to include in an AutoSum, you
can specify them in advance. Select A1:A11 and click the AutoSum button to
insert an SUM function that sums A1:A10 into cell A11.
When you click the AutoSum button, an arrow will appear, pointing to additional
functions. You can use this button, for example, to insert a formula that utilizes
the AVERAGE function.
CHAPTER 3: TEXT FUNCTIONS
Excel is well-known for its ability to perform mathematical calculations.
However, it is quite versatile when it comes to text manipulation. As you are
probably aware, Excel enables you to enter text for row and column headings,
customer names and addresses, and part numbers, among other things.
Additionally, formulas can be used to manipulate the text contained within cells.
Numerous examples of formulas that manipulate text using functions are
included in this chapter. Several of these formulas are capable of achieving feats
you never imagined possible.
When you type data into a cell, Excel automatically determines whether you're
typing a formula, a number (including a date or time), or something else.
Everything else is considered text.
Note
Rather than text, we could use the term string. The two terms are
interchangeable or can be used in conjunction, as in text string.
A single cell can store up to 32,000 characters. While we do not recommend
using a cell in lieu of a word processor, you should not have to worry about a
cell becoming overflowing with text.
How to input numbers as text
As previously stated, Excel makes a distinction between numbers and text. In
some instances, such as with part numbers and credit card numbers, a numerical
number is not required. You can "forcibly" convert a number to text by
performing one of the following:
Apply the Text number format to the cell prior to entering the number. Select
Text from the Home Number group's Number Format drop-down list. Assume
you are not using any additional horizontal alignment formatting. The value will
appear left-aligned in the cell (as standard text does), and functions such as SUM
will ignore it.
It should be noted, however, that this does not work in reverse. If you enter a
number and then format it as text, the number will be left-aligned, but functions
will still treat the entry as a value. Before the number, an apostrophe should be
used. Although the apostrophe is omitted, the cell entry is treated as text. SUM
and other functions will not consider the cell to be a numeric value.
Even if a cell is formatted as text (or contains an apostrophe), if the entry
appears to be a number, you can still perform some mathematical operations on
it.
Text Functions
Excel includes a large number of functions for manipulating text in worksheets.
To facilitate access to the majority of these functions, the Formulas tab's
Function Library group includes a Text drop-down list. Other function categories
contain a few additional text manipulation-related functions.
The majority of the Text category's functions are not restricted to text. In other
words, these functions are capable of operating on cells that contain data. Excel
is extremely accommodating when it comes to treating numbers as text and text
as numbers.
The examples in this section demonstrate several commonly used (and extremely
useful) text manipulation techniques. Several of these examples may need to be
modified to meet your unique requirements.
To know if a cell contains text
In some cases, a formula will be required to determine the data type contained in
a particular cell. For instance, you can use an IF function to return a value only if
a cell contains the text. The ISTEXT function is the simplest method for
determining this.
The ISTEXT function accepts a single argument and returns TRUE if the array
contains text and FALSE otherwise.
=ISTEXT(A1)
Additionally, the TYPE function may be used. The TYPE function takes a single
argument and returns a value indicating the data type of the data contained in a
cell.
=TYPE(A1)
Both the ISTEXT and TYPE functions consider an apostrophe-prefixed numeric
value to be text. However, these functions do not consider a number formatted as
Text to be text unless the Text formatting is applied prior to entering the number
in the cell.
This sounds complicated (and it is), but it is uncommon to distinguish whether a
cell's contents are numeric or text in practice.
To know if two strings are identical
Create a simple logical formula to determine whether the values in two cells
correspond to the same entry. For instance, use the following formula to
determine whether cell A1 and cell A2 contain the same data:
=A1=A2
When it comes to text comparisons, Excel is a little lax. Consider the following
scenario: A1 contains the word JANUARY (with a capital letter at the
beginning), whereas A2 contains the word JANUARY (all uppercase). Although
the contents of the two cells are not identical, the preceding formula returns
TRUE. In other words, the comparison is case insensitive.
Often, you do not need to worry about the case of the text. If an exact, case-
sensitive comparison is required, Excel's EXACT function can be used. TRUE is
returned by the following formula only if cells A1 and A2 contain the duplicate
entry:
=EXACT(A1, A2)
To join two or more cells
Excel's concatenation operator is an ampersand (&). Concatenation is a fancy
term for the process of joining the contents of two or more cells. For instance, if
cell A1 contains the string Bruno and cell A2 contains the string Mars, the
following formula returns BrunoMars:
=A1&A2
It's important to note that the two phrases are connected directly. Use the
following formula to insert a space between the two entries (to obtain Bruno
Mars):
=A1&" "&A2
To display formatted values as text
The Excel TEXT function enables you to display a value in a specified number
format. While this function appears to be of dubious utility, as the examples in
this section demonstrate, it does perform some useful functions. This function is
demonstrated in the following screenshot of a basic worksheet. The formula in
cell D1 is as follows:
="I owe my mother " & B1
This formula outputs the result of combining a text string with the contents of
cell B1.
The value in cell B1, on the other hand, is not formatted in such way. You might
want to use a currency number format to display the contents of cell B1.
="I owe my mother " & TEXT(B2,"$#,##0.00")
To remove excess spaces and nonprinting characters
The TRIM function is classified as an Excel Text function. TRIM assists in
removing extra spaces in data and, as a result, cleaning up the cells in the
worksheet.
The TRIM function in financial analysis can effectively remove random spacing
from data imported from other apps.
=TRIM(" Two days in ")
This will return a text with the correct string without useless random spaces.
Changing the case of text
There are three valuable functions to change the case of text in Excel. Each one
only needs you to write the function and the text or cell reference as the
argument:
UPPER: This command converts the text to ALL UPPERCASE.
LOWER: Converts all text to lowercase.
PROPER: This command converts the text to Proper Case. That is, each word's
first letter is capitalized.
To replace text with another text
A formula may be required in some instances to replace a portion of a text string
with another text. For instance, you may import data that contains asterisks and
require the asterisks to be converted to another character. You could perform the
replacement using Excel's Home Editing Find & Select Replace command. If
you prefer a formula-based solution, one of two functions is available.
SUBSTITUTE is used to replace text in a string with another string. Utilize this
function if you are aware of the character(s) to be replaced but not their position.
REPLACE replaces text within a string at a specific location. Use this function if
you know the position of the text you wish to replace but you don’t know the
text.
To find and search text within a string
The FIND and SEARCH functions in Excel enable you to locate the start of a
specific substring within a string:
FIND: Returns the starting position of a substring contained within another text
string. You can specify the starting character position for the search. Use this
function to perform case-sensitive text comparisons. Wildcard comparisons are
not supported.
SEARCH Returns the starting position of a substring contained within another
text string. You can specify the starting character position for the search. Utilize
this function for text that is not case sensitive or when wildcard characters are
required.
The following formula uses the FIND function to return 7, the position of the
string's first m.
It's worth noting that this is a case-sensitive formula:
=FIND("m","Bad Mammoth in Thames",1)
The SEARCH function, on the other hand, is not case-sensitive, so that will
return 5 as the position of the first m, even when it is a capital letter.
CHAPTER 4: DATE AND TIME FUNCTIONS
Using dates and times in Excel can be difficult for beginners. To avoid this
frustration, you must understand how Excel handles time-based data. This
chapter teaches you how to create effective date and time formulas.
Dates and Times in Excel
In Excel, a date is simply a number. In more technical terms, a date is a unique
serial number that indicates the number of days that have passed since January 1,
1900. A serial number of 1 indicates that the item was manufactured on January
1, 1900; a serial number of 2 indicates that the item was manufactured on
January 2, 1900, and so forth. This system enables you to create date-related
formulas. For instance, you can create a formula to calculate the number of days
between two dates or the date of the third Friday in January 2020.
You may be curious about the date of January 1, 1900. This nondate (date serial
number 0) is used to denote times that are not associated with a particular day.
This will be discussed in greater detail later in this section.
To view a date serial number as a date, the cell must be formatted as a date. To
apply a date format, open the Format Cells dialog box (Number tab).
To Enter dates in Excel
While you can enter dates as serial numbers (if you know them), the majority of
people enter dates in one of several formats. Excel automatically converts your
entry to a date serial number when performing calculations. It formats the cell so
that it displays a date instead of an unknown serial number.
To enter June 18, 2015, for instance, simply type June 18, 2015. (or choose from
a variety of different date formats). Excel interprets your entry and stores the
date serial number 42173, which is 42173. As a result, the contents of the cell
may not appear exactly as typed.
Note
Entering a date such as June 18, 2020, may be interpreted as text in your region.
In this case, enter the date in the format used in your region, for example, 18
June 2020.
When a date-containing cell is selected, the Formula bar displays the cell
contents in the system's default date format. Unlike other number formats, the
Formula bar does not display the date's serial number.
To determine the serial number of a date, format the cell using the General
format.
How to Format Date and Time
Cells containing dates and times can be formatted in a variety of ways. The cell
can be formatted to display only the date, only the time, or both.
Dates and times can be formatted by selecting the cells and using the Number
Format control from the Home Number group. This control is capable of
displaying dates and times in two different formats. Windows supports two date
formats: Short Date and Long Date.
Custom has more date and time formats. Some formats show both date and time.
After that, click OK to confirm your selection.
The first time format corresponds to your Windows date and time settings in the
Time category.
If none of the pre-configured formats meet your needs, you can create your own.
Customize the Type box in the Custom category by entering custom format
settings.
Date Functions
There are about 23 date functions in Microsoft Excel, and we will discuss most
of them and how they work.
Excel DATE Function
The DATE function in Excel combines year, month, and day values into a date
serial number.
Syntax: =DATE(year, month, day)
year
The year argument can be from 1900 to 9999.
month
A number from 1 to 12 represents the year's month (January to December).
day
A number from 1 to 31 represents the day of the month.
In the example below, the DATE function returns a date serial number by
combining day, month, and year components from separate cells:
And the same formula as a serial number:
This is how it works: While the year argument must be positive, the month and
day arguments are allowed to be negative. If the month exceeds twelve, it is
added to the calendar year's first month.
As a rule, if there are less than 1 month in a year and that number is less than 1,
the month subtracts that number of months, plus 1, from the first month in that
year.
DATE will return the last day of the previous month if the day is 0.
=DATE(2019,1,0) gives you December 31, 2018.
The Secret Excel DATEDIF Function
Do you want to know the number of months between two dates? There is one
route that is not widely known. You can obtain the date by utilizing Excel's
hidden DATEDIF function.
Try typing =DATEDIF into Excel; it will behave as if it has no idea what it is.
You can see that it isn't in the list of functions on the left.
The syntax, which I'll show you in a second, can be used for a wide range of
things.
I think it's a secret because it can be a little difficult and sometimes gives errors!
You should be careful when you use it. I'll talk about some of the known
problems with the Excel DATEDIF function as soon as I finish.
This is good for us because Microsoft says they only include DATEDIF in the
most recent versions because they want to use it with older software versions.
You might think that because it says "DATEDIF," it can figure out the difference
between two dates.
Syntax: =DATEDIF(date1,date2,unit)
Date1 is the first month
Date2 is the end month
The unit you want to calculate is the type of unit you want to calculate, such as
days, months, or years.
Units.
D stands for days. The number of days between two dates.
M stands for months. The months between two dates.
Y stands for years. Years that exist between two dates.
YD = The number of calendar days between two dates calculated as if the end
date is in the same year as the start date.
YM = The calendar months between two dates as if the end date and start date
are the same years.
MD = the number of calendar days between two dates when the month and year
of the end date are the same as the month and year of the start date.
Caution! The "M" and "MD" arguments have well-known flaws. I'll give you
some examples shortly.
Please keep in mind that DATEDIF calculations do not include the start date and
return only whole numbers.
Generating a series of dates
Frequently, a worksheet is used to insert a series of dates. If you're tracking
weekly sales, for example, you might want to enter a series of dates separated by
seven days. These dates will be used to calculate sales.
In some cases, you can use the Excel AutoFill feature to insert a series of dates.
Enter the first date and hold down the right mouse button while dragging the
cell's fill handle. Once the mouse button is released, Bob is your uncle!
How to determine the difference in days between two dates
The difference in days between two dates is a frequently used method of date
calculation. For example, you could create a financial worksheet that calculates
the interest earned on a savings account. Interest is calculated based on the
number of days the account has been open. Therefore, if your spreadsheet
contains the account's open and close dates, you can compute the number of
open days.
Due to the fact that dates are stored as consecutive serial numbers, the number of
days between two dates can be calculated using simple subtraction. If both cells
A2 and B2 contain dates, for example, the following formula returns the number
of days between these dates.
= A2 - B2
As a more efficient alternative, you can use the DAY function. The DAY
function would work like this:
=DAYS (A1, B1)
How to determine the number of workdays that have passed
between two dates
When calculating the difference between two dates, weekends and holidays
should be avoided.
For instance, you may require knowledge of the number of business days in
November. Saturdays, Sundays, and federal holidays should be omitted from this
schedule. Using the NETWORKDAYS function can be beneficial. The name of
the NETWORKDAYS function is deceptive. This function is unrelated to
networks or networking. Rather than that, it calculates the difference in
workdays between two dates.
The NETWORKDAYS function computes the difference between two non-
weekend dates (Saturdays and Sundays). Additionally, you can specify a range
of cells containing the dates of holidays that you want to exclude. Due to the fact
that Excel has no way of determining which days are holidays, you must provide
this information as a range.
The NETWORKDAYS function in Excel returns the number of consecutive
working days between two date serial numbers, excluding weekends and
holidays.
Syntax: =NETWORKDAYS(start_date, end_date, [holidays])
How to calculate a person’s age
The age of a person indicates the number of complete years they have lived. You
can determine the number of years between two dates by subtracting the first
year's cell from the second year's cell. Nonetheless, this method cannot be used
to accurately calculate age. However, two additional formulas can be used to
determine an individual's age.
The formula below calculates the age of the individual whose birth date you
enter in cell A1. The YEARFRAC function is used in this formula:
= INT(YEARFRAC (TODAY(),A1,1))
You can also use the DATEDIF function we have learned about earlier.
=DATEDIF(A1,TODAY(),"y")
How to create a (drop-down and printable) calendar
in Excel
This segment discusses how to input and link a drop-down calendar (date picker)
in Excel. Additionally, you'll learn how to create a printable calendar quickly
using an Excel calendar template.
The most challenging aspect of working with large or shared worksheets is
maintaining data integrity, particularly when entering dates. Should they be
entered using the mm/dd/yy format, the dd/mm/yy format, or the mm-dd-yyyy
format? Additionally, may I simply type a date such as "05 September 2016"?
Oh, and when was this year's first Monday in September?
The aforementioned issues can be easily resolved by incorporating a drop-down
calendar that enables your users to easily fill in dates with a single mouse click!
This section of the book will demonstrate how to create a calendar of this type
quickly and easily in Excel, as well as how to quickly create a calendar based on
a template.
In Excel, how do you insert a calendar? (Date Picker control)
Inserting a dropdown calendar in Excel is simple. Many people are still unaware
of its existence due to the Date and Time Picker Control's concealment. The
steps below will guide you through the process, but first, please read the
following important note.
NOTE: Microsoft's Date Picker control is compatible with Excel 2016 (32-bit),
2013, and 2010 (32-bit), but not with Excel 64-bit.
1. Enable the Developer tab on the ribbon
The datepicker control is found on the Developer tab as part of a collection of
ActiveX controls. Although Excel's Developer tab is hidden by default, you can
quickly force it to appear.
After right-clicking anywhere on the ribbon, click Customize the Ribbon...
Select Main Tabs (which is typically selected by default), check the Developer
checkbox, and click OK in the window's right-hand section.
2. Use the Insert control
In Excel, a drop-down calendar is referred to as a Microsoft Date and Time
Picker Control. Simply enter the following into your sheet to insert it:
Go to the Developer tab > Controls group, click Insert, and then ActiveX
Controls > More Controls.
Locate and select the Microsoft Date and Time Picker Control 6.0 (SP6) from
the More Controls dialog window.
Suppose you are using earlier versions of Excel. In that case, the Date and Time
Picker Control (mscomct2.ocx in Excel 2010 and 2013 and mscal.ocx in Excel
2007) will already be installed by default. However, if you have Excel 2016 and
later, you may have to manually download and register this control. Let us do
that together now:
How to Register Calendar control on your Computer
1. Ascertain that mscomct2.ocx is installed on your device.
To begin, ensure that your computer system has the Microsoft Calendar Control
installed. To do so, click the Start menu and enter mscomct2.ocx (or mscal.ocx
in Excel 2007 and earlier).
If the mscomct2.ocx file appears, proceed directly to step 3.
2. Install the Microsoft Date and Time Picker control.
If you don't have the Microsoft Date Picker Control on your device, you can get
it by clicking this link. Please keep in mind that this control only works with the
32-bit versions of Excel 2019, 2016, 2013, and 2010.
After downloading the mscomct2.zip file, unzip it and copy the mscomct2.ocx
file to one of the following folders, depending on your Windows version:
C:WindowsSystem32 on Windows 32-bit
C:WindowsSysWoW64 on Windows 64-bit
Tip. To quickly access the operating system's configuration information, open
Windows Explorer, right-click Computer, and select Properties.
You must have administrative privileges to copy files to the system folders. If
you have administrator access and continue to receive the Destination Folder
Access Denied dialog, click Continue:
3. Add calendar control to your system.
The calendar control (mscomct2.ocx) must be installed and registered on your
computer. To accomplish this, follow these steps:
Click the Start button and type "command" without pressing the Enter key into
the search box.
Right-click Command Prompt at the top of the search results and then select Run
as Administrator.
In the Command Prompt, enter either one of the following commands,
depending on your system, and then press Enter:
For Windows 32 bit:
C:\Windows\System32\regsvr32.exe mscomct2.ocx
For Windows 64 bit:
C:\Windows\SysWoW64\regsvr32.exe mscomct2.ocx
If you press Enter, you will get this response to confirm that it is now registered
on your computer.
Select a cell where you want to insert the calendar control as a final step. That's
all! In your Excel sheet, a drop-down calendar control is added:
When the datepicker control is inserted, the EMBED formula appears in the
formula bar. It informs Excel about the type of control that is embedded in the
sheet. Never modify or delete it, as this will result in the "Reference is not valid"
error.
When an ActiveX control (including DTPiker) is inserted, the Design Mode is
activated, allowing you to modify the control's appearance and properties.
Typically, the most noticeable changes you'll want to make are resizing your
calendar control and associating it with a specific cell.
To enable the drop-down calendar in Excel, navigate to the Design tab >
Controls group and disable the Design Mode:
You can now display the calendar by clicking on the dropdown arrow and
selecting the desired date:
4. Modify the calendar control
After you've added a calendar control to your Excel sheet, you should resize it to
fit within a cell.
Switch to Design Mode and resize the datepicker control by dragging a corner:
Alternatively, click Properties after selecting your calendar control in Design
Mode. In the Properties window, you can change the font theme and size, as well
as specify the desired height and width.
5. Connect the calendar control to a cell.
After adding a drop-down calendar to Excel, you may wish to associate it with a
specific cell. This is necessary if you intend to use the dates selected in formulas.
Assume you've created a formula to determine the total number of orders placed
between two specified dates. You placed dropdown calendars in two cells to
prevent your users from entering incorrect dates on 2/30/2016. (A2 and B2 in
this example). However, despite the fact that your COUNTIFS formula is
obviously correct, it returns zero, despite the fact that a few orders are clearly
visible within the specified period!
This is because unless a date picker control is linked to a specific cell, Excel will
not recognize its value. To resolve this, connect the date picker controls to the
following cells:
While in Design Mode, select the calendar control.
On the Developer tab, click Properties in the Controls group.
In the Properties windows, locate the LinkedCell property and enter a cell
reference (A3 in this example) next to it:
If Excel displays an error message such as "Can't set cell value to NULL...",
simply click OK to dismiss it.
And now, when you select a date from the drop-down calendar, the selected date
is displayed immediately in a linked cell. As illustrated in the screenshot below,
Excel readily recognizes such dates, and our formula referencing the linked cells
(A3 and B3) functions flawlessly:
How to create an Excel calendar from a template
Along with spreadsheets that are capable of calculating almost anything,
Microsoft Excel includes a few graphic features such as drawing tools, clipart,
charts, and tables. Using these features, you can easily create a weekly or
monthly calendar that includes your own photos and special occasion days such
as birthdays or anniversaries. You can find detailed instructions for creating a
custom Excel monthly calendar here.
However, the quickest and easiest way to create an Excel calendar is to use a free
Excel calendar template. Simply navigate to File > New and enter the word
"calendar" in the search box. Excel will search through thousands of online
templates and present you with a selection of daily, weekly, monthly, and yearly
calendar templates, as shown in the screenshot below:
Just pick anyone you like and click Create. That's all! The calendar template will
open in a new workbook, which you can print or customize. In general, an Excel
calendar template can be customized for any year; some templates allow you to
specify the day of the week on which the calendar will begin.
To ensure that the current year is always displayed on your Excel calendar, enter
the following formula in the year cell: =YEAR(TODAY())
Time Functions
Excel includes several functions for manipulating time values in formulas. This
section contains examples of how to use the functions described in the previous
section.
Time functions, like date functions, can be found under the Date & Time drop-
down list in the Formulas Function Library.
If you've been following our Excel Dates tutorial, you'll know that Microsoft
Excel stores dates as sequential numbers starting with January 1, 1900 (number
1). Times are stored as decimal fractions in Excel because it treats time as a
fraction of a day.
Excel stores:
00:00:00 as 0.0
23:59:59 as 0.99999
06:00 AM as 0.25
12:00 PM as 0.5
How to display the current time
Use the Excel NOW function to automatically insert the current date and time as
a dynamic value that refreshes.
There are no arguments required, so the formula is straightforward:
=NOW()
There are a few points to remember when using Excel's NOW function:
The NOW function obtains time from your computer's system clock.
NOW is an Excel volatile function that recalculates the formula cell whenever
the worksheet is reopened or recalculated.
Press Shift + F9 to recalculate the active worksheet or F9 to recalculate all open
workbooks to force the Excel NOW function to update the returned value.
Use the keyboard shortcut Ctrl +'to insert the current date and time in a way that
will not change.
This shortcut will insert the current time into a cell as a fixed value that will not
change. Use the keyboard shortcut Ctrl + ; to insert both the date and time into a
cell. Then type a space character and press Ctrl + Shift +;.
CHAPTER 5: NUMBER FUNCTIONS
Counting and summing values and other worksheet elements are frequently used
functions in Microsoft Excel. Individuals are constantly on the lookout for
formulas that will count or sum various items in a worksheet. This chapter will
demonstrate how to use Excel's counting and summing functions.
In general, a counting formula returns the number of cells in a specified range
that satisfy specified criteria. Similarly, a summing formula computes the sum of
the values contained in a range of cells that meet specified criteria.
The range you're counting or summarizing may or may not contain a worksheet
database or a table.
Count Functions
If your organization makes use of spreadsheets, you may need to determine the
total number of cells in a worksheet containing data. Additionally, you may
require information about the number of empty cells or whether the values of
specific cells meet certain criteria. Excel includes a plethora of math functions
for counting. You can, for example, count the number of clients who have
registered for an event with a particular last name or who reside in a particular
ZIP code.
The COUNT Function
The COUNT function returns the number of cells in a range or array that have a
numeric value. These values can be integers, decimals, dates, or quotation-
marked numbers. If a cell contains text, blank space, or anything else that is not
a number, it is not counted. COUNT(Value1, Value2,...Value[n]), where "n" is
limited to 255. Although the value "Value1" is mandatory, the remaining values
are optional. Assume you're working with a spreadsheet that contains values in
cells A2, A3, and A5; COUNT(A2:A5) would return "3."
The COUNTA Function
COUNTA returns the number of non-empty cells in a given range, in contrast to
COUNT. Cells can store data of any type, including numbers, text, and logical
values. Additionally, the function counts empty text "" and error values, but not
blank cells. COUNTA(Value1, Value2,...Value[n]), where "Value1" is required
and "n" may contain up to 255 additional items, is the function's formula.
Assume you have three rows of numbers, each beginning in column A1 and
ending in column A3, and each row ending in column D. COUNTA is used to
determine the total number of cells containing values (A1:D1, A2:D2, A3:D3).
The COUNTBLANK Function
COUNTBLANK is a function that can be used to count cells that contain no
data. This function counts the number of empty cells in a range. The format is
COUNTBLANK (range). This function will count cells with blank text values "
", but not cells with zero values. For instance, if you have a spreadsheet with
values in cells A2 to A3 and A5, but no value in cell A4,
COUNTBLANK(A2:A5) returns "1."
The COUNTIF Function
COUNTIF is used to count cells only when certain conditions are met. This
function returns the number of cells that satisfy a specified condition in a range.
The format is COUNTIF. For instance, you can use this function to count the
number of clients with the surname "Smith" in cells A2 to A10 in the following
manner: PERCENTAGE (A2:A10, Smith). For example, if the cells contain a
series of numbers and you want to find those that are less than "10," you can use
COUNTIF (A2:A10, "10").
Counting the number of errors in a range
Excel provides three functions to assist you in determining if a cell has an error
value:
ISERROR: Shows TRUE if the cell has any error in the data (#N/A, #VALUE!,
#REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!)
ISERR: Shows TRUE if the cell has any error value apart from #N/A.
ISNA: Returns TRUE if the cell contains the error code #N/A.
Notably, the #N/A error code is handled independently. Generally, #N/A is not a
"real" error. The symbol #N/A is frequently used to indicate that data is missing.
You can enter the #N/A error value directly or via the NA function:
=NA()
Functions for Sum
As the name implies, this function adds all the numerical values in a range or in
a worksheet.
The SUM function
The AutoSum function in Excel is the quickest and simplest way to sum a range
of cells. It inserts an SUM function into the selected cell using the Excel SUM
function. The SUM function sums one or more numbers contained in a
collection of cells.
The following example demonstrates how to utilize the AutoSum feature.
Example:
Select the empty cell in the line beneath the cells for which you wish to perform
calculations, in this case, cell A6.
On the Home tab of the Ribbon, click the AutoSum function, or use the hotkey:
Alt+ =
In the active cell, an SUM formula relating to the cells above will appear. There
is an SUM formula in cell A6 of the screenshot above: =SUM (A1:A5)
NOTE: If not all cells are included automatically, you can manually select them
by highlighting the range.
You can manually insert the SUM function rather than using the AutoSum
command.
The SUM function arrangement (syntax) is as follows: SUM (number1,
[number2],...).
There is only one required argument: number1 (a range of cells).
It also accepts optional arguments (in square brackets): [number2],...
These arguments can be cell references or text that has been entered into the
formula.
In the preceding example (=SUM(A1:A5)), there is only one argument: a
reference to cells A1:A5.
How to sum all cells in a range
The row, column, and grand totals for a range of cells can be easily calculated.
The SUM function accepts up to 255 arguments. For instance, the following
formula returns the sum of five non-adjacent ranges' values:
=SUM(A1:A9,C1:C9,E1:E9,G1:G9,I1:I9)
You can pass entire rows or columns to the SUM function as an argument. The
following formula, for example, returns the sum of all values in column A.
When this formula is entered into a column A cell, a circular reference error
occurs.
=SUM(A: A)
To sum a range, you can also use the AutoSum function when you select the cell
range, the blank row beneath it, and the blank cells in the column in front of it
(cells A1:D5 in the example below):
Click the AutoSum button on the Home tab of the Ribbon. When you do so, an
SUM formula for each column is automatically entered.
Running Totals
You can use the SUM function to see a running total in each row of an Excel list,
with the first row locked as an exact reference. There are two ways:
Follow these steps to create a running total on a worksheet list (rather than a
named Excel table). In the screenshot below, amounts are entered in column C,
and a running total is derived in column D.
Enter the following formula in cell D2: =SUM(C$2:C2)
Copy and paste the formula into cell D6.
The formula begins with a reference to row 2 in the absolute sense — C$2 —
and ends with a reference to row 2 in the relative sense — C2
This ensures that the starting point of the formula does not change when it is
copied down to the subsequent rows. The formula in cell D6 is as follows: the
starting point is constant, while the ending point is in the current row. C6
=SUM(C$2:C6)
This formula is suitable for a regular excel spreadsheet. However, we cannot use
the previous section's worksheet list formula on a named Excel table. To begin,
I'll demonstrate the issue with that formula and compare it to the formula that
works in a named table.
When you enter the formula in cell D2 of the specified Excel table, it fills down
automatically and the running total appears correct.
When you add a new row at the bottom of the table, the formula in the previous
row is modified.
Prior to the row being added, Cell D6 contained the following formula:
= SUM(C$2:C6)
The formula in D6 changed automatically as soon as the next entry in row 7 was
started. As a result, it now has an incorrect ending reference to C7, rather than
C6:
The formula changes to reflect the most recent row number with each new row
added.
To circumvent this issue, we'll use a slightly different formula to calculate a
running total in a labeled Excel table.
Column C contains values, and column D contains a running total.
Enter this formula in cell D2
=SUM(C$1:[@Amt])
Cell D6 is automatically filled in by the formula. All of the cells in column D
have the same formula.
The formula begins with an absolute reference to a heading cell — C$1.
To avoid complications, if a new data row is added at the top, the starting cell
should be in the table heading row.
Due to the presence of text in the heading cell, its value is zero and has no effect
on the running total.
A constructed table reference for the final point — [@Amount].
This is a reference to the current row's Amount cell.
When new rows are added to the Excel table, there is no problem with that table
cell reference.
When a new row is begun, cell C6 retains its original formula, and the running
totals for each row are correct.
Sum cells that match criteria
In Excel, the SUMIF function returns the total number of cells that fulfill a
single condition. Dates, numbers, and text can all be subjected to criteria. The
SUMIF function is used to sum the values in a range that meets the specified
criteria. For example, suppose you want to sum only the values that are greater
than 5 in a column of numbers. You can use the formula =SUMIF(B2:B25,">5").
Syntax: =SUMIF(range, criteria, [sum_range])
range. Required. The number of cells to be evaluated by criteria. Each range's
cells must be numbers or names, arrays or references containing numbers.
Values that are blank or text are ignored. Dates in standard Excel format may be
included in the selected range (examples below).
Criteria. Required. The criteria, which can take a number, expression, a cell
reference, text, or a function, determine which cells will be added. A question
mark (?) can be used to match any single character, and an asterisk (*) can be
used to match any sequence of characters. To find an actual question mark or
asterisk, type a tilde () before the character.
sum_range. Optional. If you want to add cells other than those specified in the
range argument, this is the actual cell to add. When the sum range argument is
not specified, Excel adds the cells specified in the range argument (the same
cells the criteria are applied).
Percentage Formulas
Percentage estimation is useful in a variety of situations, including restaurant
tipping, reseller commission, income tax, and interest rate. As an example,
suppose you were fortunate enough to receive a promotional code for a 25%
discount on a new plasma screen. Is this a reasonable price? How much would
you ultimately have to pay?
Fundamentals of percentages in Excel
As you probably recall from high school math class, a percentage is a fraction of
a hundred calculated by dividing the numerator by the denominator and
multiplying the result by 100. The fundamental formula for percentages is as
follows:
(part / whole) * 100
For example, if you had 20 apples and gave 5 to your friends, what percentage of
the total did you give? A simple calculation yields the answer: 25 percent = 5/20
* 100.
This is how percentages are usually measured in school and in everyday life.
Microsoft Excel also has a higher percentage of computation because it performs
certain operations in the background for you.
Regrettably, there is no one-size-fits-all Excel formula for percentages. If you
ask someone, "How do I get this result using the percentage formula?" They will
almost certainly respond with something along the lines of, "Well, that depends
on the outcome you expect."
So, to measure a percentage in Excel, let me show you a few basic formulas,
such as a percentage increase formula, a formula to get percentages of a total,
and more.
Excel's basic percentage formula
In Excel, the basic formula for calculating percentages is as follows:
Percentage = Total / Part
When compared to the percentage simple math formula, the * 100 part is
missing from Excel's percentage formula. When you calculate a percentage in
Excel, you do not need to multiply the resulting fraction by 100 because Excel
does so automatically when you apply the percentage format to a cell.
Now, let's look at some real-world examples of how the Excel percentage
formula can be used. To begin, assume that column B contains the total number
of items ordered and column C contains the total number of items shipped. Then,
to determine the number of goods delivered, take the following steps:
In cell D2, enter the = C2 / B2 formula and copy it down to as many rows as
desired.
To view the resulting decimal fractions, click the Percent Style button (Home
Tab > Number Group).
Bear in mind that you may need to increase the number of decimal places if
necessary, as demonstrated in Percentage Tips.
How to Calculate the Percentage of the Total in Excel
Indeed, the preceding example illustrates a straightforward method for
calculating the percentages of a number. Now, let's look at a few additional
examples that demonstrate how to quickly estimate a percentage of the total in
various Excel data sets.
Example: To obtain the total in a particular cell at the table's conclusion
A very common scenario involves a single cell containing the total at the end of
a table. With the exception that the denominator cell reference is an absolute
reference (with), the percentage formula is identical to the one discussed
previously. The dollar sign establishes the cell relationship, which remains
constant regardless of which formula is copied. For instance, if you have some
values in column B and their sum in cell B10, you can calculate percentages of
the total using the following formula: B2/$B$10 =
Due to the fact that cell B2 contains a relative cell reference, you want the
formula to be updated when it is copied to other cells in column B. However,
you enter $B$10 as the absolute cell reference to ensure that the denominator
remains on B10 when the formula is auto-filled down to row 9.
To convert the denominator to an absolute reference, type a dollar sign ($ or
click the cell reference in the formula bar and then press F4).
If you have additional rows for the same product in the preceding example and
want to know what percentage of total revenue is generated by all orders for that
product.
In this case, the SUMIF function allows you to first add all of the product
numbers and then divide the total by = SUMIF(range, requirements, range sum) /
total
Please see the following sections for more information on the SUM feature:
How to Calculate Percentage Changes in Excel
The formula for percent change is likely to be the most frequently used of all
percentage calculation formulas in Excel.
Excel formula for percentage shift (percentage increase/decrease)
To calculate the percentage difference between values A and B, use the
following formula:
Change in Percentage = (B-A) / A
It is critical to correctly identify which value is A and which is B when applying
this formula to actual data. For instance, if you had 80 apples yesterday and now
have 100, you have gained 20 apples, or a 25% increase. If you previously had
100 apples and now have 80, you have decreased the quantity of apples by 20, or
by 20%.
The Excel formula for calculating the percentage change is as follows: (New
Value - Previous Value)/ (Old Value)
Now, let's examine the relationship between this percentage change formula
(also known as the Excel percentage increase formula) and your spreadsheets.
Assume column B contains last month's prices and column C contains this
month's prices. In cell D2 of your Excel spreadsheet, enter the following formula
to calculate the percentage change:
(C2-B2)/B2 B2-B2 = (C2-B2)/B2 B2-B2
This percentage change formula computes the percentage increase / decrease in
this month's (column C) revenue over the previous month (column B).
Bear in mind that after copying the formula to other rows, you must click the
Percent Style button on the ribbon to display decimals as percentages. You
should see something similar to the screenshot below. Positive percentages
(percent increase) are formatted in regular black in this example. By contrast,
using the technique described in this tip, negative percentages (percent decrease)
are formatted in red.
CHAPTER 6: LOOKUP FUNCTIONS
This chapter discusses various methods for locating a value in a table. Microsoft
Excel includes three distinct functions for this purpose (LOOKUP, VLOOKUP,
and HLOOKUP). You may still discover that these functions are insufficient.
This chapter contains numerous lookup examples, as well as alternatives to
Excel's standard lookup capabilities.
A lookup formula searches for another value that is related in order to get back a
value from a table (in a range). A common telephone directory is an excellent
way to explain how this function works: To obtain a person's phone number, you
must first locate the person's name and then the number.
Basic Excel Functions for Searching
The basic lookup functions in Excel can be used to search for a lookup value in a
column or row and return another value as a result. The three essential lookup
functions in Microsoft Excel are HLOOKUP, VLOOKUP, and LOOKUP.
The VLOOKUP function
The VLOOKUP function retrieves the value from the lookup table's first
column. It returns the value specified by the user in the specified table column.
When you need to locate a row in a table or range, use VLOOKUP. For instance,
you can look up the price of an automotive part using its part number or look up
the name of an employee using their employee ID.
In its simplest form, the VLOOKUP function is as follows: =VLOOKUP(What
you want to look up, where you want to look it up, the column number in the
range containing the value you want to return, return an Approximate or Exact
match – indicated by 1/TRUE or 0/FALSE).
Syntax: =VLOOKUP (lookup_value, table_array, col_index_num,
[range_lookup])
To construct the VLOOKUP syntax, you will need four pieces of information:
The search value is also referred to as the lookup value.
The lookup value is contained within the range. To ensure that VLOOKUP
works properly, the lookup value must always be in the range's first column.
Therefore, if the lookup value is in cell C2, your range should begin with C.
The column in the range containing the return value. If you specify the range
B2:D11, the first column should be B, the second column should be C, and so
on.
Optionally, you can specify TRUE for an approximate match and FALSE for an
exact match of the return value. When no value is specified, the default value is
always TRUE or a close match.
Construct the following expression: =VLOOKUP(lookup value, range
containing the lookup value, column number in the range containing the return
value, Approximate match (TRUE) or Exact match (FALSE)).
If the range lookup argument is TRUE or if it is omitted, the first column of the
lookup table must be ascending. If the lookup value is less than the smallest
value in the first column of the table array, VLOOKUP returns #N/A. If the
range lookup argument is FALSE, the first column of the lookup table does not
have to be ascending. If no exact match is found, the function returns #N/A.
For example, let us use Ms Excel to calculate someone’s income tax.
The lookup table is contained within a three-column range (A2:C7). Due to the
fact that the VLOOKUP function's third argument is 3, the formula returns the
value from the third column of the lookup table.
It's worth noting that an exact match is not necessary. If no exact match is found
in the first column of the lookup table, the VLOOKUP function returns the next
largest value less than the lookup value. In other words, the function looks up the
value in the row that is greater than or equal to the value in the preceding row
but less than the value in the following row. This is precisely what you want a
tax table to accomplish.
The HLOOKUP function
The HLOOKUP function is similar to the VLOOKUP function, except that the
lookup table is horizontally instead of vertically arranged. The HLOOKUP
function retrieves the value from the first row of the lookup table. Then, it
returns the value that corresponds to the specified table row. This function
traverses the top row of a table or an array of values in search of a value. It then
gives the result in the same column from the specified row of the table or array.
When you have a row of comparison values across the top of a data table, you
can use HLOOKUP to look down a specified number of rows. Use VLOOKUP
if your comparison values are in a column to the left of the data you're looking
for.
HLOOKUP's H stands for "Horizontal."
Syntax: = HLOOKUP(lookup_value, table_array, row_index_num,
[range_lookup])
The syntax of the HLOOKUP function is as follows:
The lookup value is a required parameter. The value is located in the first row of
the table. A lookup value can be a number, a reference, or a text string.
Table array. Required. A data table is used to look up information. Make use of a
range reference or a range name.
The values in table_array's first row can be text, numbers, or logical values.
If range_lookup is set to TRUE, that means the values in the first row of the
table_array are in ascending order like this:...-2, -1, 0, 1, 2,..., A-Z, FALSE,
TRUE; otherwise, HLOOKUP may not return the correct value. On the contrary,
if it is set to FALSE, the table_array does not need to be sorted.
Sort the values from left to the right in ascending order. Row index num. This
field is required. The table array row number from which the matching value
will be returned. Row index num = 1 returns the first-row value in the
table_array, 2 returns the second-row value in the table_array, and so on.
HLOOKUP returns the #VALUE! error value if row index num is less than one;
if row index num is greater than the number of rows on table array, HLOOKUP
returns the #REF! error value.
Range_lookup. Optional. A logical value specifies whether HLOOKUP should
look for an exact or approximate match. If TRUE or omitted, an approximate
match is returned. In other words, if no exact match is found, the value
immediately preceding the lookup value is returned. HLOOKUP will find an
exact match if the value is FALSE. Otherwise, the error code #N/A is returned.
Remark
Suppose HLOOKUP is unable to locate lookup_value and range lookup is
TRUE. In that case, it will use the largest value that is less than the
lookup_value.
HLOOKUP returns the #N/A error value if the lookup_value is less than the
smallest value in the first row of the table_array.
If range_lookup is set to FALSE and lookup value is text, the wildcard
characters question mark (?) and asterisk (*) can be used in lookup_value. An
asterisk indicates that any sequence of characters is acceptable, whereas a
question mark indicates that any single character is acceptable. To locate an
actual question mark or asterisk, type a tilde () before the character.
The LOOKUP function
When you need to look up a value in a single row or column and find it in
another row or column at the same position, use LOOKUP, one of the lookup
and reference functions.
LOOKUP is a function that is included in the Excel Lookup and Reference
functions. The function performs a cursory lookup in a single-row or single-
column range and returns the value from another single-row or single-column
range.
We can use the LOOKUP function to compare two rows or columns when
performing financial analysis. It is designed to perform the simplest vertical and
horizontal lookups.
HLOOKUP and VLOOKUP are more advanced LOOKUP variants.
Lookup is divided into two categories: Vector and Array.
LOOKUP function (Vector)
In vector form, the LOOKUP function searches one row or column of data for a
specified value and then retrieves the data from the specified location in another
row or column.
The function's formula is as follows:
=LOOKUP(lookup_value, lookup_vector, [result_vector])
It contains the following arguments:
Lookup value (required) – The value we will be searching for. It could be TRUE
or FALSE, or it could be a reference to a cell, number, or text.
Lookup_vector (required) – This is the data for which a search should be
conducted. Bear in mind that we must sort it to be ascending.
Result_vector – An optional list of data from which a value should be returned.
If specified, the [result vector] must have the same length as the lookup vector. If
the [result vector] is omitted, the lookup vector returns the result.
The array version of LOOKUP searches for the specified value in the array's first
row or column. It returns the value at the same position in the array's final row or
column. Therefore, when the values to be matched are in the array's first row or
column, we must use this form of LOOKUP.
LOOKUP Function (Array)
Here is the syntax for the Array form:
= LOOKUP(lookup_value, array)
array (required) – A range of cells containing numbers, text, or logical values
(TRUE / FALSE) to be compared against the lookup value.
The LOOKUP Function is a worksheet function that can be used as part of a
formula in a worksheet cell. Consider the following examples to better
understand how this function can be used:
Say we have a list of products, each with its own color, order id, and quantity.
We want a dashboard to enter the product and immediately get the quantity.
CHAPTER 7: STATISTIC FUNCTIONS
This chapter will look at essential functions for statistics and math operations.
AVERAGE Function
The AVERAGE function in Excel determines the average (arithmetic mean) of
the numbers passed in. AVERAGE supports up to 255 distinct arguments, which
may include numbers, cell references, ranges, arrays, or constants. Average
returns the arguments' arithmetic mean (average). For instance, if the range
A1:A20 contains numbers, the formula =AVERAGE(A1:A20) returns the
average of those numbers.
Syntax: =AVERAGE(number1, number2...)
The argument it needs is the numbers or a range of cells that contains the
numbers you want to average.
Example:
=AVERAGE(1,2,3,4) =2.5
You need to calculate the average of your values in your Excel worksheet, and
you would generally SUM all of the values before dividing them by the number
of values.
That is a lengthy procedure!
Fortunately, there is a faster way using Excel's AVERAGE formula!
In the following example, we have a table of values from which we need to
calculate the average:
As shown below, one common way to use the AVERAGE function is to provide
a range. The formula that will provide the data we need in column E2 is:
=AVERAGE(B2:D2)
The AVERAGE function ignores blank cells by default. For instance, in the
screenshot below, cell C3 is empty. AVERAGE ignores it entirely and computes
the average using only B3 and D3.
LARGE Function
This function returns the n-th largest value in a data set. Additionally, this
function can be used to determine a value's relative position. You can use
LARGE to return the highest, second-highest, or third-highest score, for
example.
In Microsoft Excel, the LARGE function returns the nth largest value in a
collection of values.
LARGE is a built-in function in Excel that is classified as a Statistical Function.
It can be used as a worksheet function in Excel. The LARGE function is a
worksheet function that can be used in a worksheet cell as part of a formula.
When sorted by value in descending order, the Excel LARGE function returns a
numeric value based on its position in a list. In other words, LARGE can return
the "nth largest" value – the first largest value, the second largest value, the third
largest value, and so on.
Syntax: =LARGE (array, k)
LARGE displays the #NUM! error value if the array is empty.
LARGE returns the #NUM! If k is greater than or equal to the number of data
points, the error value is 0.
If n is the number of data points in a range, then LARGE(array,1) displays the
largest value, while LARGE(array,n) returns the smallest value.
Let's look at some examples of Excel LARGE functions and how to use the
LARGE function as a spreadsheet function in Microsoft Excel:
We want to use the LARGE function to display the 3rd largest number in the
data:
MAX function
The MAX Function is a Statistical function in Excel. MAX returns the value that
is the largest in a list of arguments. It returns the maximum value in a set of
numeric values. The MAX function, in contrast to the MAXA function, counts
numbers. It does not, however, ignore empty cells, text, the logical values TRUE
and FALSE, or text values.
MAX can aid in financial analysis by calculating the highest score, the quickest
time, the highest expense or earnings amount, and so on.
Syntax: =MAX(number1, [number2], ...)
The MAX function syntax uses the following arguments:
Number1, number2, ... Number1 is required. It can be a range of cells.
Subsequent numbers are optional.
Numbers, labels, linked lists, or cell references containing figures may be used
as arguments.
The count includes both logical values and text depictions of numbers inputted
directly into the argument list.
If an argument is a list or reference, only the numbers contained in the array or
reference are used. In the array or reference, empty cells, logical values, or text
are ignored.
MAX returns 0 if the arguments do not contain any numbers (zero).
Errors are caused by arguments that contain error values or non-numerical text.
In this straightforward example, we'll use the MAX function:
We have used it to get the highest value in the range A2 to A6.
Let us add another foreign value to the formula and see how it works.
This formula returns the highest value in the range and 30. Obviously, 30 is the
highest value.
MEDIAN Function
The MEDIAN function is a Statistical function in Excel. The function will return
the number that is in the middle of a given set of numbers. The median is the
value that lies in the center of a collection of numbers. This means that half of
the numbers have values greater than the median. In comparison, the other half
of the population returns values that are less than the median. For instance, the
median of 2, 3, 3, 5, 7, and 10 is four. The median is the value that lies in the
center of a collection of numbers.
Syntax: = MEDIAN(number1, [number2], ...)
MEDIAN computes the average of the two numbers in the middle if the set
contains an even number of numbers. Consider the example's second formula.
Numbers, labels, linked lists, or references having figures may be used as
arguments.
The count includes both logical values and text representations of numbers
entered directly into the argument list.
Text, logical values, and empty cells in an array or reference argument are
ignored; however, cells with the value zero are included.
Errors are caused by arguments that are error values or text that cannot be
translated into numbers.
CHAPTER 8: OTHER POPULAR FUNCTIONS
(ACCORDING TO MICROSOFT)
This extensive chapter will look at the syntax, usage, and meaning of at least 10
most popular Ms Excel functions that many people have found useful.
IF function
The IF function is one of the most frequently used functions in Excel, as it
enables you to make logical comparisons between a value and an expected
value.
As a result, an IF statement can take one of two possible paths. If the first result
of the comparison is True, the second result is True; if the first comparison is
False, the second result is False.
=IF(C2="Yes",1,2), for example, means IF(C2 = Yes, then return a 1, otherwise
return a 2).
Usually, if you want to write an IF formula for text values in Excel, you would
combine them with the two logical operators listed below, such as "equal to" or
"not equal to."
Simple IF sample:
As you can see, the IF function can evaluate both text and values. It can also be
used to assess mistakes. You are not limited to simply comparing two things and
returning a single result; you can also use mathematical operators and perform
additional calculations based on your criteria. In order to perform multiple
comparisons, you can nest multiple IF functions together.
For example, look at the IF function in cell B2 below.
Explanation: If the price exceeds 500, the IF function returns High; otherwise, it
returns Low.
Using the And/Or Criteria
You can also combine the IF function with the AND and OR functions, and your
work will feel like the work of an Excel expert. Let us use an example to get
this:
In this example, if the first score is greater than or equal to 60 and the second
score is greater than or equal to 90, the AND function returns TRUE; otherwise,
it returns FALSE. If TRUE, the IF function returns Pass; otherwise, it returns
Fail.
INDEX function
In Excel, the INDEX function is categorized as a Lookup and Reference
function. The function returns the value located at a specified index in a range or
array. INDEX is frequently used in conjunction with the MATCH function. As a
result, we can refer to it as a different method of performing VLOOKUP.
As an analyst, you can use the INDEX function for more than just looking up a
value in a list or table. It can be used in conjunction with other functions in data
analysis to perform lookups and return the column sum. INDEX returns a value
or a reference to a value in a table or range of values.
There are two formats for the INDEX function:
Reference format
Array format
The Array Format of the INDEX Function
We use the array format when we want to return the value of a single cell or a
large collection of cells.
The value of an element in a table or array is returned, as determined by its row
and column indexes. Use the array form if the first argument to INDEX is an
array constant.
Syntax: =INDEX(array, row_num, [col_num])
The INDEX function's array form takes the following arguments:
array (Required). A cell range or an array constant.
If the array only contains one row or column, the row num or column num
argument is not required.
INDEX returns an array of the entire row or column in an array if an array has
more than one row and more than one column, and only row num or column
num is used.
row_num. (This is required unless column num is present.) Chooses a row in the
array from which to return a value. Column_num is required if row_num is
omitted.
column_num (Optional). This picks a column where the value result will be
taken from in the list. Row_num is required if column_num is omitted.
Remarks
If both arguments are used, INDEX gives a value in the cell at the crossing point
of row num and column num.
If row num and column num do not refer to a cell in the list, INDEX returns a
#REF! error.
If row num or column num is set to 0, INDEX reverts the list of values for the
entire column or row (zero). Use the INDEX function as an array formula to
access the array values returned.
Suppose you have a current version of Microsoft 365. In that case, you can enter
the formula in the top-left cell of the output range and press ENTER to confirm
it as a dynamic array formula. Otherwise, enter the formula as a legacy array
formula by first selecting the output range, entering the formula in the top-left-
cell of the output range, and pressing CTRL+SHIFT+ENTER to confirm it.
Excel inserts curly brackets at the beginning and end of the formula
automatically.
In these examples, the INDEX function is used to find the value at the
intersection of two cells where a row and a column meet.
The INDEX function will be used to retrieve the value in the range A2:B3 at the
crossing point of the second row and the second column, as well as the value in
the range A1:B3 at the crossing point of the second row and the first column.
Now let us get another index:
Reference form of INDEX
The INDEX function in this form returns the cell reference at the crossing point
of a particular row and column. You can choose which selection to look in if the
reference is made up of non-adjacent selections.
Syntax: = INDEX(reference, row_num, [column_num], [area_num])
The INDEX function's reference form takes the following arguments:
reference (Required). One or more cell ranges you want to refer to.
If you want to enter a non-adjacent range for reference, put it in parentheses.
If the referenced area contains only one row or column, the row num and column
num arguments are not required. For instance, to refer to a single row, use
INDEX (reference, column_num).
row_num (Required). The row number in the reference where you want to return
a reference.
column_num (Optional). The reference column number from where you want to
return a reference.
area_num (Optional). Returns the intersection of the row and column indices in
a referenced range. The first area selected or entered is designated as 1, the
second as 2, and so forth. INDEX defaults to area 1 if area num is not specified.
Each of the following sections must be contained on a single sheet. A #VALUE!
error will occur if you specify areas that are not on the same sheet. If you need to
use ranges that are on different sheets, it is best to use the array form of the
INDEX function and another function to calculate the range that makes up the
array.
For example, let us say we have a registry of fruits and prices with the amount
left in stock. Let us use the INDEX function to:
To begin, find the midpoint of the second row and third column in the range
A2:C6, which corresponds to the value in cell C3.
Let us get the intersection of row 2 and the second column in the second area of
A8:C11, which is the contents of cell B9.
How about using the INDEX with the SUM function? Let us get the sum of the
range starting at B2 and ending at the intersection of row 5 and column B of the
range A2:A6, which is the sum of B2:B6.
IS Functions
Each function, collectively referred to as the IS function, compares the specified
value to TRUE or FALSE. For example, the ISBLANK function returns TRUE
if the value argument specifies an empty cell; otherwise, it returns FALSE.
Before performing a calculation or other action on a value, an IS function can be
used to obtain information about it. If an error occurs, for instance, you can use
the ISERROR function in combination with the IF function to achieve a different
action: = IF(ISERROR(A1), "An error occurred.", A1 * 2)
This formula determines whether A1 has an error condition. If this is the case,
the IF function will return the message "An error occurred." If there is no error,
the IF function performs the calculation A1*2.
ISBLANK Function
ISBLANK is a data type in Excel that displays true if the argument cell has no
data. ISBLANK examines a specified cell and reports whether or not it is blank.
If it is empty, it returns TRUE; otherwise, it returns FALSE. MS Excel 2007
introduced the function.
In financial analysis, we deal with data on a daily basis. ISBLANK assists in
determining whether a cell is blank or not. For instance, if A5 contains a formula
that results in the empty string "," the function returns FALSE. As a result, it aids
in the removal of both regular and non-breaking space characters.
However, if a cell contains both good data and non-breaking spaces, the non-
breaking spaces can be removed from the data.
Syntax: =ISBLANK(value)
This formula above checks whether A2 is blank.
ISERROR function
The ISERROR Excel function falls under the category of Information functions.
If the given value is an error, the function will return TRUE; otherwise, it will
return FALSE. It works with #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!,
#NAME?, and #NULL errors. When combined with the IF function, ISERROR
identifies a potential formula error and displays other formulas or text strings in
message form or blanks. If an error is detected, it can also be used in conjunction
with the IF function to display a custom message or perform some other
calculation.
The screenshot below checks whether the value in cell A4, #REF!, is an error.
ISNUMBER Function
ISNUMBER is an information function in Excel. The function in Excel
determines whether or not a cell contains a numeric value. It returns TRUE if the
value is a number; otherwise, it returns FALSE. If the specified value is a string,
a date, or a time, it returns FALSE.
When working with large amounts of data as a data analyst, the ISNUMBER
Excel function assists in determining whether or not the result of a given formula
is a number.
ISTEXT Function
The ISTEXT Function is an Excel information function. The function checks to
see if a given value is a text string. It returns TRUE if the given value is text;
otherwise, it returns FALSE.
If we want a specific file to input only text values into a specific cell during data
analysis, we can use this function in conjunction with data validation.
CHAPTER 9: EXCEL'S TOP 10 TRICKS
Check out the top ten Excel tips below for those in need of a quick dose of
advice on how to improve their Excel skills. Then, make the most of this
fantastic guide by downloading the entire 100 and working your way through it.
Let's get started!
Contextual formatting
It is complex but critical to making sense of our data-rich world in a noisy world.
Conditional Formatting, as captured by your spreadsheet, brings out the patterns
of the universe when used correctly. As a result, neither Excel experts nor Excel
users voted on the most essential feature. It could be considered sophisticated.
However, even minor color improvements can be highly beneficial. For
example, assume you have salespeople who sell a certain amount of product
each month. Only three clicks are required to reveal the top 10% of performing
salespeople and hold a critical business discussion.
Pivot Tables
You may be put off learning PivotTables because it takes 4 hours to become
proficient, but don't be. Use them in a single large spreadsheet to sort, count,
total, or average data stored and display it in a new table, cutting as needed. That
is the main point here. If only a few countries, product lines, or marketing
platforms are considered. To begin, ensure the security of your data!
Distinctive Paste
One of the most frequently performed Excel tasks is copying (or grabbing) data
from one cell to another. However, you may be able to copy a significant portion
of the document (formatting, value, formula, and comments, for example), and
you may not be able to copy everything. The most frequent instance is when you
opt to remove the formatting. This data will be saved in a spreadsheet that you
create with your own formatting. Plonking formatting from another source is
infuriating and unappealing. Therefore, simply copy the values to obtain the text,
number, or whatever the value is. After copying the cell (Ctrl C), Alt E S V is the
shortcut—easier it's to do than it appears. The other critical one has been
transposed. This instantly flips rows and columns. Shortcut for Alt E S E.
How to Add several lines
While Ctrl Shift+ is a shortcut, it takes significantly longer than right-clicking on
the row numbers to the left of the Excel screen. As a result, we recommend
using the Right Click command. If you wish to add more than one row, simply
select the desired number of rows or columns and right-click to add them.
Bibliography in total
Indispensable! Necessary! The dollar symbol aligns the column with the letter,
the dollar sign aligns the row with the number, and F4 cycles through the four
possible combinations. Examine it using the following exercise. In cells B1, C1,
D1, type three foods horizontally and three colors in cells A2, B2, C2 (Green,
Blue, Yellow). Type '=A2&' '&B1' in cell B2. Congratulations: Oh, the green
olives! For the exercise, add dollar signs to make the formula green as you copy
it over. Or just the Granola in a variety of colors. Hey! Experiment!
Printing optimization
Everyone is having difficulty printing from Excel. But what if what you were
printing was exactly what you wanted? That IS a possibility. Print preview, one-
page fit, margin change, print selection, header print, portrait vs. landscape, and
spreadsheet layout are all included. So spend some time with it to unwind. You
will carry out this task numerous times in your professional life.
Formula Extend Across/Down
Excel's beauty is its simple scalability. Once the formula is correct, Excel will
produce the correct calculation a million times. In addition, the + cross hair is
convenient. If you have ongoing information, double-clicking it will bring it all
the way down. Finally, you might find it easier to copy and paste (either standard
paste or paste formulas).
Flash Filling
Excel developed its own mind in 2013. There are two columns of names, and
you are responsible for generating email addresses from them all. Do this only
for the first row; Excel will deduce what you mean and perform the operation on
the remaining rows. This was possible prior to 2013, but it was contingent upon
a number of functions (FIND, LEFT &, etc.). This is significantly easier to
accomplish now, and it WILL impress others. If Flash Fill is enabled (File
Options Advanced), it should begin working immediately after you begin typing.
Alternatively, you can manually initiate it by selecting Data > Flash Fill or by
pressing Ctrl E.
INDEX-MATCH
This is one of the most potent Excel feature combos. This can be used to look for
a value in a large data table and return the value to that table. As an illustration,
consider a company with 10,000 employees. There is a spreadsheet that contains
all of their information, including salaries, start dates, and line managers.
Nonetheless, you have a twenty-person team and genuinely care about them.
INDEX-MATCH will look up the value of your team members (which must be
unique, such as an email address or employee number) in that table and return
the information required for your team. It's worthwhile to grasp this concept
because it's more versatile and thus more effective than VLOOKUP in this case.
Filters
Explore data from a chart quickly. Filtering effectively hides data that is not of
interest. You're usually looking for a value (for example, blue cars), and filters
will bring up those and cover the rest. However, more recent versions of Excel
allow you to filter by numeric values (e.g., higher than, top 10%, etc.) and cell
color. When you need to filter several columns at the same time, such as all
colors and vehicles, to find your blue car, filtering becomes more effective.
Conditional formatting and sorting serve similar functions. Sorting necessitates
rearranging the spreadsheet, which is both inconvenient and ineffective.
Conditional formatting is introduced by visualization. Filtering is quick and
dependable.
The best and quickest way to filter large amounts of data in your spreadsheets;
you can easily find values by filtering data into a worksheet. You have the option
of filtering through one or more data columns. Filtering allows you to control
what you want to see and what you don't want to see. For example, you can filter
from a list based on your selections or create custom filters to focus on the
specific details you want to see.
While filtering, you can use the Search box in the filter interface to look for text
and numbers. When you filter data, entire rows are hidden if one or more
columns contain values that do not match the filtering criteria. For instance, you
can color-code numeric or text values in cells that have color formatting applied
to their context or text.
How? Let us use an example. Let us say we have a spreadsheet that looks like
this with plenty of data:
1. Click or highlight the data for which you wish to perform a filter.
2. On the Data tab, click Filter in the Sort & Filter group.
3. To open a list with filter options, click the arrow in the column header.
Take note that Microsoft Excel displays either Number Filters or Text Filters in
the list, depending on the type of data in the column.
1. Sort by collection of values or by keyword
The quickest methods of filtering are by selecting values from a list and
searching. When you click an arrow in a column that contains filtering, a list of
all the values in that column appears.
CHAPTER 9: HOW TO DEVELOP CUSTOM FUNCTIONS
With the help of VBA, you can create custom functions. The programming
language used by Excel is called Visual Basic for Applications (VBA) (Visual
Basic for Applications). It is used to create macros and customized worksheet
functions for use in formulas. A macro, in the broadest sense, is a sequence of
instructions that automates some aspect of Excel, allowing you to work more
efficiently and with fewer errors.
The jargon associated with Microsoft Excel programming can be befuddling. For
instance, Visual Basic for Applications (VBA) is a programming language that
doubles as a macro language. Therefore, how do you refer to a VBA program
that runs in Excel? Are you talking about a macro or a program here? Due to the
frequent use of the term "macros" in the Excel Help system, this is the
terminology used in this book.
In the following paragraphs, we'll introduce you to VBA by focusing on the
creation of worksheet functions. However, before you can create custom
functions with VBA, you must first have a working knowledge of VBA and the
Visual Basic Editor (VBE).
Macro
Most Excel users consider macros to be a method of recording actions so that
Excel can duplicate them on demand. Macro recording is comparable to the
process of programming a phone number into a cell phone.
You start by dialing and saving a phone number. Then, you can redial those
numbers by pressing a button whenever you want. Excel allows you to record
your actions in real time, just like you can on a cell phone.
While you record, Excel works in the background, turning your key presses and
clicks to written VBA code.
How to activate the Developer tab
Make sure the Developer tab is visible if you intend to work with VBA macros.
To make this tab visible, follow the steps below:
1. Navigate to File Options.
2. In the Excel Options dialog box, click Customize Ribbon.
3. In the list box on the right, check the box next to Developer.
4. To return to Excel, click OK.
Record a macro
You can begin working with VBA now that the Developer tab is visible in the
Excel Ribbon.
You can either create a macro manually or record a macro. It's often a good idea
to begin programming a procedure by recording a macro and letting Excel write
the first lines of code for you.
To activate the Macro Recorder, select Record Macro from the Developer tab.
This opens the Record Macro dialog box.
The four sections of the Record Macro dialog box are as follows:
Macro Name: This should go without saying. Excel gives your macro a default
name, such as Macro1, but you should change it to something more descriptive
of what it does. For instance, you could call a macro FormatTable that formats a
generic table.
Shortcut Key: To run a macro, an event, or something that occurs, must occur.
This event can be triggered by a button click, the opening of a workbook, or, in
this case, a combination of keystrokes. When you assign a shortcut key to a
macro, it is invoked when that combination of keys is pressed. This is a
volunteer position.
This Workbook serves as the default location for macros. By storing your macro
in This Workbook, it is kept along with the active Excel file. The macro will be
able to run the next time that workbook is opened. Similarly, consider sending
the workbook to a different user. In that case, the user can also run the macro
(provided the user has set the macro security appropriately—more on that later
in this chapter).
This is an optional field, but it can be useful if your spreadsheet contains a large
number of macros or if you need to provide a more complete description of what
the macro does to a user.
The following steps describe how to create a simple macro that supplies your
name into a worksheet cell while the Record Macro dialog box is open:
1. Substitute a new single-word name for the macro in place of the default
Macro1 name. MyName is an appropriate name for this instance.
2. By typing uppercase N into the Shortcut Key edit box, assign this macro to the
shortcut critical Ctrl+Shift+N.
3. Click OK to close the Record Macro dialog box and start recording your
activity.
4. On your Excel spreadsheet, pick any cell and type your name into it.
5. Identify the Developer Code Put an end to the recording (or press the Stop
Recording button in the status bar).
The macro will be saved as Module1 in a new module. To view your new Macro,
you must activate the Visual Basic Editor. The VB Editor can be activated in one
of two ways: You can access it by pressing Alt+F11 or by clicking Visual Basic
in the Developer tab's Code group.
In the VB Editor's Project window, a list of all open workbooks and add-ins is
displayed. This list is presented as an expandable or collapsible tree diagram.
The previously recorded code is stored in the current workbook's Module1. The
code for Module1 is displayed in the code window when you double-click it.
This is how the macro should look:
MyName is the name of the macro that was recorded. The statements direct
Excel's behavior when the macro is executed.
Excel incorporated some remarks to the procedure's beginning. These are some
of the comments that showed up in the Record Macro dialog box during the
recording process. These comment lines (which start with an apostrophe) are not
strictly necessary, and their removal has no influence on how the macro
functions.
If you dismiss the comments, you'll notice that this procedure contains only one
VBA statement:
ActiveCell.FormulaR1C1 = "Tobby"
The name you typed while recording is inserted into the active cell as a result of
this single statement.
How to Store macros in your Personal Macro
Workbook
The majority of macros created by users are specific to a particular workbook.
Nonetheless, you may wish to use some macros in multiple workbooks. You can
store these general-purpose macros in the Personal Macro Workbook to ensure
that they are always available. The Personal Macro Workbook is loaded when
you launch Excel. This file, referred to as personal.xlsb, does not exist until you
record a macro with the destination Personal Macro Workbook.
Prior to beginning recording, select the Personal Macro Workbook option in the
Record Macro dialog box to save the macro to your Personal Macro Workbook.
This is a drop-down menu option in the Store Macro In drop-down menu.
If you keep macros in the Personal Macro Workbook, you do not need to
remember to open it whenever you load a workbook that contains macros. When
you exit, Excel prompts you to save any changes made to the Personal Macro
Workbook.
Click No. Then under Save As, select Excel Macro-Enabled Template as shown
in the screenshot below:
How to run VBA macros in Excel
To execute the VBA code added in the previous section, press Alt+F8 to bring
up the "Macro" dialog box.
Then, from the "Macro Name" list, select the desired macro and click the "Run"
button.