You are on page 1of 1086

Merge two or multiple cells in Excel without losing data

The tutorial demonstrates different techniques to quickly merge two cells in Excel and combine
multiple cells without losing data in Excel 2016, 2013, 2010 and lower.
In your Excel worksheets, you may often need to merge two or more cells into one large cell.
For example, you may want to combine several cells for a better data presentation or structure.
In other cases, there may be too much content to be displayed in one cell, and you decide to
merge it with adjacent blank cells.
Whatever the reason, combining cells in Excel is not as straightforward as it may seem. If at
least two cells you are trying to join contain data, the standard Excel Merge Cells feature will
only keep the upper-left cell value and discard values in other cells.
But is there a way to merge cells in Excel without losing data? Of course there is. And further on
in this tutorial, you will find a few solutions that work in all versions of Excel 2016, Excel 2013,
Excel 2010 and lower.

Excel's Merge & Center feature


Merge two or more cells without losing data
Shortcut to merge cells in Excel
How to find merged cells
How to unmerge cells
Alternatives to merging cells in Excel
Combine cells using Excel's Merge and Center feature
The fastest and easiest way to combine two or more cells in Excel is to use the built-in Merge
and Center option. The whole process takes only 2 quick steps:
1.
2.

Select the contiguous cells you want to combine.


On the Home tab > Alignment group, click the Merge & Center

In this example, we have a list of fruits in cell A1 and we want to merge it with a couple of empty
cells to the right (B2 and C2) to create a large cell that fits the entire list.

Once you click Merge and Center, the selected cells will be combined into one cell and the text
is centered like in the following screenshot:

Other merging options in Excel


To access a couple more merge options provided by Excel, click the little drop-down arrow next
to the Merge & Center button and choose the option you want from the drop-down menu:

Merge Across - combine the selected cells in each row individually:

Merge Cells - join the selected cells into a single cell without centering the text:

Tip. To change the text alignment after merging, simply select the merged cell and click the
desired alignment in the Alignment group on the Home tab.
Excel's merging features - limitations and specificities
When using Excel's built-in features to combine cells, there are a few things to keep in mind:
1.

Make sure that all the data you want to include in a merged cell is entered in the leftmost cellof the selected range because only the content of the upper-left cell will survive
after merging, data in all other cells will be deleted. If you are looking to combine two or
more cells with data in them, check out How to merge cells without losing data.
2.
If the Merge and Center button is greyed out, most likely the selected cells are
in Edit mode. Press the Enter key to cancel the Edit mode, and then try to merge cells.
3.
None of standard Excel merging options works for the cells inside an Excel table. You
have to convert a table to a usual range first (right click the table and select Table > Convert
to Rangefrom the context menu), and then combine the cells.
4.
It's not possible to sort a range containing both merged and unmerged cells.

How to merge cells in Excel without losing data


As already mentioned, the standard Excel merge features keep the content of the top-left cell
only. And although Microsoft has made quite a lot of improvements in the recent versions of
Excel, the Merge Cells functionality seems to have slipped out of their attention and this critical
limitation persists even in Excel 2013 and Excel 2016. Well, where there is no obvious way,
there is a workaround :)
Method 1. Combine cells within one column (Justify feature)
This is a quick and easy method of merging cells keeping all their content. However, it requires
that all the cells to be merged reside in one area in one column.

Select all the cells you want to combine.


Make the column wide enough to fit the contents of all cells.

On the Home tab, in the Editing group, click Fill > This will move the contents of the
selected cells to the top-most cell.
Click Merge and Center or Merge Cells, depending on whether you want the merged text
to be centered or not.
If the combined values spread across two or more rows, make the column a bit wider and
repeat the process.
This merging technique is easy to use, however it does have a number of limitations:

Using Justify you can only join cells in a single column.


It works for text only, numerical values or formulas cannot be merged in this way.
It does not work if there are any blank cells in between the cells to be merged.

Method 2. Merge multiple cells with data in any range (Merge Cells add-in)
To be able to merge two or more cells in Excel without losing data and without extra "tricks",
we created a special tool - Merge Cells for Excel.

Using this add-in, you can quickly combine multiple cells containing any data types including
text, numbers, dates and special symbols. Also, you can separate the values with any delimiter
of your choosing such as a comma, space, slash or line break.
To join cells exactly the way you want them, configure the following options:

Choose Cells into one under "What to merge".


Select the delimiter under "Separate values with".
Specify the cell where you want to place the result: top-left, top-right, bottom-left or
bottom-right.
Make sure the Merge all areas in the selection option is selected. If this box is not
checked, the add-in will work like the Excel CONCATENATE function, i.e. combine the values
without merging the cells.

Apart from joining cells, this tool can quickly merge rows and columns, you just have to select
the corresponding option in the "What to merge" drop-down list.

To give the Merge Cells add-in a try, you are welcome to download the evaluation version that
works with Excel 2016, 2013, 2010, 2007 and 2003.
Method 3. Use the CONCATENATE function to combine two or multiple cells
Users who feel more comfortable with Excel formulas, may like this way to combine cells in
Excel. You can employ the CONCATENATE function or Excel & operator to join the cells' values
first, and then merge the cells if needed. The detailed steps follow below.
Supposing you want to combine two cells in your Excel sheet, A2 and B2, and both cells have
data in them. Not to lose the value in the second cell during merging, concatenate the two cells
by using either of the following formulas:
=CONCATENATE(A2,", ",B2)
=A2&", "&B2

The formula, however, inserts the concatenated values in another cell. If you do need to merge
two cells with the original data, A2 and B2 in this example, then a few extra steps are required:

Copy the cell with the CONCATENATE formula (D2).


Paste the copied value in the top-left cell of the range you want to merge (A2). To do
this, right click the cell and select Paste Special > Values from the context menu.
Select the cells that you want to join (A2 and B2) and click Merge and Center.
In a similar manner, you can merge multiple cells in Excel, the CONCATENATE formula will be
just a little bit longer in this case. An advantage of this approach is that you can separate values
with different delimiters within a single formula, for example:
=CONCATENATE(A2, ": ", B2, ", ", C2)

You can find more formula examples in the following tutorial - CONCATENATE in Excel:
combine text strings, cells and columns.
Shortcut for merging cells in Excel
If you merge cells in your Excel worksheets on a regular basis, you may find useful the
followingMerge Cells shortcut.
1.
2.

Select the cells you want to merge.


Press the Alt key that provides access the commands on the Excel ribbon and hold it
until an overlay appears.
3.
Hit H to select the Hometab.
4.
Press M to switch to Merge & Center.
5.
Press one of the following keys:
o
C to merge and center the selected cells
o
A to merge cells in each individual row
o
M to merge cells without centering

At first sight, the merge shortcut seems a bit long-winded, but with a little practice you may find
this way to combine cells faster than clicking the Merge and Center button with the mouse.
How to quickly find merged cells
To find merged cells in your Excel sheet, perform the following steps:
1.
2.

Press Ctrl + F to open the Find and Replace dialog, or click Find & Select > Find.
On the Find tab, click Options > Format.

3.

On the Alignment tab, select the Merge cells box under Text control, and click OK.

4.

Finally, click either Find Next to select the next merged cell, or Find All to find all
merged cells on the sheet. If you choose the latter, Microsoft Excel will display a list of all
found merged cells and let you navigate between them by selecting one of the merged cells

in this list:

How to unmerge cells in Excel


If you changed your mind immediately after merging cells, you can quickly unmerge them by
pressing the shortcut Ctrl + Z or clicking the Undo button on the Quick Access Toolbar.
To split the previously merged cell, select that cell and click Merge & Center, or click the little
arrow next to Merge & Center, and select Unmerge Cells:

After unmerging the cells, the entire contents will appear in the top-left cell.

Alternatives to merging cells in Excel


It goes without saying that merged cells can help present the information in your Excel
worksheets in a better and more meaningful way... but they spawn numerous side-effects that
you may not be even aware of. Here are just a few examples:

You can't sort a column with merged cells.


Neither AutoFill nor Fill Flash feature works if a range of cells to be filled contains
merged cells.
You cannot turn a range containing at least one merged cell into a full-fledged Excel
table, let alone a pivot table.
So, my advice would be to think twice before merging cells in Excel and do this only when really
needed for presentation or similar purposes, e.g. to center the table title across the table.
If you want to combine cells somewhere in the middle of your Excel sheet, you may consider
using the Center Across Selection feature as an alternative:

Select the cells that you'd like to join, B4 and C4 in this example.
Press Ctrl + 1 to open the Format Cells
Switch to the Alignment tab and select the Center Across Selection option from
the Horizontaldrop-down list, and then click OK.

In terms of look, the result is indistinguishable from the merged cell:

To prove that we did not really merge two cells, we can select each one individually:

This is how you can combine two cells in Excel or merge multiple cells without losing data.
Hopefully, this information has proved useful for your day-to-day tasks. I thank you for reading
and hope to see on our blog next week.

CONCATENATE in Excel: combine text strings, cells and columns


In this tutorial, you will learn various ways to concatenate text strings, cells, ranges, columns
and rows in Excel using the CONCATENATE function and "&" operator.
In your Excel workbooks, the data is not always structured according to your needs. Often you
may want to split the content of one cell into individual cells, or do the opposite - combine data
from two or more columns into a single column. Common examples that require concatenation
in Excel are joining names and address parts, combining text with a formula-driven value,
displaying dates and times in the desired format, to name a few.
In this tutorial, we are going to explore various techniques of Excel string concatenation so that
you can choose the method best suited for your worksheets.

What is "concatenate" in Excel?


Excel CONCATENATE function
Concatenation operator (&)
Concatenate cells with space, comma and other chars
Concatenate strings with line breaks
Concatenating two or more columns in Excel
Concatenating a range of cells
Concatenate numbers and dates in the desired format
Opposite of CONCATENATE in Excel (split cells)
Merge Cells add-in - formula-free way to concatenate cells in Excel
What is "concatenate" in Excel?
In essence, there are two ways to combine data in Excel spreadsheets:

Merge cells
Concatenate cells' values
When you merge cells, you "physically" merge two or more cells into a single cell. As a result,
you have one larger cell that is displayed across multiple rows and/or columns in your
worksheet.
When you concatenate cells in Excel, you combine only the contents of those cells. In other
words, concatenation in Excel is the process of joining two or more values together. This
method is often used to combine a few pieces of text that reside in different cells (technically,
these are called text strings or simply strings) or insert a formula-calculated value in the middle
of some text.

The following screenshot demonstrates the difference between these two methods:

Merging cells in Excel is the subject of our next article, and in this tutorial we will tackle two
essential ways to concatenate strings in Excel - by using the CONCATENATE function and the
Excel& operator.
Excel CONCATENATE function
The CONCATENATE function in Excel is designed to join different pieces of text together or
combine values from several cells into one cell.
The syntax of Excel CONCATENATE is as follows:
CONCATENATE(text1, [text2], )
Where text is a text string, cell reference or formula-driven value.
Below you will find a few examples of using the CONCATENATE function in Excel.
Concatenating the values of several cells
The simplest CONCATENATE formula to combine the values of cells A1 and B1 is as follows:
=CONCATENATE(A1, B1)
Please note that the values will be knit together without any delimiter, as in row 2 in the
screenshot below.
To separate the values with a space, enter " " in the second argument, as in row 3 in the
screenshot below.

=CONCATENATE(A1, " ", B1)

To separate the concatenated values with other delimiters such as a comma, space or slash,
please see Excel CONCATENATE formulas with special characters.
Concatenating a text string and cell value
There is no reason for the Excel CONCATENATE function to be limited to only joining cells'
values. You can also use it to concatenate various text strings to make the result more
meaningful. For example:
=CONCATENATE(A1, " ", B1, " completed")
The above formula informs the user that a certain project is completed, as in row 2 in the
screenshot below. Please notice that we add a space before the word " completed" to separate
the concatenated text strings.
Naturally, you can add a text string in the beginning or in the middle of your Concatenate
formula as well:
=CONCATENATE("See ", A1, " ", B1)
A space (" ") is added in between the combined values, so that the result displays as "Project 1"
rather than "Project1".

Concatenating a text string and a formula-calculated value


To make the result returned by some formula more understandable for your users, you can
concatenate it with a text string that explains what the value actually is.
For example, you can use the following formula to return the current date:
=CONCATENATE("Today is ",TEXT(TODAY(), "dd-mmm-yy"))

Using CONCATENATE in Excel - things to remember


To ensure that your CONCATENATE formulas always deliver the correct results, remember the
following simple rules:

Excel CONCATENATE function requires at least one "text" argument to work.


In a single CONCATENATE formula, you can concatenate up to 255 strings, a total of
8,192 characters.
The result of the CONCATENATE function is always a text string, even when all of the
source values are numbers.
Excel CONCATENATE does not recognize arrays. Each cell reference must be listed
separately. For example, you should write =CONCATENATE(A1, A2, A3) instead
of =CONCATENATE(A1:A3).
If at least one of the CONCATENATE function's arguments is invalid, the formula returns
a #VALUE! error.
"&" operator to concatenate strings in Excel
In Microsoft Excel, & operator is another way to concatenate cells. This method come in very
handy in many scenarios because typing the ampersand sign (&) is much quicker than typing
the word "concatenate" :)
Similarly to the CONCATENATE function, you can use "&" in Excel to combine different text
strings, cell values and results returned by other functions.
Excel "&" formula examples
To see the concatenation operator in action, let's re-write the CONCATENATE formulas
discussed above:
Concatenate the values in A1 and B1:
=A1&B1
Concatenate the values in A1 and B1 separated with a space:
=A1&" "&B1
Concatenate the values in A1, B1 and a text string:
=A1 & B1 & " completed"
Concatenate a string and the result of the TEXT / TODAY function:
="Today is " & TEXT(TODAY(), "dd-mmm-yy")

As demonstrated in the screenshot below, the CONCATENATE function and "&" operator return
identical results:

Excel "&" operator vs. CONCATENATE function


Many users wonder which is a more efficient way to concatenate strings in Excel CONCATENATE function or "&" operator.
The only essential difference between CONCATENATE and "&" operator is the 255 strings limit
of the Excel CONCATENATE function and no such limitations when using the ampersand. Other
than that, there is no difference between these two concatenation methods, nor is there any
speed difference between the CONCATENATE and "&" formulas.
And since 255 is a really big number and in real-life tasks someone will hardly ever need to
combine that many strings, the difference boils down to the comfort and ease of use. Some
users find CONCATENATE formulas easier to read, I personally prefer using the "&" method.
So, simply stick to the concatenation technique that you feel more comfortable with.
Concatenate cells with a space, comma and other characters
In your worksheets, you may often need to join values in a way that includes commas, spaces,
various punctuation marks or other characters such as a hyphen or slash. To do this, simply
include the character you want in your concatenation formula. Remember to enclose that
character in quotation marks, as demonstrated in the following examples.
Concatenating two cells with a space:
=CONCATENATE(A1, " ", B1) or =A1 & " " & B1
Concatenating two cells with a comma:
=CONCATENATE(A1, ", ", B1) or =A1 & ", " & B1
Concatenating two cells with a hyphen:

=CONCATENATE(A1, "-", B1) or =A1 & "-" & B1


The following screenshot demonstrates how the results may look like:

Concatenate text strings with line breaks


Most often, you would separate the concatenated text strings with punctuation marks and
spaces, as shown in the previous example. In some cases, however, may need to separate the
values with a line break, or carriage return. A common example is merging mailing addresses
from data in separate columns.
A problem is that you cannot simply type a line break in the formula like a usual character, and
therefore a special CHAR function is needed to supply the corresponding ASCII code to the
concatenation formula:

On Windows, use CHAR(10) where 10 is the ASCII code for Line feed.
On the Mac system, use CHAR(13) where 13 is the ASCII code for Carriage return.
In this example, we have the address pieces in columns A through F, and we are putting them
together in column G by using the concatenation operator "&". The merged values are
separated with a comma (", "), space (" ") and a line break CHAR(10):

=A2 & " " & B2 & CHAR(10) & C2 & CHAR(10) & D2 & ", " & E2 & " " & F2

Note. When using line breaks to separate the concatenated values, you must have the "Wrap
text" option enabled for the result to display correctly. To do this, press Ctrl + 1 to open
theFormat Cells dialog, switch to the Alignment tab and check the Wrap text box.
In the same manner, you can separate concatenated strings with other characters such as:

Double quotes (") - CHAR(34)


Forward slash (/) - CHAR(47)
Asterisk (*) - CHAR (42)
The full list of ASCII codes is available
Though, an easier way to include printable characters in the concatenation formula is to simply
type them in double quotes as we did in the previous example.
Either way, all four of the below formulas yield identical results:
=A1 & CHAR(47) & B1
=A1 & "/" & B1
=CONCATENATE(A1, CHAR(47), B1)
=CONCATENATE(A1, "/", B1)

How to concatenate columns in Excel


In order to concatenate two or more columns in Excel, you just enter a usual concatenation
formula in the first cell, and then copy it down to other cells by dragging the fill handle (the small
square that appears in the lower right hand corner of the selected cell).
For example, to concatenate two columns (column A and B) separating the values with a space,
you enter the following formula in cell C2, and then copy it down to other cells. When you are
dragging the fill handle to copy the formula, the mouse pointer changes to a cross, as shown in
the screenshot below:

Tip. A quick way to copy the formula down to other cells in the column is to select the cell with
the formula and double-click the fill handle.
Please note that Microsoft Excel determines how far to copy cells after the fill handle double
click based on the cells referred to by your formula. If there happen to be empty cells in your
table, say cell A6 and B6 were blank in this example, the formula would be copied up to row 5
only. In this case, you would need to drag the fill handle down manually to concatenate the
entire columns.
An alternative way to concatenate columns in Excel is to use the corresponding option of
theMerge Cells add-in.

How to concatenate a range of cells in Excel


Combining values from multiple cells might take some effort because the Excel CONCATENATE
function does not accept arrays and requires a single cell reference in each argument.
To concatenate several cells, say A1 to A4, you need either of the following formulas:
=CONCATENATE(A1, A2, A3, A4)
or
=A1 & A2 & A3 & A4
When joining a fairly small range, it's no big deal to enter all the references in the formula bar. A
large range would be tedious to add, typing each cell reference manually. Below you will find 3
methods of quick range concatenation in Excel.
Method 1. Press CTRL to select multiple cells to be concatenated
To quickly select several cells, you can press the CTRL key and click on each cell you want to
include in the CONCATENATE formula. Here are the detailed steps:

Select a cell where you want to enter the formula.


Type =CONCATENATE( in that cell or in the formula bar.
Press and hold CTRL and click on each cell you want to concatenate.
Release the CTRL button, type the closing parenthesis in the formula bar and press
Enter.

Note. When using this method you must click each individual cell. Selecting a range with the
mouse would add an array to the formula, which the CONCATENATE function does not accept.

Method 2. Use the TRANSPOSE function to get the range


When you need to concatenate a huge range consisting of tens or hundreds of cells, the
previous method is not fast enough because it requires clicking on each cell. In this case, a
better way is to use the TRANSPOSE function to return an array, and then replace it with
individual cell references in one fell swoop.

Select the cell where you want to output the concatenated range.
Enter the TRANSPOSE formula in that cell, =TRANSPOSE(A1:A10) in this example.
In the formula bar, press F9 to replace the formula with calculated values.
Delete the curly braces that turn a usual Excel formula into an array formula. As a result,
you will have all the cells references to be included in your concatenation formula.

Type =CONCATENATE( in front of the cell references in the formula bar, type the closing
parenthesis and press Enter.

Note. Whichever method you use, the concatenated value in C1 is a text string (notice its leftalignment in the cell), although each of the original values is a number. This is because the
CONCATENATE function always returns a text string regardless of the source data type.
Method 3. Use the Merge Cells add-in
A quick and formula-free way to concatenate any range in Excel is to use the Merge Cells addin for Excel with the "Merge all areas in selection" option turned off, as demonstrated
in Combine the values of several cells into one cell.
Concatenate numbers and dates in various formats
When you concatenate a text string with a number or date, you may want to format the result
differently depending on your dataset. To do this, embed the TEXT function in your Excel
concatenate formula.
The TEXT(value, format_text) function has two arguments:

In the first argument (value), you supply a number or date to be converted to text, or a
reference to the cell containing a numeric value.
In the second argument (format_text), you enter the desired format using the codes that
the TEXT function can understand.
We have already discussed one such formula in the beginning of this tutorial
- CONCATENATE / TEXT formula that returns the current date concatenated with a text string.
A few more formula examples that concatenate a text value and a number follow below:
=A2 & " " & TEXT(B2, "$#,#0.00") - display the number with 2 decimal places and the $ sign.
=A2 & " " & TEXT(B2, "0.#") - does not display extra zeros and the $ sign.
=A2 & " " & TEXT(B2, "# ?/???") - display the number as a fraction.

How to split cells (opposite of CONCATENATE in Excel)


If you are looking for the opposite of CONCATENATE in Excel, i.e. you want to split one cell into
several cells, a few options are available to you:

Text to Columns feature


Flash Fill option in Excel 2013 and 2016
Formulas (MID, RIGHT, LEFT functions)
You can find the detailed steps illustrated with formula examples and screenshots in the How to
split cells in Excel tutorial.
Merge Cells add-in - formula-free way to concatenate cells in Excel
With the Merge Cells add-in for Excel, you can efficiently do both:

Merge several cells into one without losing data.


Concatenate the values of several cells into a single cell and separate them with any
delimiter of your choosing.
The Merge Cells tool works with all Excel versions from 2003 to 2016 and can combine all data
types including text strings, numbers, dates and special symbols. Its two key advantages are
simplicity and speed - any concatenation is done in a couple of clicks. And now, let me show it
to you in action.
Combine the values of several cells into one cell
To combine the contents of several cells, you select the range to concatenate and configure the
following settings:

Cells into one under "What to merge";


Select the delimiter you want under "Separate values with", it's a comma and a space in
this example;
Choose where you want to place the result, and most importantly
Uncheck the "Merge all areas in the selection" option. It is this option that determines
whether the cells are merged or the cells' values are concatenated.

Combine columns row-by-row


To concatenate two or more columns, you configure the Merge Cells' settings in a similar way,
but choose Columns under "What to merge":

Join rows column-by-column


To combine data in each individual row, column-by-column, you choose to merge Rows, select
the delimiter you want (line break in this example), configure other settings the way you want

and hit the Merge button. The result may look similar to this:

To check how the Merge Cells add-in will cope with your data sets, you are welcome
to download a fully functional trial version. And if you are happy with the result, you may want to
buy helpful tool as a separate product or as part of our Ultimate Suite for Excel, which includes
40+ other time-saving tools for most common Excel tasks. Either way, we will happily offer you
the 15 off coupon code that we've created especially for our blog readers: AB14-BlogSpo.
If someone wants to examine the formulas discussed in this tutorial more closely, the Sample
workbook with concatenation formulas is available for download. Thank you for reading!

How to convert time to decimal number, hours, minutes or seconds in Excel


The tutorial demonstrates different ways to convert time to decimal in Excel. You will find a
variety of formulas to change time to hours, minutes or seconds as well as convert text to time
and vice versa.
Because Microsoft Excel uses a numeric system to store times, you can easily turn hours,
minutes and seconds into numbers that you can use in other calculations.
In general, there are two ways to convert time to decimal in Excel - by changing the cell format
and by using arithmetic calculations or Excel time functions, such as HOUR, MINUTE and
SECOND. Further on in this tutorial, you will find the detailed explanation of the first way and
formula examples demonstrating the other technique.

o
o
o

Convert time to decimal by changing the cell's format


Functions and calculations to convert time to number
Converting Excel time to hours
Convert time to minutes in Excel
Converting time to seconds in Excel
Split date and time into separate columns
Spell time (XX days, XX hours, XX minutes, and XX seconds)
Convert text to time using TIMEVALUE function
Convert time to text
Convert time to decimal number by changing the cell's format
If you are looking to convert time to a decimal number that represents the time in the internal
Excel system, the fastest way is to change the cell's format from Time to
either General or Number.
1.

Select a cell, a range of cells, or an entire column, and press Ctrl + 1 to open the Format
Cellsdialog. Alternatively, you can right click the cell(s) and select Format Cells from the
context menu.
2.
On the Number tab of the Format Cells window, switch to
either General or Number underCategory, and then click the OK button to convert the time

to a decimal and close the window.

Note. In Microsoft Excel system, times are stored as fractional parts of decimal numbers, that is
why the integer part of the converted time always equals 0, like demonstrated in the screenshot
above. If in your worksheet, the integer part is any number other than zero, it means that your
cells contain both dates and times.
To do the opposite, i.e. to convert a decimal to time in Excel, simply apply one of time formats
to the cell(s).
Functions and calculations to convert time to hours, minutes or seconds
In Microsoft Excel, to convert time to a total number of hours, minutes or seconds, you can use
either:

Simple arithmetic calculations, i.e. multiply the time value by the number of hours,
minutes or seconds in one day, or
Time functions, such as HOUR, MINUTE and SECOND.
Converting time to hours in Excel
The simplest arithmetic calculation to convert time to hours in Excel is multiplying time by 24,
i.e. by the number of hours in one day:

=A2*24 (where A2 is the time value)


If you are setting up a worksheet with time calculations and you don't quite rely on your users'
understanding of the Excel time system, then you can employ the HOUR, MINUTE and
SECOND functions to extract the corresponding time units. To convert the returned values to
hours, you divide minutes by 60 (the number of minutes in one hour) and seconds by 360 (the
number of seconds in an hour).
=HOUR(A2) + MINUTE(A2)/60 + SECOND(A2)/360
For example, if a cell contains the time value of 6:30 AM, both formulas will return 6.5 because 6
hours and 30 minutes is equal to 6.5 hours.
To get the number of compete hours, wrap the above formula in the INT function to cast away
the fractional part:
=INT(A2*24)
The following screenshot demonstrates the results returned by the above formulas:

Converting time to minutes in Excel


In order to convert time to total minutes, you multiply time by 1440, which is the number of
minutes in one day (24 hours * 60 minutes = 1440):
=A2*1440
The same result can be achieved by using the following formula:
=HOUR(A2)*60 + MINUTE(A2) + SECOND(A2)/60
Where you multiply hours by 60 and divide seconds by the same number in order to convert
them to minutes.

For example, if A2 contains "1:15:00", both formulas will return 75 because 1 hour and 15
minutes equates to 75 minutes.
If what you want is the number of compete minutes, use the INT function like in the previous
example:
=INT(A2*1440)
You can view the results in the screenshot below:

Convert time to seconds in Excel


Converting time to total seconds is done in the same fashion - you multiply the time value by
86400, which is the number of seconds in a day (24 hours * 60 minutes * 60 seconds = 86400):
=A2*86400
Or, you can use the HOUR, MINUTE and SECOND functions like in the two previous examples
(I believe at this point you don't need any further explanation of the formula's logic :)
=HOUR(A2)*3600 + MINUTE(A2)*60 + SECOND(A2)

Tip. If any of the above formulas returns a value formatted as time, simply change the cell's
format to General to display it as a number.

How to split date and time in Excel


As is often the case, your Excel worksheet may contain dates and times in one cell, while you
want to split them into two separate cells.
Remembering that in the internal Excel system the date value is stored as a whole part and the
time value as a fractional part of a decimal number, you can extract the date using the INT
function, which rounds the cell value down to the nearest integer.
Supposing your original dates and times are in column A, the following formula will accomplish
the separation:
=INT(A2)

To extract the time portion, subtract the date returned by the above formula from the original
date and time value:
=A2-B2
Where column A contains the original date & time values and column B contains the dates
returned by the INT function.
If you'd rather not have time values linked to the separated dates (for example, you may want to
remove the date column in the future), you can use the following MOD formula that refers to the
original data only:
=MOD(A2,1)

Tip. If the separated date and time values are not displayed properly, change the format of the
new columns to Date and Time, respectively.
This is how you split date and time in Excel. If you want to further separate hours, minutes and
seconds into individual columns, then use the HOUR, MINUTE and SECOND functions, as
demonstrated in How to get hours, minutes and seconds from a timestamp.
How to spell time in Excel
Sometimes, you may need to convert time into the format that reads something like "# days, #
hours, # minutes and # seconds". A good thing is that you already know all the ingredients of the
formula:

Extract days using the INT function;


Extract time units with HOUR, MINUTE and SECOND functions, and
Concatenate all parts in a single formula.
Having difficulties with figuring out a proper formula for your worksheet? The following example
will make things easy!
Supposing you have the dates of upcoming events in column B beginning in cell B4, and the
current date and time returned by the NOW() function in cell B1.
The formula to calculate the time difference is as simple as =B4-$B$1. Of course, nothing
prevents you from subtracting the current date and time directly with =B4-NOW().
And now, let's make a countdown timer that would show how many days, hours, minutes and
seconds are left until each event.

The formula to enter in cell D4 is as follows:

=INT(C4) & " days, " & HOUR(C4) & " hours, " & MINUTE(C4) & " minutes and " &
SECOND(C4) & " seconds"

If you wish to get rid of 0 values, like in cells D6 and D7 in the screenshot above, then include
the following IF statements:
=IF(INT(C4)>0, INT(C4)&" days, ","") & IF(HOUR(C4)>0, HOUR(C4) & " hours, ","") &
IF(MINUTE(C4)>0, MINUTE(C4) & " minutes and ","") & IF(SECOND(C4)>0, SECOND(C4) &
" seconds","")
All zeros are gone!

Note. When either of the above formulas refers to a negative number, the #NUM! error will
appear. This may happen when you subtract a bigger time from a smaller one.

An alternative way to write time in words in Excel is to apply the following custom time format to
the cell: d "day," h "hours," m "minutes and" s "seconds". No formulas and no calculations are
required! For more information, please see Creating a custom time format in Excel.
Convert text to time in Excel
If your time formulas and calculations do not work right, time values formatted as text is often
the cause. The fastest way to convert text to time in Excel is using the TIMEVALUE function.
The Excel TIMEVALUE function has just one argument:
TIMEVALUE(time_text)
Time_text is a text string in any of the time formats that Excel can recognize. For example:
=TIMEVALUE("6:20 PM")
=TIMEVALUE("6-Jan-2015 6:20 PM")
=TIMEVALUE(A2) where A2 contains a text string

As you see, the formulas with cell references and corresponding text strings deliver identical
results. Also, please notice the left alignment of time strings (text values) in cells A2 and A6 and
right-aligned converted time values in column D.
Convert time to text in Excel
Supposing you have an Excel file full of times formatted to look like "8:30:00 AM" and you want
to convert them to the text format. Simply changing the cell's format to TEXT won't work
because this would change your time values to underlying numeric representation of the time.
For example, 8:30:00 AM will be converted to decimal 0.354166666666667.
So, how do you convert cells to the text format so that your cells still have the time in them? The
answer is to use the TEXT function that converts a numeric value to text with the display
formatting that you specify, for example:

=TEXT($A2,"h:mm:ss")
The screenshot below demonstrates other possible formats:

That's all for today. If someone wants to get the first-hand experience with the formulas
discussed in this article, you are most welcome to download the Sample workbook for
converting time in Excel.
If you want to learn a few more helpful formulas to add and subtract times, calculate elapsed
time and time difference, please check out other parts of our Excel Times tutorial (the links are
available at the end of this page). I thank you for reading and hope to see you again next week.

How to calculate time in Excel - time difference, adding / subtracting times


This tutorial focuses on various ways to calculate times in Excel. You will find a few useful
formulas to add and subtract times, calculate time difference, or elapsed time, and more.
In the last week's article, we had a close look at the specificities of Excel time format and
capabilities of basic time functions. Today, we are going to dive deeper into Excel time
calculations and you will learn a few more formulas to efficiently manipulate times in your
worksheets.

Calculating time difference in Excel (elapsed time)


Adding or subtracting hours, minutes and seconds to a time
How to sum several times in Excel
How to calculate time difference in Excel (elapsed time)
To begin with, let's see how you can quickly calculate elapsed time in Excel, i.e. find the
difference between a beginning time and an ending time. And as is often the case, there is more
than one formula to perform time calculations. Which one to choose depends on your dataset
and exactly what result you are trying to achieve. So, let's run through all methods, one at a
time.
Formula 1. Subtract one time from the other
As you probably know, times in Excel are usual decimal numbers formatted to look like times.
And because they are numbers, you can add and subtract times just as any other numerical
values.
The simplest and most obvious Excel formula to calculate time difference is this:
=End time - Start time
Depending on you data structure, the actual time difference formula may take various shapes,
for example:
Formula

Explanation

=A2-B2

Calculates the difference between the time


values in cells A2 and B2.

=TIMEVALUE("8:30 PM") TIMEVALUE("6:40 AM")

Calculates the difference between the specified


times.

=TIME(HOUR(A2), MINUTE(A2),
SECOND(A2)) - TIME(HOUR(B2),
MINUTE(B2), SECOND(B2))

Calculates the time difference between values in


cells A2 and B2 ignoring the date difference,
when the cells contain both the date and time
values.

Remembering that in the internal Excel system, times are represented by fractional parts of
decimal numbers, you are likely to get the results similar to this:

The decimals in column D are perfectly true but not very meaningful. To make them more
informative, you can apply custom time formatting with one of the following codes:
Time code

Explanation

Elapsed hours, display as 4.

h:mm

Elapsed hours and minutes, display as 4:10.

h:mm:ss

Elapsed hours, minutes and seconds, display as 4:10:20.

To apply the custom time format, click Ctrl + 1 to open the Format Cells dialog,
select Customfrom the Category list and type the time codes in the Type box. Please
see Creating a custom time format in Excel for the detailed steps.
And now, let's see how our time difference formula and time codes work in real worksheets.
WithStart times residing in column A and End times in column B, you can copy the following
formula in columns C though E:
=$B2-$A2
The elapsed time is displayed differently depending on the time format applied to the column:

Note. If the elapsed time is displayed as hash marks (#####), then either a cell with the formula
is not wide enough to fit the time or the result of your time calculations is a negative value.

Formula 2. Calculating time difference with the TEXT function


Another simple technique to calculate time difference in Excel is using the TEXT function:

Calculate hours between two times: =TEXT(B2-A2, "h")


Return hours and minutes between 2 times: =TEXT(B2-A2, "h:mm")
Return hours, minutes and seconds between 2 times: =TEXT(B2-A2, "h:mm:ss")

Notes:

The value returned by the TEXT function is always text. Please notice the left alignment
of text values in columns C:E in the screenshot above. In certain scenarios, this might be a
significant limitation because you won't be able to use the returned "text times" in other
calculations.
If the result is a negative number, the TEXT formula returns the #VALUE! error.
Formula 3. Count hours, minutes or seconds between two times
To present the difference between two times in a single time unit (hours ,minutes or seconds),
you can perform the following calculations.
Calculate hours between two times:
The logic of the below formula is obvious and hardly requires any explanation :)
=(End time - Start time) * 24
Supposing that your start time is in A2 and end time in B2, you can use a simple equation B2-A2
to calculate the difference between two times, and then multiply it by 24, which is the number of
hours in one day:
=(B2-A2) * 24
To get the number of complete hours, use the INT function to round the result down to the
nearest integer:

=INT((B2-A2) * 24)

Total minutes between two times:


To calculate the minutes between two times, multiply the time difference by 1440, which is the
number of minutes in one day (24 hours * 60 minutes = 1440).
=(End time - Start time) * 1440
As demonstrated in the following screenshot, the formula can return both positive and negative
values, the latter occur when the end time is greater than the start time, like in row 5:
=(B2-A2)*1440

Total seconds between times:


To get the total seconds between two times, you multiply the time difference by 86400, which is
the number of seconds in one day (24 hours * 60 minutes * 60 seconds = 86400).
=(End time - Start time) * 86400
In our example, the formula is as follows:

=(B2-A2)* 86400

Note. For the results to display correctly, the General format should be applied to the cells with
your time difference formula.
Formula 4. Calculate difference in one time unit ignoring others
To find the difference between 2 times in a certain time unit, ignoring the others, use one of the
following functions.

Difference in hours, ignoring minutes and seconds:


=HOUR(B2-A2)

Difference in minutes, ignoring hours and seconds:


=MINUTE(B2-A2)

Difference in seconds, ignoring hours and minutes:


=SECOND(B2-A2)
When using Excel's HOUR, MINUTE and SECOND functions, please remember that the result
cannot exceed 24 for hours and 60 for minutes and seconds.

Note. If the end time is greater than the start time (i.e. the result of the formula is a negative
number), the #NUM! error is returned.

Formula 4. Calculate elapsed time from a start time to now


In order to calculate how much time has elapsed since the start time to now, you simply use
theNOW function to return today's date and the current time, and then subtract the start date
and time from it.
Supposing that the beginning date and time is in call A2, the formula =NOW()-A2 returns the
following results, provided you've applied an appropriate time format to column B, h:mm in this
example:

In case the elapsed time exceeds 24 hours, use one of these time formats, for example d
"days" h:mm:ss like in the following screenshot:

If your starting points contain only time values without dates, you need to use the TIME
functionto calculate the elapsed time correctly. For example, the following formula returns the
time elapsed since the time value in cell A2 up to now:

=TIME(HOUR(NOW()), MINUTE(NOW()), SECOND(NOW())) - A2

Note. The elapsed time is not updated in real-time, it refreshes only when the workbook is
reopened or recalculated. To force the formula to update, press either Shift + F9 to recalculate
the active spreadsheet or hit F9 to recalculate all open workbooks.
Formula 5. Display time difference as "XX days, XX hours, XX minutes and XX seconds"
This is probably the most user-friendly formula to calculate time difference in Excel. You use the
HOUR, MINUTE and SECOND functions to return corresponding time units and the INT
function to compute the difference in days. And then, you concatenate all these functions in a
single formula along with the text labels:
=INT(B2-A2) & " days, " & HOUR(B2-A2) & " hours, " & MINUTE(B2-A2) & " minutes and "
& SECOND(B2-A2) & " seconds"

To instruct your Excel time difference formula to hide zero values, embed four IF functions into
it:
=IF(INT(B2-A2)>0, INT(B2-A2) & " days, ","") & IF(HOUR(B2-A2)>0, HOUR(B2-A2) & "
hours, ","") & IF(MINUTE(B2-A2)>0, MINUTE(B2-A2) & " minutes and ","") &
IF(SECOND(B2-A2)>0, SECOND(B2-A2) & " seconds","")
The syntax may seem excessively complicated, but it works :)

Alternatively, you can calculate time difference by simply subtracting the start time from the end
time (e.g. =B2-A2), and then apply the following time format to the cell:

d "days," h "hours," m "minutes and" s "seconds"

An advantage of this approach is that your result would be a normal time value that you could
use in other time calculations, while the result of the complex formula discussed above is a text
value. A drawback is that the custom time format cannot distinguish between zero and non-zero
values and ignore the latter. To display the result in other formats, please see Custom formats
for time intervals over 24 hours.
Adding and subtracting time in Excel
Basically, there are 2 ways to add and subtract time in Excel:

Using the TIME function

Using arithmetic calculations based on the number of hours (24), minutes (1440) and
seconds (86400) in one day
The TIME(hour, minute, second) function makes Excel time calculations really easy, however
it does not allow adding or subtracting more than 23 hours, or 59 minutes, or 59 seconds. If you
are working with bigger time intervals, then use one of the arithmetic calculations demonstrated
below.
How to add or subtract hours to time in Excel
To add hours to a given time in Excel, you can use one the following formulas.
TIME function to add under 24 hours
=Start time + TIME(N hours, 0, 0)
For example, if your start time is in cell A2, and you want to add 2 hours to it, the formula is as
follows:
=A2 + TIME(2, 0, 0)

Note. If you try adding more than 23 hours with the TIME function, the specified hours will be
divided by 24 and the remainder will be added to the start time value. For example, if you try to
add 25 hours to "6/2/2015 10:00 AM" (cell A4) using the formula =A4 + TIME(25, 0, 0), the result
will be "06/02/2015 11:00", i.e. A4 + 1 hour.
Universal formula to add any number of hours
The following formula has no limitations to the number of hours you want to add:
= Start time + (N hours / 24)
For example, to add 28 hours to the start time in cell A2, enter the following formula:
=A2 + (28/24)

To subtract hours from a given time, you use analogous formulas, and just replace "+" with the
minus sign:
For example, to subtract 3 hours from the time in cell A2, either of the following formulas will do:
=A2-(3/24)
=A2-TIME(3,0,0)
To subtract more than 23 hours, use the first one.
How to add / subtract minutes to time in Excel
To add minutes to a given time, employ the same techniques that we've just used for adding
hours.
To add or subtract under 60 minutes
Use the TIME function and supply the minutes you want to add or subtract in the second
argument:
=Start time + TIME(0, N minutes, 0)
And here are a couple of real-life formulas to calculate minutes in Excel:
To add 20 minutes to the time in A2: =A2 + TIME(0,20,0)
To subtract 30 minutes from the time in A2: =A2 - TIME(0,30,0)
To add or subtract any number of minutes
In your calculation, divide the number of minutes by 1440, which is the number of minutes in a
day, and add the quotient to the start time:
=Start time + (N minutes / 1440)
To subtract minutes from time, simply replace plus with the minus sign. For example:

To add 200 minutes: =A2 + (200/1440)


To subtract 300 minutes: =A2 -(300/1440)

How to add / subtract seconds to a given time


Second calculations in Excel are done in a similar fashion.
To add under 60 seconds to a given time, you can use the TIME function:
=Start time + TIME(0, 0, N seconds)
To add more than 59 seconds, use the following formula:
=Start time + (N seconds / 86400)
To subtract seconds, utilize the same formulas with the minus sign (-) instead of plus (+).
In your Excel worksheets, the formulas may look similar to these:
To add 30 seconds to A2: =A2 + TIME(0,0,31)
To add 1200 seconds to A2: =A2 + (1200/86400)
To subtract 40 seconds from A2: =A2 - TIME(0,0,40)
To subtract 900 seconds from A2: =A2 - (900/86400)
How to sum time in Excel
The Excel sum time formula is the usual SUM function, and applying the proper time format to
the result is what makes a trick.

Supposing you have a few project times in column B and you want to add them up. You write a
simple SUM formula like =SUM(B2:B4) and get the result in the default format, like hh:mm:ss.

In some cases the default time format works just fine, but sometimes you may want more, for
example to display the total time as minutes and seconds, or seconds only. The good news is
that no other calculations are required, all you have to do is apply custom time format to the cell
with the SUM formula.
Right click the cell and select Format Cells in the context menu, or press Ctrl + 1 to open
theFormat Cells dialog box. Select Custom from the Category list and type one of the following
time formats in the Type box:

To display total time as minutes and seconds: [m]:ss


To display total time as seconds: [ss]
The result will look as follows:

How to sum over 24 hours in Excel


In order to add up more than 24 hours, you use the same SUM formula as discussed above,
and apply one of the following time formats to the cell:
Format

Displays as

Explanation

[h]:mm

30:10

Hours and minutes

[h]:mm:ss

30:10:20

[h] "hours", mm "minutes", ss


"seconds"

30 hours, 10 minutes, 20
seconds

d h:mm:ss

1 06:10:20

d "day" h:mm:ss

1 day 06:10:20

d "day," h "hours," m "minutes


and" s "seconds"

1 day, 6 hours, 10 minutes


and 20 seconds

Hours, minutes and


seconds

Days, hours, minutes and


seconds

To see how these custom time formats may look like in your Excel worksheet, please have a
look at the screenshot below, where the same SUM formula is entered in cells A9 to A13:
=SUM($B$2:$B$4)

Note. The custom time formats discussed above work for positive values only. If the result of
your time calculations is a negative number, e.g. when you are subtracting a bigger time from a
smaller time, the result will be displayed as #####. To display negative times differently, please
see custom format for negative time values.
Also, please keep in mind that the time format applied to a cell changes only the display
presentation without changing the cell's value. For example, in the screenshot above, cell A13
looks like text, but in fact it's a usual time value, which is stored as a decimal in the internal
Excel system. What it means for you is that you are free to refer to that cell in other formulas
and calculations.

This is how you calculate time in Excel worksheets. I hope the time formulas discussed in this
article have proved useful for your tasks (you can download the Sample workbook with time
calculations to have a closer look). If not, I encourage you to check other parts to our
comprehensive tutorial to working with dates and times in Excel.

Excel time format & how to use NOW and TIME functions to insert time
In this tutorial, you will learn the specificities of Excel time format as well as how to add a
timestamp using shortcuts or insert an auto updatable time with the NOW function. You will also
learn how to apply special Excel time functions to get hours, minutes or seconds from a time
stamp.
Microsoft Excel has a number of helpful time features and knowing them a little in depth can
save you a lot of time. Using special functions, you can insert the current date and time
anywhere in a worksheet, convert time to a decimal number, sum different time units or
calculate the elapsed time.
To be able to leverage powerful Excel time functions, it helps to know how Microsoft Excel
stores times. So, before digging deeper into the formulas, let's invest a couple of minutes in
learning the basics of the Excel time format.

o
o
o
o

o
o
o
o

Excel time format


Get a decimal number representing time
Apply or change the time format in Excel
Create a custom time format
Excel's default time format
Insert dynamic time and static timestamp in Excel
Shortcuts to add a timestamp
NOW function to insert current date and time
Insert current time only (auto updatable)
TIME function to insert a specified time
Get hours, minutes and seconds from a timestamp
Excel time format
If you have been following our Excel Dates tutorial, you know that Microsoft Excel stores dates
as sequential numbers beginning with January 1, 1900, which is stored as number 1. Because
Excel treats time as a portion of a day, times are stored as decimal fractions.
In Excel's internal system:

00:00:00 is stored as 0.0


23:59:59 is stored as 0.99999
06:00 AM is 0.25
12:00 PM is 0.5
When both a date and time are entered in a cell, they are stored as a decimal number
comprised of an integer representing the date and a decimal portion representing the time. For
example, 1 June 2015 9:30:00 AM is stored as 42156.3958333333.

How to get a decimal representing time in Excel


A quick way to pick a decimal number representing a certain time is to use the Format
Cellsdialog.
Simply select a cell containing the time and press Ctrl + 1 to open the Format Cells dialog box.
On the Number tab, select General under Category, and you will see the decimal in
the Sample box.

Now, you can write down that number and click Cancel to close the window. Or, you can click
theOK button and have the time replaced with a corresponding decimal number in the cell. In
fact, you can think of it as the fastest, easiest and formula-free way to convert time to
decimal in Excel. In the next part of our Excel Time tutorial, we'll take a closer look at special
time functions and calculations to convert time to hours, minutes or seconds.
How to apply or change the time format in Excel
Microsoft Excel is smart enough to recognize a time as you type and format the cell accordingly.
For example, if you type 20:30, or 8:30 PM, or even 8:30 p in a cell, Excel will interpret this as a
time and display either 20:30 or 8:30 PM, depending on your default time format.

If you want to format some numbers as times or apply a different time format to existing time
values, you can do this by using the Format Cells dialog, as demonstrated below.
1.
2.

In an Excel sheet, select the cell(s) where you want to apply or change the time format.
Open the Format Cells dialog either by pressing Ctrl + 1 or by clicking the Dialog Box
Launchericon next to Number in the Number group, on the Home tab.

3.

On the Number tab, select Time from the Category list, and choose the desired time
format from the Type list.
4.
Click OK to apply the selected time format and close the dialog box.

Creating a custom Excel time format


Though Microsoft Excel provides a handful of different time formats, you may want to create
your own one that fits the best for a particular sheet. To do this, open the Format Cells dialog
box, selectCustom from the Category list and type the time format you want to apply in
the Type box.

The custom time format you've created will be in the Type list the next time you need it.
Tip. The easiest way to create a custom time format in Excel is to use one of the existing
formats as a starting point. For this, click Time in the Category list, and select one of the
predefined formats under Type. After that switch to Custom and make the changes to the format
displayed in the Type box.
When creating a custom time format in Excel, you can use the following codes.
Code

Description

Displays as

Hours without a leading zero

0-23

hh

Hours with a leading zero

00-23

Minutes without a leading zero

0-59

mm

Minutes with a leading zero

00-59

Seconds without a leading zero

0-59

ss

Seconds with a leading zero

00-59

AM/PM

Periods of the day


(if omitted, 24-hour time format is
used)

AM or PM

Tip. To create custom formatting for dates and time, use various combinations of time codes
and date codes.
The following table provides a few example of how your Excel time formats may look like:
Format

Displays as

h:mm:ss AM/PM

1:30:00 PM

h:mm

13:30

dddd, m/d/yy h:mm AM/PM

Tuesday, 1/13/15 1:30 PM

ddd, mmmm dd, yyyy hh:mm:ss

Tue, January 13, 2015 13:30:00

Custom formats for time intervals over 24 hours


When you are calculating times in Excel, a cell containing the sum of time amounts may exceed
24 hours. To get Microsoft Excel to display times beyond 24 hours correctly, apply one of the
following custom time formats.
Format

Displays as

Explanation

[h]:mm

41:30

41 hours and 30 minutes

[h]:mm:ss

41:30:10

[h] "hours", mm "minutes", ss


"seconds"

40 hours, 30 minutes, 10
seconds

d h:mm:ss

1 17:30:10

d "day" h:mm:ss

1 day 17:30:10

d "day," h "hours," m "minutes


and" s "seconds"

1 day, 17 hours, 30
minutes and 10 seconds

41 hours, 30 minutes and 10


seconds

1 day, 17 hours, 30 minutes


and 10 seconds

Custom formats for negative time values


The custom time formats discussed above work for positive values only. If the result of your
calculations is a negative number formatted as time (e.g. when you subtract a bigger time
amount from a smaller one), the result will be displayed as #####. If you want to format negative
time values differently, the following options are available to you:

Display an empty cell for negative times. Type a semicolon at the end of the time format,
for example [h]:mm;
Display an error message. Type a semicolon at the end of the time format, and then type
a message in quotation marks, e.g. [h]:mm;"Negative time"

Generally speaking, a semicolon acts as a delimiter to separate positive values' format from
negative values' formatting.
The default time format in Excel
When changing the time format in the Format Cells dialog, you may have noticed that one of the
formats begins with an asterisk (*). This is the default time format in your Excel.

To quickly apply the default Excel time format to the selected cell or a range of cells, click the
drop-down arrow in the Number group, on the Home tab, and select Time.

To change the default time format, go to the Control Panel and click Region and Language. If
in your Control panel opens in Category view, click Clock, Language, and Region > Region and
Language> Change the date, time, or number format.

Note. When creating a new Excel time format or modifying an existing one, please remember
that regardless of how you've chosen to display time in a cell, Excel always internally stores
times the same way - as decimal numbers.
How to insert time and a timestamp in Excel
There are a numbers of ways to insert time in Excel, which one to use depends on whether you
want a static timestamp or a dynamic value that updates automatically to reflect the current
time.

Adding a static timestamp with shortcuts


Insert current date and time using NOW function (dynamic value)
Insert current time only (dynamic value)
Insert time using Excel TIME function

Add time stamp using shortcuts


If you are looking for a way to insert a timestamp in an Excel cell, i.e. a static value that won't
automatically update whenever a workbook is recalculated, then use one of the following
shortcuts:

To insert the current time, press Ctrl + Shift + ;


To enter the current date and time, press Ctrl + ; which inserts a date, then press
the Spacekey, and then hit Ctrl + Shift + ; to insert the current time.

Add today's date and current time using NOW function


If you aim to insert the current date and time as a dynamic value that refreshes automatically,
then use the Excel NOW function.
The formula is as simple as it can possibly be, no arguments are required:
=NOW()
When using the NOW function in Excel, there are a few things to keep in mind:

The NOW function retrieves time from your computer's system clock.
NOW is one of Excel's volatile functions that cause the cell with the formula to
recalculate every time the worksheet is re-opened or recalculated.
To force the Excel NOW function to update the returned value, press either Shift + F9 to
recalculate the active worksheet or F9 to recalculate all open workbooks.
To get the NOW function to automatically update at a specified time interval, add a VBA
macro to your workbook, a few examples are available here.
Insert current time as a dynamic value
If you'd rather insert only the current time in a cell without a date, you have the following
choices:
1.

Use =NOW() formula, and then apply the time format to a cell(s).
Please remember, this will only change the display format, the actual value stored in a cell
will still be a decimal number consisting of an integer representing the date and a fractional
part representing the time.

2.

Use the following formula:


=NOW() - INT(NOW())

The INT function is used to round the decimal number returned by NOW() down to the
nearest integer. And then, you subtract the integer part representing today's date to output
only the fractional part that represents the current time.
Since the formula returns a decimal, you will need to apply the time format to the cell to
make the value display as time.
The following screenshot demonstrates both formulas in action. Pay attention that although the
formatted time values look the same (column C), the actual values stored in cells (column D)
are different - D4 contains only the fractional part:

Insert time using the Excel TIME function


The TIME function in Excel is used to convert a text string showing a time into a decimal that
represents the time.
The syntax of the Excel TIME function is very straightforward:
=TIME(hour, minute, second)
The hour, minute and second arguments can be supplied as numbers from 0 to 32767.

If hour is greater than 23, it is divided by 24 and the remainder is taken as the hour
value.
For example, TIME(30, 0, 0) equates to TIME(6,0,0), which is 0.25 or 6:00 AM.

If minute is greater than 59, it is converted to hours and minutes. And if second is
greater than 59, it is converted to hours, minutes, and seconds.
For example, TIME(0, 930, 0) is converted to TIME(15, 30, 0), which is 0.645833333 or 15:30.
The Excel TIME function is useful when it comes to merging individual values into a single time
value, for example values in other cells or returned by other Excel functions.

How to get hours, minutes and seconds from a timestamp


To extract time units from a time stamp, you can use the following Excel time functions:
HOUR(serial_number) - returns an hour of a time value, as an integer from 0 (12:00 am) to 23
(11:00 pm).
MINUTE(serial_number) - gets the minutes of a time value, as integers from 0 to 59.
SECOND(serial_number) - returns the seconds of a time value, as integers from 0 to 59.
In all three functions, you can input times as text strings enclosed in double quotes (for
example, "6:00 AM"), as decimal numbers (e.g. 0.25 that represents 6:00 AM), or as results of
other functions. A few formula examples follow below.

=HOUR(A2) - returns the hours of the timestamp in cell A1.


=MINUTE(A2) - returns the minutes of the timestamp in cell A1.
=SECOND(A2) - returns the seconds of the timestamp in cell A1.
=HOUR(NOW()) - returns the current hour.

Now that you've got down to brass tacks of the Excel time format and time functions, it will be
much easier for you to manipulate dates and times in your worksheets. In the next part of our
Excel Time tutorial, we are going to discuss different ways of converting time to numbers. I
thank you for reading and hope to see you on our blog next week!

Excel date functions - formula examples of DATE, TODAY, etc.


This is the final part of our Excel Date Tutorial that offers an overview of all Excel date functions,
explains their basic uses and provides lots of formula examples.
Microsoft Excel provides a ton of functions to work with dates and times. Each function performs
a simple operation and by combining several functions within one formula you can solve more
complex and challenging tasks.
In the previous 12 parts of our Excel dates tutorial, we have studied the main Excel date
functions in detail. In this final part, we are going to summarize the gained knowledge and
provide links to a variety the formula examples to help you find the function best suited for
calculating your dates.

The main function to calculate dates in Excel:


DATE function
Get current date and time:
TODAY - returns today's date
NOW - returns the current date and time
Convert dates to / from text:
DATEVALUE - converts a date in the text format to date format
TEXT - converts a date to a text value
Retrieve dates in Excel:
DAY - returns the day of the month
MONTH - returns the month of a specified date
YEAR - returns the year of a specified date
EOMONTH - returns the last day of the month
WEEKDAY - returns the day of the week
WEEKNUM - returns the week number of a date
Calculate date difference:
DATEDIF - returns the difference between two dates
EDATE - returns a date N months before or after the start date
YEARFRAC - calculates the fraction of the year between 2 dates
Calculate workdays:
WORKDAY - returns a date N working days in the future or in the past
WORKDAY.INTL - returns a date N weekdays from the start date with custom weekends
NETWORKDAYS - returns the number of workdays between two dates
NETWORKDAYS.INTL - returns the number of workdays between two dates with
custom weekends
Excel DATE function
DATE(year, month, day) returns a serial number of a date based on the year, month and day
values that you specify.
When it comes to working with dates in Excel, DATE is the most essential function to
understand. The point is that other Excel date functions not always can recognize dates entered
in the text format. So, when performing date calculations in Excel, you'd better supply dates
using the DATE function to ensure the correct results.

Here are a few Excel DATE formula examples:


=DATE(2015, 5, 20) - returns a serial number corresponding to 20-May-2015.
=DATE(YEAR(TODAY()), MONTH(TODAY()), 1) - returns the first day of the current year and
month.
=DATE(2015, 5, 20)-5 - subtracts 5 days from May 20, 2015.

At first sight, the Excel DATE function looks very simple, however, it does have a number of
specificities pointed out in the Excel DATE tutorial.
Below you will find a few more examples where the Excel DATE function is part of bigger
formulas:

Subtracting two dates in Excel


Adding or subtracting days to a date
How to convert week number to date
Find the first day of month
Calculate the number of days in a month
Excel TODAY function
The TODAY() function returns today's date, exactly as its name suggests.
TODAY is arguably one of the easiest Excel functions to use because it has no arguments at all.
Whenever you need to get today's date in Excel, enter the following formula is a cell:
=TODAY()
Apart from this obvious use, the Excel TODAY function can be part of more complex formulas
and calculations based on today's date. For example, to add 7 days to the current date, enter
the following formula in a cell:
=TODAY()+7
To add 30 weekdays to today's date excluding weekend days, use this one:

=WORKDAY(TODAY(), 30)

Note. The date returned by the TODAY function in Excel updates automatically when your
worksheet is recalculated to reflect the current date.
If your goal is to get a static timestamp in your Excel sheet, then use one of the following
shortcuts:

Ctrl + ; to insert the today's date in a cell.


Ctrl + Shift + ; to show the current time.
To display today's date and current time, please see Shortcuts to show current date and
time in Excel.
For more formula examples demonstrating the use of the TODAY function in Excel, please
check out the following tutorials:

How to show today's date in Excel


Convert today's date to text format
Calculate weekdays based on today's date
Add or subtract days and months to the current date
Convert date of birth to age with TODAY function
Find the 1st day of month based on today date
Excel NOW function
NOW() function returns the current date and time. As well as TODAY, it does not have any
arguments. If you wish to display today's date and current time in your worksheet, simply put the
following formula in a cell:
=NOW()
Note. As well as TODAY, Excel NOW is a volatile function that refreshes the returned value
every time the worksheet is recalculated. Please note, the cell with the NOW() formula does not
auto update in real-time, only when the workbook is reopened or the worksheet is recalculated.
To force the spreadsheet to recalculate, and consequently get your NOW formula to update its
value, press either Shift+F9 to recalculate only the active worksheet or F9 to recalculate all
open workbooks.

To make the NOW() function automatically update every second or so, a VBA macro is needed
(a few examples are available here).
Excel DATEVALUE function
DATEVALUE(date_text) converts a date in the text format to a serial number that Microsoft
Excel recognizes as a date.
The DATEVALUE function understands plenty of date formats as well as references to cells that
contain "text dates". DATEVALUE comes in really handy to calculate, filter or sort dates stored
as text and convert such "text dates" to the Date format.
A few simple DATEVALUE formula examples follow below:
=DATEVALUE("20-may-2015")
=DATEVALUE("5/20/2015")
=DATEVALUE("may 20, 2015")

And the following examples demonstrate how the DATEVALUE function can help with solving
real-life tasks:

DATEVALUE formula to convert a date to a number


DATEVALUE formula to convert a text string to a date
Excel TEXT function
In the pure sense, the TEXT function cannot be classified as one of Excel date functions
because it can convert any numeric value, not only dates, to a text string.

With the TEXT(value, format_text) function, you can change the dates to text strings in a variety
of formats, as demonstrated in the following screenshot.

Note. Though the values returned by the TEXT function may look like usual Excel dates, they
are text values in nature and therefore cannot be used in other formulas and calculations.
Here are a few more TEXT formula examples that you may find helpful:

Excel TEXT function to convert date to text


Converting a date to month and year
Extract the month name from a date
Convert the month number to month name
Return the day of week as a text value
Excel DAY function
DAY(serial_number) function returns a day of the month as an integer from 1 to 31.
Serial_number is the date corresponding to the day you are trying to get. It can be a cell
reference, a date entered by using the DATE function, or returned by other formulas.
Here are a few formula examples:
=DAY(A2) - returns the day of the date in A2
=DAY(DATE(2015,1,1)) - returns the day of 1-Jan-2015
=DAY(TODAY()) - returns the day of today's date

You can find more DAY formula examples by clicking the following links:

How to get the day of month from a date

How to calculate the number of days in a month


Excel MONTH function
MONTH(serial_number) function in Excel returns the month of a specified date as an integer
ranging from 1 (January) to 12 (December).
For example:
=MONTH(A2) - returns the month of a date in cell A2.
=MONTH(TODAY()) - returns the current month.
The MONTH function is rarely used in Excel date formulas on its own. Most often you would
utilize it in conjunction with other functions as demonstrated in the following examples:

Add or subtract months to a date in Excel


Calculating months between two dates
Get a month corresponding to the week number
Get a month number from a date in Excel
Calculate the 1st day of a month
Conditionally format dates based on month
For the detail explanation of the MONTH function's syntax and plenty more formula examples,
please check out the following tutorial: Using the MONTH function in Excel.
Excel YEAR function
YEAR(serial_number) returns a year corresponding to a given date, as a number from 1900 to
9999.
The Excel YEAR function is very straightforward and you will hardly run into any difficulties
when using it in your date calculations:
=YEAR(A2) - returns the year of a date in cell A2.
=YEAR("20-May-2015") - returns the year of the specified date.
=YEAR(DATE(2015,5,20)) - a more reliable method to get the year of a given date.
=YEAR(TODAY()) - returns the current year.

For more information about the YEAR function, please see:

Excel YEAR function - syntax and uses


How to convert date to year in Excel
How to add or subtract years to date in Excel
Calculating years between two dates
How to determine leap years in Excel
How to get the day of year (1 - 365)
How to calculate the number of days remaining in the year
Excel EOMONTH function
EOMONTH(start_date, months) function returns the last day of the month a given number of
months from the start date.
Like most of Excel date functions, EOMONTH can operate on dates input as cell references,
entered by using the DATE function, or results of other formulas.

A positive value in the months argument adds the corresponding number of months to
the start date, for example:
=EOMONTH(A2, 3) - returns the last day of the month, 3 months after the date in cell A2.

A negative value in the months argument subtracts the corresponding number of


months from the start date:
=EOMONTH(A2, -3) - returns the last day of the month, 3 months before the date in cell A2.

A zero in the months argument forces the EOMONTH function to return the last day of
the start date's month:
=EOMONTH(DATE(2015,4,15), 0) - returns the last day in April, 2015.

To get the last day of the current month, enter the TODAY function in
the start_dateargument and 0 in months:
=EOMONTH(TODAY(), 0)

You can find a few more EOMONTH formula examples in the following articles:

How to get the last day of month


How to get the first day of month
Calculating leap years in Excel
Excel WEEKDAY function
WEEKDAY(serial_number,[return_type]) function returns the day of the week corresponding
to a date, as a number from 1 (Sunday) to 7 (Saturday).

Serial_number can be a date, a reference to a cell containing a date, or a date returned


by some other Excel function.
Return_type (optional) - is a number that determines which day of the week shall be
considered the first day.
You can find the complete list of available return types in the following tutorial: Calculating days
of week in Excel (WEEKDAY function).
And here are a few WEEKEND formula examples:
=WEEKDAY(A2) - returns the day of the week corresponding to a date in cell A2; the 1st day of
the week is Sunday (default).
=WEEKDAY(A2, 2) - returns the day of the week corresponding to a date in cell A2; the week
begins on Monday.

=WEEKDAY(TODAY()) - returns a number corresponding to today's day of the week; the week
begins on Sunday.

The WEEKDAY function can help you determine which dates in your Excel sheet are working
days and which ones are weekend days, and also sort, filter or highlight workdays and
weekends:

Find and filter workdays and weekends


Highlight weekdays and weekends in Excel
Return a day name in a custom format
Convert week number to a date
Excel DATEDIF function
DATEDIF(start_date, end_date, unit) function is specially designed to calculate the difference
between two dates in days, months or years.
Which time interval to use for calculating the date difference depends on the letter you enter in
the last argument:
=DATEDIF(A2, TODAY(), "d") - calculates the number of days between the date in A2 and
today's date.
=DATEDIF(A2, A5, "m") - returns the number of complete months between the dates in A2
and B2.
=DATEDIF(A2, A5, "y") - returns the number of complete years between the dates in A2 and
B2.

These are just the basic applications of the DATEDIF function and it is capable of much more,
as demonstrated in the following examples:

Excel DATEDIF function - syntax and uses


Count days between two dates
Calculate weeks between the dates
Calculate months between two dates
Compute years between two dates
Date difference is days, months and years
Excel WEEKNUM function
WEEKNUM(serial_number, [return_type]) - returns the week number of a specific date as an
integer from 1 to 53.
For example, the below formula returns 1 because the week containing January 1 is the first
week in the year.
=WEEKNUM("1-Jan-2015")
The following tutorial explains all the specificities on the Excel WEEKNUM function: WEEKNUM
function - calculating week number in Excel.
Alternatively you can skip directly to one of the formula examples:

How to get week number from date in Excel


How to sum values by week number
How to highlight cells based on the week number
Excel EDATE function
EDATE(start_date, months) function returns the serial number of the date that is the specified
number of months before or after the start date.
For example:
=EDATE(A2, 5) - adds 5 months to the date in cell A2.
=EDATE(TODAY(), -5) - subtracts 5 months from today's date.
For a detailed explanation of EDATE formulas illustrated with formula examples, please
see: Add or subtract months to a date with EDATE function.
Excel YEARFRAC function
YEARFRAC(start_date, end_date, [basis]) function calculates the proportion of the year
between 2 dates.

This very specific function can be used to solve practical tasks such as calculating age from
date of birth.
Excel WORKDAY function
WORKDAY(start_date, days, [holidays]) function returns a date N workdays before or after
the start date. It automatically excludes weekend days from calculations as well as any holidays
that you specify.
This function is very helpful for calculating milestones and other important events based on the
standard working calendar.
For example, the following formula adds 45 weekdays to the start date in cell A2, ignoring
holidays in cells B2:B8:
=WORKDAY(A2, 45, B2:B85)
For the detailed explanation of WORKDAY's syntax and more formula examples, please check
outWORKDAY function - add or subtract workdays in Excel.
Excel WORKDAY.INTL function
WORKDAY.INTL(start_date, days, [weekend], [holidays]) is a more powerful variation of
the WORKDAY function introduced in Excel 2010 and also available Excel 2013 and 2016.
WORKDAY.INTL allows calculating a date N number of workdays in the future or in the past with
custom weekend parameters.
For example, to get a date 20 workdays after the start date in cell A2, with Monday and Sunday
counted as weekend days, you can use either of the following formulas:
=WORKDAY.INTL(A2, 20, 2, 7)
or
=WORKDAY.INTL(A2, 20, "1000001")
Of course, it might be difficult to grasp the essence from this short explanation, but more
formula examples illustrated with screenshots will make things really easy: WORKDAY.INTL calculating workdays with custom weekends.
Excel NETWORKDAYS function
NETWORKDAYS(start_date, end_date, [holidays]) function returns the number of weekdays
between two dates that you specify. It automatically excludes weekend days and, optionally, the
holidays.

For example, the following formula calculates the number of whole workdays between the start
date in A2 and end date in B2, ignoring Saturdays and Sundays and excluding holidays in cells
C2:C5:
=NETWORKDAYS(A2, B2, C2:C5)
You can find a comprehensive explanation of the NETWORKDAYS function's arguments
illustrated with formula examples and screenshots in the following tutorial: NETWORKDAYS
function - calculating workdays between two dates.
Excel NETWORKDAYS.INTL function
NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays]) is a more powerful
modification of the NETWORKDAYS function available in the modern versions of Excel 2010,
Excel 2013 and Excel 2016. It also returns the number of weekdays between two dates, but lets
you specify which days should be counted as weekends.
Here is a basic NETWORKDAYS formula:
=NETWORKDAYS(A2, B2, 2, C2:C5)
The formula calculates the number of workdays between the date in A2 (start_date) and the
date in B2 (end_date), excluding the weekend days Sunday and Monday (number 2 in the
weekend parameter), and ignoring holidays in cells C2:C5.
For full details about the NETWORKDAYS.INTL function, please see NETWORKDAYS function
- counting workdays with custom weekends.
Hopefully, this 10K foot view on the Excel date functions has helped you gain the general
understanding of how date formulas work in Excel. If you want to learn more, I encourage you to
check out the formula examples referenced on this page. I thank you for reading and hope to
see you again on our blog next week!

Using DATE function in Excel - formula examples to calculate dates


When it comes to calculating dates in Excel, DATE is the most essential function to understand.
As you probably know, Excel does not keep the year, month and day for a date, nor does it
explicitly store weekday information in a cell. Instead, Microsoft Excel stores dates as serial
numbers and this is the main source of confusion.
Not all Excel date functions can recognize dates entered as text values, therefore it's not
recommended to supply dates directly in calculations. Instead, you should use the DATE
function to get a serial number representing the date, the number that Excel understands and
can operate on.

o
o
o
o
o

DATE function syntax


Excel DATE formula examples
How to get a serial number representing a date
Return a date based on values in other cells
Convert a text string to a date
DATE formulas to add and subtract dates
Advanced DATE formula examples
Excel DATE formulas in conditional formatting
Excel DATE function syntax
What the Excel DATE function does is return the serial number of a specified date. It has the
following arguments:
DATE(year, month, day)
Year - represents the year of the date. Excel interprets the year argument according to the date
system set up on your computer. By default, Microsoft Excel for Windows uses the 1900
system. In this date system:

If year is between 1900 and 9999 inclusive, exactly that value is used for the year. For
example, =DATE(2015, 12, 31) returns December 31, 2015.
If the year argument is between 0 and 1899 inclusive, Excel calculates the year by
adding the specified number to 1900. For example, =DATE(100, 12, 31) returns December 31,
2000 (1900 + 100).
If year is less than 0 or greater than 9999, a DATE formula will return the #NUM! error.
Tip. To avoid confusion, always supply four digit years. For example, if you input "01" or "1" in
the year argument, your DATE formula will return the year of 1901.
Month - an integer representing the month of the year, from 1 (January) to 12 (December).

If month is greater than 12, Excel adds that number to the first month in the specified
year. For example, =DATE(2015, 15, 5) returns the serial number representing March 1, 2016
(January 5, 2015 plus 15 months).

If month is less than 1 (zero or negative value), Excel subtracts the magnitude of that
number of months, plus 1, from the first month in the specified year. For example, =DATE(2015,
-5, 1) returns the serial number representing July 1, 2014 (January 1, 2015 minus 6 months).
Day - an integer corresponding to the day of the month, from 1 to 31.
As well as month, the day argument can be supplied as a positive and negative number, and
Excel calculates its value based on the same principles as described above.
Tip. At first sight, supplying negative values in the month or day argument of the Excel DATE
function may seem absurd, but in practice it may turn out quite useful, for example in the
complex formula that converts a week number to a date.
The DATE function is available in all versions of Excel 2013, Excel 2010, Excel 2007, 2003, XP,
2000 as well as in Excel 2016.
Excel DATE formula examples
Blow you will find a few examples of using DATE formulas in Excel beginning with the simplest
ones.
Example 1. A simple DATE formula to return a serial number for a date
This is the most obvious use of the DATE function in Excel:
=DATE(2015, 5, 20) - returns a serial number corresponding to 20-May-2015.
Instead of specifying the values representing the year, month and day directly in a date formula,
you can get some or all arguments as results of other Excel date functions:
=DATE(YEAR(TODAY()), 1, 1) - returns the serial number for the first day of the current year.
=DATE(YEAR(TODAY()), MONTH(TODAY(), 1) - returns the serial number for the first day of
the current month in the current year.

Example 2. Excel DATE formula to return a date based on values in other cells
The DATE function is very helpful for calculating dates where the year, month, and day values
are stored in other cells. For example:
=DATE(A2, A3, A4) - returns the serial number for the date, taking the values in cells A2, A3
and A4 as the year, month and day arguments, respectively.

Example 3. DATE formula to convert a text string to a date


Another scenario when the Excel DATE function proves useful is when the dates are stored in
the format that Microsoft Excel does not recognize, for instance DDMMYYYY. In this case, you
can use DATE in liaison with other functions to convert a date stored as a text string into a serial
number representing the date:
=DATE(RIGHT(A2,4), MID(A2,3,2), LEFT(A2,2))

Example 4. Adding and subtracting dates in Excel


As already mentioned, Microsoft Excel stores dates as serial numbers and operates on those
numbers in formulas and calculations. That is why when you want to add or subtract some days
to/from a given date, you need to convert that date to a serial number first by using the Excel
DATE function. For example:

Adding days to a date:


=DATE(2015, 5, 20) + 15
The formula adds 15 days to May 20, 2015 and returns June 4, 2015.

Subtracting days from a date:


=DATE(2015, 5, 20) - 15
The result of the above formula is May 5, 2015, which is May 20, 2015 minus 15 days.

To subtract a date from today's date:


=TODAY()-DATE(2015,5,20)
The formula calculates how many days are between the current date and some other date that
you specify.

If you are adding or subtracting two dates that are stored in some cells, then the formula is as
simple as =A1+B1 or A1-B1, respectively.
For more information, please see:

Subtracting two dates in Excel


Adding or subtracting days to a date
Advanced Excel DATE formulas
And here are a few more examples where Excel DATE is used in combination with other
functions in more complex formulas:

How to convert week number to date - the example demonstrates how you can get a
date in Excel based on the week number, and also how to get a month corresponding to the
week number.
Find the first day of month - how to get the 1st day of the month by the month number,
from a given date and based on today's date.
Calculate the number of days in a month - how to get the number of days based on the
month number or on a date.
Determine leap and non-leap years - two Date formulas to pin down leap years in Excel.
Convert a month number to month name - how to change a month number to the month
name by using a combination of Excel TEXT and DATE functions.
Get the day of the year in Excel - this example explains a DATE/YEAR formula to get a
day's number.
Using Excel DATE formulas in conditional formatting
In case you want not only to calculate but also highlight dates in your Excel worksheets, then
create conditional formatting rules based on DATE formulas.
Supposing you have a list of dates in column A and you want to shade dates that occurred
earlier than 1-May-2015 in orange and those that occur after 31-May-2015 in green.

The DATE formulas you want are as follows:


Orange: =$A2<DATE(2015, 5, 1) - highlights dates less than 1-May-2015
Green: =$A2>DATE(2015, 5, 31) - highlights dates greater than 31-May-2015

For the detailed steps and more formula examples, please see How to conditionally format
dates in Excel.
Though DATE is the main function to work with dates in Excel, a lot of additional functions are
available that tackle more specific tasks. Next week, we will provide an overview of all Excel
date functions illustrated with formula examples and complemented with links to other
resources. I thank you for reading and please stay tuned!

Excel DATEDIF - calculate difference between two dates in days, weeks, months or
years
In this tutorial, you will find a simple explanation of the Excel DATEDIF function and a few
formula examples that demonstrate how to compare dates and calculate the difference in days,
weeks, months or years.
Over the past few weeks, we investigated nearly every aspect of working with dates and times
in Excel. If you have been following our blog series, you already know how to insert and format
dates in your worksheets, how to calculate days, weeks, months and years as well as add and
subtract dates.
In this tutorial, we will focus on calculating date difference in Excel and you will learn different
ways to count the number of days, weeks, months and years between two dates.

Excel DATEDIF function - syntax and uses


Count days between two dates
Calculate weeks between the dates
Calculate months between two dates in Excel
Compute years between two dates
Date difference is days, months and years
Calculating age in Excel
Excel DATEDIF function - calculating date difference
As its name suggests, the DATEDIF function is purposed for calculating the difference between
two dates.
DATEDIF is one of very few undocumented functions in Excel, and because it is "hidden" you
won't find it on the Formula tab, nor will you get any hint on which arguments to enter when you
start typing the function's name in the formula bar. That is why it's important to know the
complete syntax of Excel DATEDIF to be able to use it in your formulas.
Excel DATEDIF function - syntax
The syntax of the Excel DATEDIF function is as follows:
DATEDIF(start_date, end_date, unit)
All three arguments are required:
Start_date - the initial date of the period you want to calculate.
End_date - the ending date of the period.
To put it differently, start_date and end_date are two dates to calculate the difference between.
In your DATEDIF formulas, you can input the dates is various ways, such as:

Cell references. For example, the following formula counts the number of days between
the dates in cells A1 and B1:
=DATEDIF(A1, B1, "d")

Test strings. Excel understands dates in many formats, for example "20-May-2015",
"5/20/2015", "2015/5/20", etc. The following formula calculates the number of months between
the specified dates:
=DATEDIF("5/10/2015", "7/20/2015", "m")

Serial numbers. Since Microsoft Excel stores each date as a serial number beginning
with January 1, 1900, you can put numbers corresponding to the dates directly in the formula.
Although fully supported, this method is not reliable because date numbering varies on different
computer systems. In the 1900 date system, the following formula is another way to calculate
months between two dates from the previous example (10-May-2015 and 20-Jul-2015):
=DATEDIF(42134, 42205, "m")

Results of other functions. For instance, the following formula counts how many days
there are between today's date and 20 May, 2015.
=DATEDIF(TODAY(), "5/20/2015", "d")
Note. In your formulas, the end date must always be greater than the start date, otherwise the
Excel DATEDIF function returns the #NUM! error.
Unit - the time unit to use when calculating the difference between two dates. By supplying
different units, you can get the DATEDIF function to return the date difference in days, months
or years. Overall, 6 units are available, which are described in the following table.
Unit

Meaning

Explanation

Years

Number of complete years between the start and end


dates.

Months

Number of complete months between the dates.

Days

Number of days between the start date and end


date.

MD

Days excluding years and


months

The date difference in days, ignoring months and


years.

YD

Days excluding years

The date difference in days, ignoring years.

YM

Months excluding days and


years

The date difference in months, ignoring days and


years.

Hopefully, the above information has been helpful to understand the basics. And now, let's see
how you can use the Excel DATEDIF function to compare dates in your worksheets and return
the difference.
Excel DATEDIF formulas to calculate date difference in days
If you observed DATEDIF's arguments carefully, you've noticed that there exist 3 different units
for counting days between the dates. Which one to use depends on exactly what your needs
are.
Example 1. Count the number of days between two dates
Supposing you have the start date in cell A2 and the end date in cell B2 and you want Excel to
return the date difference in days. A simple DATEDIF formula works just fine:
=DATEDIF(A2, B2, "d")
Provided that a value in the start_date argument is less than in end_date. In case the start date
is greater than the end date, the Excel DATEDIF function returns the #NUM error, as in row 5:

If you are looking for a formula that can return the date difference in days as either a positive or
negative number, simply subtract one date directly from the other:
=B2-A2
Please see How to subtract dates in Excel for full details and more formula examples.
Example 2. Count days in Excel ignoring years
Supposing you have two lists of dates that belong to different years and you wish to calculate
the number of days between the dates as if they were of the same year. To do this, use a
DATEDIF formula with "YD" unit:

=DATEDIF(A2, B2, "yd")

If you want the Excel DATEDIF function to ignore not only years but also moths, then use the
"md" unit. In this case, your formula will calculate days between two dates as if they were of the
same month and the same year:
=DATEDIF(A2, B2, "md")
The screenshot below demonstrates the results, and comparing it with the screenshot above
can help understand the difference better.

Tip. To get the number of working days between two dates, use
the NETWORKDAYS orNETWORKDAYS.INTL function.
Calculating date difference in weeks
As you probably noticed, the Excel DATEDIF function does not have a special unit to calculate
date difference in weeks. However, there is an easy workaround.
To find out how many weeks there are between two dates, you can use the DATEDIF function
with "D" unit to return the difference in days, and then divide the result by 7.

To get the number of full weeks between the dates, wrap your DATEDIF formula in the
ROUNDDOWN function, which always rounds the number towards zero:
=ROUNDDOWN((DATEDIF(A2, B2, "d") / 7), 0)
Where A2 is the start date and B2 is the end date of the period you are calculating.

How to calculate months between two dates in Excel


Similarly to counting days, the Excel DATEDIF function can compute the number of months
between two dates that you specify. Depending on the unit you supply, the formula will produce
different results.
Example 1. Calculate complete months between two dates (DATEDIF)
To count the number of whole months between the dates, you use the DATEDIF function with
"M" unit. For example, the following formula compares the dates in A2 (start date) and B2 (end
date) and returns the difference in months:
=DATEDIF(A2, B2, "m")
Note. For the DATEDIF formula to calculate months correctly, the end date should always be
greater than the start date; otherwise the formula returns the #NUM error.

Example 2. Calculate months between two dates ignoring years (DATEDIF)


To count the number of months between the dates as if they were of the same year, type "YM"
in the <code>unit</code> argument:
=DATEDIF(A2, B2, "ym")

As you see, this formula also returns an error in row 6 where end date is less than the start
date. If your data set may contain such dates, you will find the solution in the next examples.
Example 3. Calculating months between two dates (MONTH function)
An alternative way to calculate the number of months between two dates in Excel is using the
MONTH function, or more precisely a combination of MONTH and YEAR functions:
=(YEAR(B2) - YEAR(A2))*12 + MONTH(B2) - MONTH(A2)
Of course, this formula is not so transparent as DATEDIF and it does take time to wrap your
head around the logic. But unlike the DATEDIF function, it can compare any two dates and

return the difference in months as either a positive or negative value:

Notice that the YEAR/MONTH formula has no problem with calculating months in row 6 where
the start date is more recent than the end date, the scenario in which an analogues DATEDIF
formulafails.
Note. The results returned by DATEDIF and YEAR/MONTH formulas are not always identical
because they operate based on different principles. The Excel DATEDIF function returns the
number of complete calendar months between the dates, while the YEAR/MONTH formula
operates on months' numbers.
For example, in row 7 in the screenshot above, the DATEDIF formula returns 0 because a
complete calendar month between the dates has not elapsed yet, while YEAR/MONTH returns
1 because the dates belong to different months.
Example 4. Counting months between 2 dates ignoring years (MONTH function)
In case all of your dates are of the same year, or you want to calculate months between the
dates ignoring years, you can the MONTH function to retrieve the month from each date, and
then subtract one month from the other:
=MONTH(B2) - MONTH(A2)

This formula works similarly to Excel DATEDIF with "YM" unit as demonstrated in the following
screenshot:

However, the results returned by two formulas differ is a couple of rows:

Row 4: the end date is less than the start date and therefore DATEDIF returns an error
while MONTH-MONTH yields a negative value.
Row 6: the dates are of different months, but the actual date difference is just one day.
DATEDIF returns 0 because it calculates whole months between 2 dates. MONTH-MONTH
returns 1 because it subtracts the months' numbers from each other ignoring days and years.
How to calculate years between two dates in Excel
If you followed the previous examples where we calculated months and days between two
dates, then you can easily derive a formula to calculate years in Excel. The following examples
can help you check if you got the formula right :)
Example 1. Calculating complete years between two dates (DATEDIF function)
To find out the number of complete calendar years between two dates, use the old good
DATEDIF with the "Y" unit:

Notice that the DATEDIF formula returns 0 in row 6, although the dates are of different years.
This is because the number of full calendar years between the start and end dates equals to

zero. And I believe you are not surprised to see the #NUM! error in row 7 where the start date is
more recent than the end date.
Example 2. Calculating years between two dates (YEAR function)
An alternative way to calculate years in Excel is using the YEAR function. Similarly to
the MONTH formula, you extract the year from each date, and then subtract the years from
each other:
=YEAR(B2) - YEAR(A2)
In the following screenshot, you can compare the results returned by the DATEDIF and YEAR
functions:

In most cases the results are identical, except that:

The DATEDIF function calculates complete calendar years, while the YEAR formula
simply subtracts one year from the other. Row 6 illustrates the difference.
The DATEDIF formula returns an error if the start date is greater than the end date, while
the YEAR function returns a negative value, as in row 7.
How to calculate date difference is days, months and years
To count the number of complete years, months and days between two dates in a single
formula, you simply concatenate three DATEDIF functions:

=DATEDIF(A2, B2, "y") &" years, "&DATEDIF(A2, B2, "ym") &" months, " &DATEDIF(A2,
B2, "md") &" days"

If you'd rather not display zero values, you can wrap each DATEDIF in the IF function as
follows:
=IF(DATEDIF(A2,B2,"y")=0, "", DATEDIF(A2,B2,"y") & " years ") &
IF(DATEDIF(A2,B2,"ym")=0,"", DATEDIF(A2,B2,"ym") & " months ") & IF(DATEDIF(A2, B2,
"md")=0, "", DATEDIF(A2, B2, "md") & " days"
The formula displays only non-zero elements as demonstrated in the following screenshot:

DATEDIF formulas to calculate age in Excel


In fact, calculating someone's age based on the date of birth is a special case of calculating
date difference in Excel, where the end date is today's date. So, you use a usual DATEDIF
formula with "Y" unit that returns the number of years between the dates, and enter the
TODAY() function in the end_date argument:
=DATEDIF(A2, TODAY(), "y")
Where A2 is the birth date.

The above formula calculates the number of complete years. If you'd rather get the exact age,
including years, months and days, then concatenate three DATEDIF functions like we did in the
previous example:
=DATEDIF(B2,TODAY(),"y") & " Years, " & DATEDIF(B2,TODAY(),"ym") & " Months, " &
DATEDIF(B2,TODAY(),"md") & " Days"
And you will get the following result:

To learn other methods of converting a birthdate to age, check out How to calculate age from
date of birth.
This is how you compute the difference between two dates in a variety of time intervals.
Hopefully, the DATEDIF function and other formulas you've learned today will prove useful in
your worksheets. Anyway, I thank you for reading and invite to check out other parts of our
tutorial to working with days and time in Excel.

Calculating weekdays in Excel - WORKDAY and NETWORKDAYS functions


This short tutorial explains the use of Excel NETWORKDAYS and WORKDAY functions to
calculate workdays with custom weekend parameters and holidays.
Microsoft Excel provides two functions specially designed for calculating weekdays - WORKDAY
and NETWORKDAYS.
The WORKDAY function returns a date N working days in the future or in the past and you can
use it to add or subtract workdays to a given date.
Using the NETWORKDAYS function, you can calculate the number of workdays between two
dates that you specify.
In modem versions of Excel 2010, 2013 as well as coming Excel 2016, more powerful
modifications of the above-said functions are available, WORKDAY.INTL and
NETWORKDAYS.INTL, which let you define which and how many days are weekend days.
And now, let's have a closer look at each function and see how you can use it to calculate
working days in your Excel worksheets.

Excel WORKDAY function - add or subtract workdays


WORKDAY.INTL - calculate workdays with custom weekends
Excel NETWORKDAYS - count working days between 2 dates
NETWORKDAYS - count weekdays between 2 dates with custom weekends
How to highlight workdays in Excel
Excel WORKDAY function
The Excel WORKDAY function returns a date that is a given number of working days ahead of
or prior to the start date. It excludes weekends as well as any holidays you specify.
The WORKDAY function is purposed for calculating workdays, milestones and due dates based
on the standard working calendar, with Saturday and Sunday being the weekend days.
WORKDAY is a built-in function in Excel 2007, 2010, 2013 and Excel 2016. In earlier versions,
you need to enable the Analysis ToolPak.
When using WORKDAY in Excel, you have to input the following arguments:
WORKDAY(start_date, days, [holidays])
The first 2 arguments are required and the last one is optional:

Start_date - the date from which to start counting weekdays.


Days - the number of workdays to add to / subtract from start_date. A positive number
returns a future date, a negative number returns a past date.

Holidays - an optional list of dates that should not to be counted as working days. This
can be either a range of cells containing the dates you want to exclude from calculations, or an
array constant of the serial numbers representing the dates.
Now that you know the basics, let's see how you can use the WORKDAY function in your Excel
worksheets.
How to use WORKDAY in Excel - formula examples
Supposing you have a start date in cell A2 and a list of holidays in cells B2:B5 and you want to
find out the dates 30 workdays in the future and past. You can do this using the following
formulas:

o
o

To add 30 workdays to the start date, excluding holidays in B2:B5:


=WORKDAY(A2, 30, B2:B5)
To subtract 30 workdays from the start date, excluding holidays in B2:B5:
=WORKDAY(A2, -30, B2:B5)
To calculate weekdays based on the current date, use the TODAY() function as the start
date.
To add 30 workdays to today's date: =WORKDAY(TODAY(), 30)
To subtract 30 workdays from today's date: =WORKDAY(TODAY(), -30)
To specify the start date in the formula, use the DATE(year, month, day) function:
=WORKDAY(DATE(2015,5,6), 30)
The following screenshot demonstrates the results of all these and a few more WORKDAY
formulas:

And naturally, you can enter the number of workdays to add to / subtract from the start date in
some cell, and then refer to that cell in your formula. For example:
=WORKDAY(A2, C2)

Where A2 is the start date and C2 is the number of non-weekend days behind (negative
numbers) or ahead of (positive numbers) the start date, no holidays to exclude.

Excel WORKDAY.INTL function


WORKDAY.INTL is a more powerful modification of Excel WORKDAY function that works
withcustom weekend parameters. As well as WORKDAY, it returns a date that is a specified
number of workdays in the future or in the past, but lets you determine which days of the week
should be considered weekend days.
The WORKDAY.INTL function was introduced in Excel 2010 and so is not available in earlier
Excel versions.
The syntax of the Excel WORKDAY.INTL function is as follows:
WORKDAY.INTL(start_date, days, [weekend], [holidays])
The first two arguments are required and are akin to WORKDAY's:
Start_date - the initial date.
Days - the number of working days before (negative value) or after (positive value) the start
date. If the days argument is supplied as a decimal number, it is truncated to the integer.
The last two arguments are optional:
Weekend - specifies which weekdays should be counted as weekend days. This can be either a
number or a string, as demonstrated below.
Number

Weekend days

1 or omitted

Saturday, Sunday

Sunday, Monday

Monday, Tuesday

Tuesday, Wednesday

Wednesday, Thursday

Thursday, Friday

Friday, Saturday

11

Sunday only

12

Monday only

13

Tuesday only

14

Wednesday only

15

Thursday only

16

Friday only

17

Saturday only

Weekend string - a series of seven 0's and 1's that represent seven days of the week,
beginning with Monday. 1 represents a non-working day and 0 represents a workday. For
example:

"0000011" - Saturday and Sunday are weekends.


"1000001" - Monday and Sunday are weekends.
At first sight, weekend strings may seem superfluous, but I personally like this method better
because you can make a weekend string on the fly without having to remember any numbers.
Holidays - an optional list of dates you want to exclude from the working day calendar. This can
be a range of cells containing the dates, or an array constant of the serial values representing
those dates.
Using WORKDAY.INTL in Excel - formula examples
Well, the pretty big bulk of theory we've just discussed may seem quite complicated and
confusing, but trying your hand at formulas will make things really easy.
On our dataset, with the start date in cell A2 and a list of holidays in A5:A8, let's calculate
workdays with custom weekends.

To add 30 workdays to the start date, Friday and Saturday counted as weekends and
holidays in A5:A8 excluded:
=WORKDAY.INTL(A2, 30, 7, A5:A8)
or
=WORKDAY.INTL(A2, 30, "0000110", A5:A8)

To subtract 30 workdays from the start date, Sunday and Monday counted as weekends
and holidays in A5:A8 excluded:

=WORKDAY.INTL(A2, -30, 2, A5:A8)


or
=WORKDAY.INTL(A2, -30, "1000001", A5:A8)

To add 10 workdays to the current date, Sunday being the only weekend day, no
holidays:
=WORKDAY.INTL(TODAY(), 10, 11)
or
=WORKDAY.INTL(A2, 10, "0000001")
In your Excel sheet, the formulas may look similar to this:

Note. Both Excel WORKDAY and WORKDAY.INTL functions return serial numbers representing
the dates. To get those numbers displayed as dates, select the cells with the numbers and
press Ctrl+1 to open the Format Cells dialog. On the Number tab, select Date in
the Categorylist, and choose the date format you want. For the detailed steps, please see How
to change date format in Excel.
Excel WORKDAY and WORKDAY.INTL errors
If your Excel WORKDAY or WORKDAY.INTL formula returns an error, the reason is likely to be
one of the following:
#NUM! error occurs if either:

a combination of the start_date and days arguments results in an invalid date, or


weekend argument in the WORKDAY.INTL function is invalid.
#VALUE! error occurs if either:

start_date or any value in holidays is not a valid date, or


days argument is non-numeric.
Excel NETWORKDAYS function
The NETWORKDAYS function in Excel returns the number of workdays between two dates,
excluding weekends and, optionally, the holidays you specify.
The syntax of Excel NETWORKDAYS is intuitive and easy-to-remember:
NETWORKDAYS(start_date, end_date, [holidays])
The first two arguments are obligatory and the third one is optional:

Start_date - initial date from which to start counting working days.


End_date - the end of the period for which you are counting workdays.
Both the start date and end date are counted in the returned number of workdays.

Holidays - an optional list of holidays that are not to be counted as work days.
How to use NETWORKDAYS in Excel - formula examples
Let's say you have a list of holidays in cells A2:A5, start dates in column B, end dates in column
C, and you want to know how many workdays are between these dates. The appropriate
NETWORKDAYS formula is easy to figure out:
=NETWORKDAYS(B2, C2, $A$2:$A$5)
Notice that the Excel NETWORKDAYS function returns a positive value when the start date is
less than the end date, and a negative value if the end date is more recent than the start date
(as in row 5):

Excel NETWORKDAYS.INTL function


Like NETWORKDAYS, Excel's NETWORKDAYS.INTL function calculates the number of
weekdays between two dates, but lets you specify which days should be counted as weekend
days.

The syntax of the NETWORKDAYS.INTL function is very similar to NETWORKDAYS', except it


has the additional [weekend] parameter that indicates which days of the week should be
counted as weekends.
NETWORKDAYS.INTL( start_date, end_date, [weekend], [holidays] )
The weekend argument can accept either a number or a string. The numbers and weekend
strings are exactly the same as in the weekend parameter of the WORKDAY.INTL function.
The NETWORKDAYS.INTL function is available in modem versions of Excel 2010, 2013 and
Excel 2016.
Using NETWORKDAYS.INTL in Excel - formula examples
Using the list of dates from the previous example, let's calculate the number of workdays
between two dates with Sunday being the only weekend day. For this, you type number 11 in
the weekend argument of your NETWORKDAYS.INTL formula or make a string of six 0's and
one 1 ("0000001"):
=NETWORKDAYS.INTL(B2, C2, 11, $A$2:$A$5)
Or
=NETWORKDAYS.INTL(B2, C2, "0000001", $A$2:$A$5)
The following screenshot proves that both formulas return absolutely identical results.

How to highlight workdays in Excel


Using the WORKDAY and WORKDAY.INTL functions, you can not only calculate workdays in
your Excel worksheets but also highlight them as your business logic requires. For this, you
create aconditional formatting rule with either a WORKDAY or WORKDAY.INTL formula.
For example, in a list of dates in column B, let's highlight only future dates that are within 15
workdays from today's date, excluding two holidays in cells A2:A3. The most obvious formula
that comes to mind is as follows:

=AND($B2>TODAY(), $B2<=WORKDAY(TODAY(), 15, $A$2:$A$3))


The first part of the logical test cuts off past dates, i.e. you check if a date is equal to or greater
than today: $B2>TODAY(). And in the second part, you verify whether a date is no more than 15
weekdays in the future, excluding the weekend days and specified
holidays: $B2<=WORKDAY(TODAY(), 15, $A$2:$A$3)
The formula looks correct, but once you create a rule based on it, you will realize that it
highlights wrong dates:

Let's try to figure out why that happens. The problem is not with the WORKDAY function, as
someone may conclude. The function is right, but... what does it actually do? It returns a date 15
workdays from now, excluding weekend days (Saturday and Sunday) and holidays in cells
A2:A3.
Okay, and what does the rule based on this formula do? It highlights ALL the dates that are
equal to or greater than today and less than the date returned by the WORKDAY function. You
see? All the dates! If you don't want to color the weekends and holidays, then you need to
explicitly tell Excel not to. So, we are adding two more conditions to our formula:

The WEEKDAY function to exclude weekends: WEEKDAY($B2, 2)<6


The COUNTIF function to exclude holidays: COUNTIF($A$2:$A$3, $B2)=0
As demonstrated in the below screenshot, the improved formula works perfectly:

=AND($B2>TODAY(), $B2<=WORKDAY(TODAY(), 15, $A$2:$A$3), COUNTIF($A$2:$A$3,


$B2)=0, WEEKDAY($B2, 2)<6)

As you see, the WORKDAY and WORKDAY.INTL functions make calculating workdays in Excel
quick and easy. Of course, your real-life formulas are likely to be more sophisticated, but
knowing the basics helps immensely, because you can remember only a small set of essential
things and derive the rest. I thank you for reading and hope to see on our blog next week!

How to add and subtract dates, days, weeks, months and years in Excel
In this tutorial, you will find a variety of useful formulas to add and subtract dates in Excel, such
assubtracting two dates, adding days, weeks, months and years to a date, and more.
If you have been following our tutorial to working with dates in Excel, you already know an array
of formulas to calculate different time units such as days, weeks, months and years.
When analyzing the date information in your worksheets, you are likely to perform some
arithmetic operations with those dates too. This tutorial explains a few formulas for adding and
subtracting dates in Excel that you may find useful.

Subtracting two dates in Excel


Subtract or add days to date
Subtract or add weeks to date
Add months to date in Excel
Add years to date in Excel
Add or subtract a combination of years, months and days
Adding and subtracting times in Excel
How to subtract dates in Excel
Supposing you have two dates in cells A2 and B2, and now you want to subtract one date from
the other to know how many days are between these dates. As is often the case in Excel, the
same result can be achieved in several ways.
Example 1. Subtract one date from the other directly
As you probably know, Microsoft Excel stores each date as a unique serial numbers beginning
with 1 that represents January 1, 1900. So, you are actually subtracting two numbers, and an
ordinary arithmetic operation works without a hitch:
=B2-A2
Example 2. Subtract dates using Excel DATEDIF function
If the above formula looks too plain, you can achieve the same result in a guru-like way by using
Excel's DATEDIF function:
=DATEDIF(A2, B2, "d")
The following screenshot demonstrates that both calculations return identical results, except for
row 4 where the DATEDIF function returns the #NUM error. Let's figure out why that happens.
When you subtract a more recent date (6-May-2015) from an earlier date (1-May-2015), the
subtraction operation returns a negative number (-5) exactly as it should. The syntax of the
Excel DATEDIF function, however, does not allow the start date to be greater than the end

date and therefore it returns an error.

Example 3. Subtract a date from the current date


To subtract a date from today's date, you can employ either of the above formulas. Just use the
TODAY() function instead of date 1:
=TODAY()-A2
or
=DATEDIF(A2,TODAY(), "d")
Like in the previous example, both formulas work fine when today's date is greater than the date
you are subtracting from it, otherwise DATEDIF fails:

Example 4. Subtracting dates using the Excel DATE function


If you prefer to supply the dates directly in the formula, then enter each date using the
DATE(year, month, day) function and then subtract one date from the other.
For instance, the following formula subtracts 15-May-2015 from 20-May-2015 and returns the
difference of 5 days:
=DATE(2015, 5, 20) - DATE(2015, 5, 15)

Wrapping up, when it comes to subtracting dates in Excel and you want to find out how many
days are between two dates, it makes sense to go with the easiest and most obvious option simply subtract one date directly from another.
If you are looking to count the number of months or years between two dates, then the
DATEDIF function is the only possible solution and you will find a few formula examples in the
next article that will cover this function in full details.
Now that you know how to subtract two dates, let's see how you can add or subtract days,
months, or years to a given date. There are a number of Excel functions suitable for this
purpose, and which one you use depends on which unit you want to add or subtract.
How to subtract or add days to date in Excel
If you have a date in some cell or a list of dates in a column, you can add or subtract a certain
number of days to those dates using a corresponding arithmetic operation.
Example 1. Adding days to a date in Excel
The general formula to add a specified number of days to a date in as follows:
=Date + N days
The date can be entered in several ways:

As a cell reference, e.g. =A2 + 10


Using the DATE(year, month, day) function, e.g. =DATE(2015, 5, 6) + 10
As a result of another function. For example, to add a given number of days to
the current date, use the TODAY() function: =TODAY()+10
The following screenshot demonstrates the above formulas in action. The current date at the
moment of writing was 6 May, 2015:

Note. The result of the above formulas is a serial number representing the date. To get it
displayed as a date, select the cell(s) and press Ctrl+1 to open the Format Cells dialog. On
theNumber tab, select Date in the Category list, and then choose the date format you want. For
the detailed steps, please see How to change date format in Excel.

Example 2. Subtracting days from a date in Excel


To subtract a given number of days from a certain date, you perform a usual arithmetic
operation again. The only difference from the previous example is that you type the minus sign
instead of plus :)
=Date - N days
Here are a few formula examples:

=A2 - 10
=DATE(2015, 5, 6) - 10
=TODAY() - 10

How to add or subtract weeks to date


In case you want to add or subtract whole weeks to a certain date, you can use the same
formulas as for adding / subtracting days, and simply multiply the number of weeks by 7:
Adding weeks to a date in Excel:
=A2 + N weeks * 7
For example, you add 3 weeks to the date in A2, use the following formula: =A2+3*7.
Subtracting weeks from date in Excel:
=A2 - N weeks * 7
To subtract 2 weeks from today's date, you write =TODAY()-2*7.
How to add / subtract months to date in Excel
If you want to add or subtract a certain number of whole months to a date, you can employ
either the DATE or EDATE function, as demonstrated below.

Example 1. Add months to a date with Excel DATE function


Taking a list of dates in column A for example, type the number of dates you want to add
(positive number) or subtract (negative number) in some cell, say C2.
Enter the following formula in cell B2 and then drag the corner of the cell all the way down to
copy the formula to other cells:
=DATE(YEAR(A2), MONTH(A2) + $C$2, DAY(A2))

Now, let's see what the function is actually doing. The logic behind the formula is obvious and
straightforward. The DATE(year, month, day) function takes the following arguments:

the year of the date in cell A2;


the month of the date in A2 + the number of months you specified in cell C2, and
the day of the date in A2.
Yep, it's that simple :) If you type a negative number in C2, the formula will subtract months
instead of adding them:

Naturally, nothing prevents you from typing the minus sign directly in the formula to subtract
months from a date:

=DATE(YEAR(A2), MONTH(A2) - $C$2, DAY(A2))


And of course, you can type the number of month to add or subtract in the formula instead of
referring to a cell:
=DATE(YEAR(date), MONTH(date) + N months, DAY(date))
The real formulas could look similar to these:

Add months to date:


=DATE(YEAR(A2), MONTH(A2) + 2, DAY(A2))

Subtract months from date:


=DATE(YEAR(A2), MONTH(A2) - 2, DAY(A2))
Example 2. Add or subtract months to a date with Excel EDATE
Microsoft Excel provides a special function that returns a date that is a specified number of
months before or after the start date - the EDATE function. It is available in modern versions of
Excel 2007, 2010, 2013 and upcoming Excel 2016.
In your EDATE(start_date, months) formulas, you supply the following 2 arguments:

Start_date - the start date from which to count the number of months.
Months - the number of months to add (a positive value) or subtract (a negative value).
The following formula used on our column of dates yields exactly the same results as the DATE
function in the previous example:

When using the EDATE function, you can also specify the start date and the number of month to
add / subtract directly in the formula. Dates should be entered by using the DATE function or as
results of other formulas. For example:

To add months in Excel:


=EDATE(DATE(2015,5,7), 10)
The formula adds 10 months to 7-May-2015.

To subtract months in Excel:


=EDATE(TODAY(), -10)
The formula subtracts 10 months from today's date.
Note. The Excel EDATE function returns a serial number representing the date. To force Excel
to display it as a date, you should apply the Date format to the cells with your EDATE formulas.
Please see Changing the date format in Excel for the detailed steps.
How to subtract or add years to date in Excel
Adding years to a date in Excel is done similarly to adding months. You use the DATE(year,
month, day) function again, but this time you specify how many years you want to add:
=DATE(YEAR(date) + N years, MONTH(date), DAY(date))
In your Excel worksheet, the formulas may look as follows:

To add years to a date in Excel:


=DATE(YEAR(A2) + 5, MONTH(A2), DAY(A2))
The formula adds 5 years to the date in cell A2.

To subtract years from a date in Excel:


=DATE(YEAR(A2) - 5, MONTH(A2), DAY(A2))
The formula subtracts 5 years from the date in cell A2.
If you type the number of year to add (positive number) or subtract (negative number) in some
cell and then refer to that cell in the DATE function, you will get a universal formula:

Add / subtract days, months and years to date


If you carefully observed the two previous examples, I think you have already guessed how to
add or subtract a combination of years, months and days to a date in a single formula. Yep,
using the good old DATE function :)
To add years, months, days:
=DATE(YEAR(date) + X years, MONTH(date) + Y months, DAY(date) + Z days)
To subtract years, months, days:
=DATE(YEAR(date) - X years, MONTH(date) - Y months, DAY(date) - Z days)
For example, the following formula adds 2 years, 3 months and subtracts 15 days from a date in
cell A2:
=DATE(YEAR(A2) + 2, MONTH(A2) + 3, DAY(A2) - 15)
Applied to our column of dates, the formula takes the following shape:
=DATE(YEAR(A2) + $C$2, MONTH(A2) + $D$2, DAY(A2) + $E$2)

How to add and subtract times in Excel


In Microsoft Excel, you can add or subtract times using the TIME function. It lets you operate on
time unites (hours, minutes and seconds) exactly in the same way as you handle years, months
and days with the DATE function.
To add time in Excel:
=A2 + TIME(hours, minutes, seconds)
To subtract time in Excel:
=A2 - TIME(hours, minutes, seconds)
Where A2 contains the time value you want to change.
For example, to add 2 hours, 30 minutes and 15 seconds to the time in cell A2, you can use the
following formula:
=A2 + TIME(2, 30, 15)
If you want to add and subtract time unites within one formula, just add the minus sign to the
corresponding values:
=A2 + TIME(2, 30, -15)
The above formula adds 2 hours and 30 minutes to the time in cell A2 and subtracts 15
seconds.
Alternatively, you can enter the time unites you want to changes in some cells, and refer to
those cells in your formula:
=A2 + TIME($C$2, $D$2, $E$2)

If the original cells contain both date and time, the above formula works perfectly too:

This is how you add and subtract dates in Excel. I am hopeful you have learned a couple of
useful functions today. Anyway, I thank you for reading and hope to see you on our blog next
week.

How to convert date to year in Excel & calculate age from date of birth
This tutorial explains the syntax and uses of the Excel YEAR function and provides formula
examples to extract year from date, convert date to month and year, calculate age from the date
of birth anddetermine leap years.
In a few recent posts, we have explored different ways to calculate dates and times in Excel and
learned a variety of useful functions such as WEEKDAY, DAY, MONTH and WEEKNUM. Today,
we are going to focus on a bigger time unit and talk about calculating years in your Excel
worksheets.
In this tutorial, you will learn:

o
o
o

Excel YEAR function - syntax and uses


How to convert date to year in Excel
Extracting year from date
Converting date to month and year
Displaying a date as a year
How to calculate age from date of birth
How to determine leap years
YEAR function in Excel
The YEAR function returns a four-digit year corresponding to the specified date, as an integer
from 1900 to 9999.
The syntax of the Excel YEAR function is as simple as it could possibly be:
YEAR(serial_number)
Where serial_number is any valid date of the year you want to find. In your Excel YEAR
formulas, you can specify dates in several ways:

Using the DATE For example, the following formula returns the year for 28 April, 2015:
=YEAR(DATE(2015,4,28))
As a serial number representing the date (for more information on how dates are stored
in Excel, please see Excel date format). The 28 day of April, 2015 is stored as 42122, so you
can enter this number directly in the formula:
=YEAR(42122)
Although you can enter a date as a serial numbers, this method is not recommended because
date numbering may vary across different systems.

As a cell reference, e.g. =YEAR(A1)


As a result of some other formula. For example, you can use the TODAY() function to
extract the year from the current date:
=YEAR(TODAY())

Simple YEAR formulas can even understand dates entered as text, like =YEAR("28-Apr-2015").
However, Microsoft does not guarantee correct results when a date is supplied as a text value.
The following screenshot demonstrates all of the above YEAR formulas in action, all returning
2015 as you might expect :)

How to convert date to year in Excel


When you work with date information in Excel, your worksheets usually display full dates,
including month, day and year. However, for major milestones and important events such as
product launches or asset acquisitions, you may want to view only the year without re-entering
or modifying the original data. Below, you will find 3 quick ways to do this.
Example 1. Extract a year from date using the YEAR function
In fact, you already know how to use the YEAR function in Excel to convert a date to a year. The
screenshot above demonstrates a bunch of formulas, and you can see a few more examples in
the screenshot below. Notice that the YEAR function perfectly understands dates in all possible
formats:

Example 2. Convert date to month and year in Excel


To convert a given date to year and month, you can use the TEXT function to extract each unit
individually, and then concatenate those functions within one formula.
In the TEXT function, you can use different codes for months and years, such as:

"mmm" - abbreviated months names, as Jan - Dec.

"mmmm" - full month names, as January - December.


"yy" - 2-digit years
"yyyy" - 4-digit years
To make the output better readable, you can separate the codes with a comma, hyphen or any
other character, like in the following Date to Month and Year formulas:
=TEXT(B2, "mmmm") & ", " & TEXT(B2, "yyyy")
Or
=TEXT(B2, "mmm") & "-" & TEXT(B2, "yy")
Where B2 is a cell containing a date.

Example 3. Display a date as a year


If it does not really matter how the dates are stored in your workbook, you can get Excel to show
only the years without changing the original dates. In other words, you can have full dates
stored in cells, but only the years displayed.
In this case, no formula is needed. You just open the Format Cells dialog by pressing Ctrl + 1,
select the Custom category on the Number tab, and enter one of the below codes in
the Type box:

yy - to display 2-digit years, as 00 - 99.


yyyy - to display 4-digit years, as 1900 - 9999.

Please remember that this method does not change the original date, it only changes the way
the date is displayed in your worksheet. If you refer to such cells in your formulas, Microsoft
Excel will perform date calculations rather than year calculations.
You can find more details about changing the date format in this tutorial: How to change date
format in Excel.
How to calculate age from date of birth in Excel
Usually, we have no problem with calculating someone's age if we know the person's birthdate.
But how do you approach this task in Excel? There are a few functions that can help you quickly
convert dates of birth to age, as demonstrated in the formula examples that follow.
Example 1. Convert date of birth to age with TODAY function
How do you normally figure out someone's age? Yep, by subtracting the birth date from the
current date. And the Excel age calculation formula is no different.
Supposing you have dates of birth in column B, you can convert them to a person's age using
this simple formula:

=(TODAY()-B2)/365
The first part of the formula (TODAY()-B2) calculates the difference is days, and you get years
by dividing that number by 365.
However, there is a tiny problem here. The formula returns a number with a few decimal points
as demonstrated in the screenshot below.

If you'd rather have complete years, then use the INT function that rounds the number down to
the nearest integer:
=INT((TODAY()-B2)/365)

Note. This age calculation formula produces pretty accurate results but it isn't flawless. Dividing
by the average number of days in a year works most of the time, but sometimes it gets the age
wrong. For example, if someone was born on February 29 and today is February 28, the
formula will make the person one day older (girls would certainly mind that :)
As an alternative, you can divide by 365.25 instead of 365 since every fourth year has 366 days.
However, this formula is not perfect either. For example, if you are calculating the age of a child
who hasn't yet lived through a leap year, dividing by 365.25 produces a wrong result.
Overall, subtracting the birth date from the current date works great in normal life, but is not the
ideal approach in Excel. So, I invite you to discover special Excel functions that calculate the
age impeccably regardless of the year.

Example 2. Calculate age from birth date with DATEDIF function


Another way of calculating age from the date of birth in Excel is using DATEDIF. This function
returns the difference between two dates and unlike the previous method is perfectly true:
=DATEDIF(B2, TODAY(), "y")
In the DATEDIF formula, you enter the following arguments:
1.
2.
3.

Start_date - the date of birth, B2 in this example


End_date - today's date
Unit - the time unit to calculate the difference between the start date and end date. Since
we aim to get the number of complete years, you type "y" in the 3rd argument.
Example 3. Converting date of birth to age with YEARFRAC function
One more Excel function to convert the birthdate to age is YEARFRAC that calculates the
fraction of the year, i.e. the number of whole days between two dates.
Like the DATEDIF function, YEARFRAC takes the start date (birthdate) in the 1st argument and
theend date (today's date) in the 2nd argument. Additionally, it requires the day count basis as
the 3rd argument, and you supply 1 (actual number of days per month/actual number of days per
year).
=YEARFRAC(B2, TODAY(), 1)
The result of the YEARFRAC formula is a decimal number, so you wrap it in the ROUNDDOWN
function that rounds that number down to the number of decimal places you specify (0 in our
case):
=ROUNDDOWN(YEARFRAC(B2, TODAY(), 1), 0)
Example 4. Calculating the exact age from date of birth (years, month and days)
Calculating complete years is great but not always sufficient. The following formula will help you
get the exact age, i.e. how many years, months and days there are between someone's birth
date to the current date.
In the formula, we are going to use 3 DATEDIF functions that return:

1.
2.
3.

The number of complete years: =DATEDIF(B2, TODAY(), "Y")


The difference between the months: =DATEDIF(B2, TODAY(), "YM")
The difference between the days: =DATEDIF(B2,TODAY(),"MD")

Where B2 is the date of birth.


Concatenate the above functions in a single formula, like this:

=DATEDIF(B2,TODAY(),"Y") & DATEDIF(B2,TODAY(),"YM") & DATEDIF(B2,TODAY(),"MD")


And you will get the following result:

Oops, not exactly what we were looking for, uh? To make the result more sensible, let's
separate the returned numbers with commas and define what each number means:
=DATEDIF(B2,TODAY(),"Y") & " Years, " & DATEDIF(B2,TODAY(),"YM") & " Months, " &
DATEDIF(B2,TODAY(),"MD") & " Days"
The results look much better now:

This formula may come in very handy, say, for a doctor to display the exact age of patients, or
for a personnel officer to know the exact age of all employees.
Calculating leap years in Excel
As you know, nearly every 4th year has an extra day on February 29 and is called a leap year. In
Microsoft Excel sheets, you can determine whether a certain date belongs to a leap year or a
common year in a variety of ways. I'm going to demonstrate just a couple of formulas, which in
my opinion are easiest to understand.

Formula 1. Check if February has 29 days


This is a very obvious test. Since February has 29 days in leap years, we calculate the number
of days in month 2 of a given year and compare it with number 29. For example:
=DAY(DATE(2015,3,1)-1)=29
In this formula, the DATE(2015,3,1) function returns the 1st day of March in the year 2015, from
which we subtract 1. The DAY function extracts the day number from this date, and we compare
that number with 29. If the numbers match, the formula returns TRUE, FALSE otherwise.
If you already have a list of dates in your Excel worksheet and you want to know which ones are
leap years, then incorporate the YEAR function in the formula to extract a year from a date:
=DAY(DATE(YEAR(A2),3,1)-1)=29
Where A2 is a cell containing the date.
The results returned by the formula are as follows:

Alternatively, you can use the EOMONTH function to return the last day in February, and
compare that number with 29:
=DAY(EOMONTH(DATE(YEAR(A2),2,1),0))=29
To make the formula more user-friendly, employ the IF function and have it return, say, "Leap
year" and "Common year" instead of TRUE and FALSE:
=IF(DAY(DATE(YEAR(A2),3,1)-1)=29, "Leap year", "Common year")
=IF(DAY(EOMONTH(DATE(YEAR(A2),2,1),0))=29, "Leap year", "Common year")

Formula 2. Check if the year has 366 days


This is another obvious test that hardly requires any explanation. We use one DATE function to
return 1-Jan of the next year, another DATE function to get 1-Jan of this year, subtract the latter
from the former and check if the difference equals to 366:
=DATE(2016,1,1) - DATE(2015,1,1)=366
To calculate a year based on a date entered in some cell, you use the Excel YEAR function
exactly in the same way as we did in the previous example:
=DATE(YEAR(A2)+1,1,1) - DATE(YEAR(A2),1,1)=366
Where A2 is a cell containing the date.
And naturally, you can enclose the above DATE / YEAR formula in the IF function for it to return
something more meaningful than the Boolean values of TRUE and FALSE:

=IF(DATE(YEAR(A2)+1,1,1) - DATE(YEAR(A2),1,1)=366, "Leap year", "Non-leap year")

As already mentioned, these are not the only possible ways to calculate leap years in Excel. If
you are curious to know other solutions, you can check the method suggested by Microsoft. (As
usual, Microsoft guys are not looking for easy ways, are they?) And you can find 14 other
formulas onthis blog.
Hopefully, this article has helped you figure out year calculations in Excel. I thank you for
reading and look forward to seeing you next week.

Calculating week number in Excel (WEEKNUM function)


While Microsoft Excel provides an array of functions to work with days, months and years, only
one is available for weeks - the WEEKNUM function. So, if you are looking for a way to get a
week number from a date, WEEKNUM is the function you want.
In this short tutorial, we will briefly talk about the syntax and arguments of Excel WEEKNUM,
and then discuss a few formula examples demonstrating how you can use the WEEKNUM
function to calculate week numbers in your Excel worksheets.

Excel WEEKNUM function - syntax


How to get week number from date in Excel
How to convert week number to date
How to sum values by week number
How to highlight cells based on the week number
Excel WEEKNUM function - syntax
The WEEKNUM function is used in Excel to return the week number of a specific date. It has
two arguments, the 1st is required and the 2nd is optional:

WEEKNUM(serial_number, [return_type])
Serial_number - any date within the week whose number you are trying to find. This
can be a reference to a cell containing the date, a date entered by using the DATE function or
returned by some other formula.
Return_type (optional) - a number that determines on which day the week begins. If
omitted, the default type 1 is used (the week beginning on Sunday).
Here is a complete list of the return_type values supported in WEEKNUM formulas.
Return_type

Week begins on

1 or 17 or omitted

Sunday

2 or 11

Monday

12

Tuesday

13

Wednesday

14

Thursday

15

Friday

16

Saturday

21

Monday (used in System 2, please see the details below.)

In the WEEKNUM function, two different week numbering systems are used:

System 1. The week containing January 1 is considered the 1st week of the year and is
numbered week 1. In this system, the week traditionally starts on Sunday.
System 2. This is the ISO week date system that is part of the ISO 8601 date and time
standard. In this system, the week starts on Monday and the week containing the first Thursday
of the year is considered week 1. It is commonly known as the European week numbering
system and it is used mainly in government and business for fiscal years and timekeeping.
All of the return types listed above apply to System 1, except for return type 21 that is used in
System 2.
Note. In Excel 2007 and earlier versions, only options 1 and 2 are available. Return types 11
through 21 are supported in Excel 2010 and Excel 2013 only.
Excel WEEKNUM formulas to convert date to week number
The following screenshot demonstrates how you can get week numbers from dates with the
simplest =WEEKNUM(A2) formula:

In the above formula, the return_type argument is omitted, which means that the default type 1
is used - the week beginning on Sunday.
If you'd rather begin with some other day of the week, say Monday, then use 2 in the second
argument:
=WEEKNUM(A2, 2)
Instead of referring to a cell, you can specify the date directly in the formula by using the
DATE(year, month, day) function, for example:
=WEEKNUM(DATE(2015,4,15), 2)
The above formula returns 16, which is the number of the week containing April 15, 2015, with a
week beginning on Monday.

In real-life scenarios, the Excel WEEKNUM function is rarely used on its own. Most often you
would use it in combination with other functions to perform various calculations based on the
week number, as demonstrated in further examples.
How to convert week number to date in Excel
As you have just seen, it's no big deal to turn a date into a week number using the Excel
WEEKNUM function. But what if you are looking for the opposite, i.e. converting a week number
to a date? Alas, there is no Excel function that could do this straight away. So, we will have to
construct our own formulas.
Supposing you have a year in cell A2 and a week number in B2, and now you want to calculate
the Start and End dates in this week.

Note. This formula example is based on ISO week numbers, with a week starting on Monday.
The formula to return the Start date of the week is as follows:
=DATE(A2, 1, -2) - WEEKDAY(DATE(A2, 1, 3)) + B2 * 7
Where A2 is the year and B2 is the week number.
Please note that the formula returns the date as a serial number, and to have it displayed as a
date, you need to format the cell accordingly. You can find the detailed instructions in Changing
date format in Excel. And here is the result returned by the formula:

Of course, the formula to convert a week number to a date is not trivial, and it may take a while
to get your head round the logic. Anyway, I will do my best to provide meaningful explanation for
those who are curious to get down to the bottom.
As you see, our formula consists of 2 parts:

DATE(A2, 1, -2) - WEEKDAY(DATE(A2, 1, 3)) - calculates the date of the last Monday in
the previous year.

B2 * 7 - adds the number of weeks multiplied by 7 (the number of days in a week) to get
the Monday (start date) of the week in question.
In the ISO week numbering system, week 1 is the week containing the first Thursday of the
year. Consequently, the first Monday is always between December 29 and January 4. So, to find
that date, we have to find the Monday immediately before January 5.
In Microsoft Excel, you can extract a day of week from a date by using the WEEKDAY function.
And you can use the following generic formula to get Monday immediately before any given
date:
=date - WEEKDAY(date - 2)
If our ultimate goal were to find Monday immediately before the 5th of January of the year in A2,
we could use the following DATE(year, month, day) functions:
=DATE(A2,1,5) - WEEKDAY(DATE(A2,1,3))
But what we actually need is not the first Monday of this year, but rather the last Monday of the
previous year. So, you have to subtract 7 days from January 5 and hence you get -2 in the first
DATE function:
=DATE(A2,1,-2) - WEEKDAY(DATE(A2,1,3))
Compared to the tricky formula you have just learned, calculating the End date of the week is a
piece of cake :) To get Sunday of the week in question, you simply add 6 days to the Start date,
i.e. =D2+6

Alternatively, you could add 6 directly in the formula:


=DATE(A2, 1, -2) - WEEKDAY(DATE(A2, 1, 3)) + B2 * 7 + 6
To make sure the formulas always deliver the right dates, please have a look at the following
screenshot. The Start Date and End Date formulas discussed above are copied across column

D and E, respectively:

Obviously, you can wrap the Start date formula in the Excel MONTH function to get a month
corresponding to the week number.
=MONTH(DATE(A2, 1, -2) - WEEKDAY(DATE(A2, 1, 3)) + B2 * 7)

An alternative way to convert a week number to a date in Excel is using the MAX and MIN
functions, as follows:
Start date:
=MAX(DATE(A2,1,1), DATE(A2,1,1) - WEEKDAY(DATE(A2,1,1),2) + (B2-1)*7 + 1)
End date:

=MIN(DATE(A2+1,1,0), DATE(A2,1,1) - WEEKDAY(DATE(A2,1,1),2) + B2*7)


As demonstrated in the screenshot below, the formulas return exactly the same results as the
ones we discussed above except for week 1's Start Date. While the previous formula returned
Monday of week 1, regardless of whether if falls within this year or the previous year, the MAX /
WEEKDAY formula returns January 1 regardless of the day of the week (Thursday in this
example).
By analogy, the MIN / WEEKDAY formula always returns December 31 for the last week in the
year, while the previous End Date formula returns Sunday of week 53 regardless of the date.
You decide which is the correct approach for your worksheets.

How to sum values and find average by the week number


Now that you know how to convert a date to a week number in Excel, let's see how you can use
week numbers in other calculations.
Suppose, you have some monthly sales figures and you want to know the total for each week.
To begin with, let's find out a week number corresponding to each sale. If your dates are in
column A and sales in column B, copy the =WEEKNUM(A2) formula across column C beginning

in cell C2.

And then, make a list of week numbers in some other column (say, in column E) and calculate
the sales for each week using the following SUMIF formula:
=SUMIF($C$2:$C$15, $E2, $B$2:$B$15)
Where E2 is the week number.
In this example, we are working with a list of March sales, so we have week numbers 10 to 14,
as demonstrated in the following screenshot:

In a similar manner, you can calculate the sales average for a given week:
=AVERAGEIF($C$2:$C$15, $E2, $B$2:$B$15)

If the helper column with the WEEKNUM formula does not fit well into your data layout, I regret
to tell you that there is no simple way to get rid of it because Excel WEEKNUM is one of those
functions that doesn't accept range arguments. Therefore, it cannot be used within
SUMPRODUCT or any other array formula like the MONTH function in a similar scenario.
How to highlight cells based on the week number
Let's say you have a long list of dates in some column and you want to highlight only those that
relate to a given week. All you need is a conditional formatting rule with a WEEKNUM formula
similar to this:
=WEEKNUM($A2)=10
As demonstrated in the screenshot below, the rule highlights sales that were made within week
10, which is the first week in March 2015. Since the rule applies to A2:B15, it highlights values in
both columns. You can learn more about creating conditional formatting rules in this

tutorial:Excel conditional formatting based on another cell value.

This is how you can calculate week numbers in Excel, convert week number to date and extract
week number from date. Hopefully, the WEEKNUM formulas you have learned today will prove
useful in your worksheets. In the next tutorial, we will talk about calculating age and years in
Excel. I thank you for reading and hope to see you next week!

Using MONTH and EOMONTH functions in Excel - formula examples


The tutorial explains the nuts and bolts of Excel MONTH and EOMONTH functions. You will find
an array of formula examples demonstrating how to extract month from date in Excel, get the
first and last day of the month, convert month name to number and more.
In the previous article, we explored a variety of Excel functions to work with weekdays and days
of year. Today, we are going to operate on a bigger time unit and learn the functions that
Microsoft Excel provides for months.
In this tutorial, you will learn:

Excel MONTH function - syntax and uses


Get month number from date in Excel
Extract month name from date
Convert number to month name
Convert month name to number
Get the last day of month (EOMONTH function)
Find the first day of month
Calculate the number of days in a month
How to sum data by month in Excel
How to conditionally format dates based on month
Excel MONTH function - syntax and uses
Microsoft Excel provides a special MONTH function to extract a month from date, which returns
the month number ranging from 1 (January) to 12 (December).
The MONTH function can be used in all versions of Excel 2013 - 2000 and its syntax is as
simple as it can possibly be:
MONTH(serial_number)
Where serial_number is any valid date of the month you are trying to find.
For the correct work of Excel MONTH formulas, a date should be entered by using the
DATE(year, month, day) function. For example, the formula =MONTH(DATE(2015,3,1)) returns
3 since DATE represents the 1st day of March, 2015.
Formulas like =MONTH("1-Mar-2015") also work fine, though problems may occur in more
complex scenarios if dates are entered as text.
In practice, instead of specifying a date within the MONTH function, it's more convenient to refer
to a cell with a date or supply a date returned by some other function. For example:
=MONTH(A1) - returns the month of a date in cell A1.

=MONTH(TODAY()) - returns the number of the current month.


At first sight, the Excel MONTH function may look plain. But look through the below examples
and you will be amazed to know how many useful things it can actually do.
How to get month number from date in Excel
There are several ways to get month from date in Excel. Which one to choose depends on
exactly what result you are trying to achieve.
1. MONTH function in Excel - get month number from date.
This is the most obvious and easiest way to convert date to month in Excel. For example:

=MONTH(A2) - returns the month of a date in cell A2.


=MONTH(DATE(2015,4,15)) - returns 4 corresponding to April.
=MONTH("15-Apr-2015") - obviously, returns number 4 too.
2. TEXT function in Excel - extract month as a text string.
An alternative way to get a month number from an Excel date is using the TEXT function:

=TEXT(A2, "m") - returns a month number without a leading zero, as 1 - 12.


=TEXT(A2,"mm") - returns a month number with a leading zero, as 01 - 12.
Please be very careful when using TEXT formulas, because they always return month numbers
as text strings. So, if you plan to perform some further calculations or use the returned numbers
in other formulas, you'd better stick with the Excel MONTH function.
The following screenshot demonstrates the results returned by all of the above formulas. Please
notice the right alignment of numbers returned by the MONTH function (cells C2 and C3) as
opposed to left-aligned text values returned by the TEXT functions (cells C4 and C5).

How to extract month name from date in Excel


In case you want to get a month name rather than a number, you use the TEXT function again,
but with a different date code:

=TEXT(A2, "mmm") - returns an abbreviated month name, as Jan - Dec.

=TEXT(A2,"mmmm") - returns a full month name, as January - December.

If you don't actually want to convert date to month in your Excel worksheet, you are just wish
todisplay a month name only instead of the full date, then you don't want any formulas.
Select a cell(s) with dates, press Ctrl+1 to opent the Format Cells dialog. On the Number tab,
selectCustom and type either "mmm" or "mmmm" in the Type box to display abbreviated or full
month names, respectively. In this case, your entries will remain fully functional Excel dates that
you can use in calculations and other formulas. For more details about changing the date
format, please see Creating a custom date format in Excel.

How to convert month number to month name in Excel


Suppose, you have a list of numbers (1 through 12) in your Excel worksheet that you want to
convert to month names. To do this, you can use any of the following formulas:
1. To return an abbreviated month name (Jan - Dec).
=TEXT(A2*28, "mmm")
=TEXT(DATE(2015, A2, 1), "mmm")
2. To return a full month name (January - December).

=TEXT(A2*28, "mmmm")
=TEXT(DATE(2015, A2, 1), "mmmm")
In all of the above formulas, A2 is a cell with a month number. And the only real difference
between the formulas is the month codes:

"mmm" - 3-letter abbreviation of the month, such as Jan - Dec


"mmmm" - month spelled out completely
"mmmmm" - the first letter of the month name

How to convert month name to number in Excel


There are two Excel functions that can help you convert month names to numbers DATEVALUE and MONTH. Excel's DATEVALUE function converts a date stored as text to a
serial number that Microsoft Excel recognizes as a date. And then, the MONTH function extracts
a month number from that date.
The complete formula is as follows:
=MONTH(DATEVALUE(A2 & "1"))
Where A2 in a cell containing the month name you want to turn into a number (&"1" is added for
the DATEVALUE function to understand it's a date).

How to get the last day of month in Excel (EOMONTH function)


The EOMONTH function in Excel is used to return the last day of the month based on the
specified start date. It has the following arguments, both of which are required:

EOMONTH(start_date, months)
Start_date - the starting date or a reference to a cell with the start date.
Months - the number of months before or after the start date. Use a positive value for
future dates and negative value for past dates.
Here are a few EOMONTH formula examples:
=EOMONTH(A2, 1) - returns the last day of the month, one month after the date in cell A2.
=EOMONTH(A2, -1) - returns the last day of the month, one month before the date in cell A2.
Instead of a cell reference, you can hardcode a date in your EOMONTH formula. For example,
both of the below formulas return the last day in April.
=EOMONTH("15-Apr-2015", 0)
=EOMONTH(DATE(2015,4,15), 0)
To return the last day of the current month, you use the TODAY() function in the first
argument of your EOMONTH formula so that today's date is taken as the start date. And, you
put 0 in the months argument because you don't want to change the month either way.
=EOMONTH(TODAY(), 0)

Note. Since the Excel EOMONTH function returns the serial number representing the date, you
have to apply the date format to a cell(s) with your formulas. Please see How to change date
format in Excel for the detailed steps.
And here are the results returned by the Excel EOMONTH formulas discussed above:

If you want to calculate how many days are left till the end of the current month, you simply
subtract the date returned by TODAY() from the date returned by EOMONTH and apply the
General format to a cell:
=EOMONTH(TODAY(), 0)-TODAY()
How to find the first day of month in Excel
As you already know, Microsoft Excel provides just one function to return the last day of the
month (EOMONTH). When it comes to the first day of the month, there is more than one way to
get it.
Example 1. Get the 1st day of month by the month number
If you have the month number, then use a simple DATE formula like this:
=DATE(year, month number, 1)
For example, =DATE(2015, 4, 1) will return 1-Apr-15.
If your numbers are located in a certain column, say in column A, you can add a cell reference
directly in the formula:

=DATE(2015, B2, 1)

Example 2. Get the 1st day of month from a date


If you want to calculate the first day of the month based on a date, you can use the Excel DATE
function again, but this time you will also need the MONTH function to extract the month
number:
=DATE(year, MONTH(cell with the date), 1)
For example, the following formula will return the first day of the month based on the date in cell
A2:
=DATE(2015,MONTH(A2),1)

Example 3. Find the first day of month based on the current date
When your calculations are based on today's date, use a liaison of the Excel EOMONTH and
TODAY functions:
=EOMONTH(TODAY(),0) +1 - returns the 1st day of the following month.
As you remember, we already used a similar EOMONTH formula to get the last day of the
current month. And now, you simply add 1 to that formula to get the first day of the next month.
In a similar manner, you can get the first day of the previous and current month:
=EOMONTH(TODAY(),-2) +1 - returns the 1st day of the previous month.

=EOMONTH(TODAY(),-1) +1 - returns the 1st day of the current month.


You could also use the Excel DATE function to handle this task, though the formulas would be a
bit longer. For example, guess what the following formula does?
=DATE(YEAR(TODAY()), MONTH(TODAY()), 1)
Yep, it returns the first day of the current month.
And how do you force it to return the first day of the following or previous month? Hands down :)
Just add or subtract 1 to/from the current month:
To return the first day of the following month:
=DATE(YEAR(TODAY()), MONTH(TODAY())+1, 1)
To return the first day of the previous month:
=DATE(YEAR(TODAY()), MONTH(TODAY())-1, 1)
How to calculate the number of days in a month
In Microsoft Excel, there exist a variety of functions to work with dates and times. However, it
lacks a function for calculating the number of days in a given month. So, we'll need to make up
for that omission with our own formulas.
Example 1. To get the number of days based on the month number
If you know the month number, the following DAY / DATE formula will return the number of days
in that month:
=DAY(DATE(year, month number + 1, 1) -1)
In the above formula, the DATE function returns the first day of the following month, from which
you subtract 1 to get the last day of the month you want. And then, the DAY function converts
the date to a day number.
For example, the following formula returns the number of days in April (the 4th month in the
year).
=DAY(DATE(2015, 4 +1, 1) -1)
Example 2. To get the number of days in a month based on date
If you don't know a month number but have any date within that month, you can use the YEAR
and MONTH functions to extract the year and month number from the date. Just embed them in

the DAY / DATE formula discussed in the above example, and it will tell you how many days a
given month contains:
=DAY(DATE(YEAR(A2), MONTH(A2) +1, 1) -1)
Where A2 is cell with a date.
Alternatively, you can use a much simpler DAY / EOMONTH formula. As you remember,
the Excel EOMONTH function returns the last day of the month, so you don't need any
additional calculations:
=DAY(EOMONTH(A1, 0))
The following screenshot demonstrates the results returned by all of the formulas, and as you
see they are identical:

How to sum data by month in Excel


In a large table with lots of data, you may often need to get a sum of values for a given month.
And this might be a problem if the data was not entered in chronological order.
The easiest solution is to add a helper column with a simple Excel MONTH formula that will
convert dates to month numbers. Say, if your dates are in column A, you use =MONTH(A2).
And now, write down a list of numbers (from 1 to 12, or only those month numbers that are of
interest to you) in an empty column, and sum values for each month using a SUMIF formula
similar to this:
=SUMIF(C2:C15, E2, B2:B15)
Where E2 is the month number.

The following screenshot shows the result of the calculations:

If you'd rather not add a helper column to your Excel sheet, no problem, you can do without it. A
bit more trickier SUMPRODUCT function will work a treat:
=SUMPRODUCT((MONTH($A$2:$A$15)=$E2) * ($B$2:$B$15))
Where column A contains dates, column B contains the values to sum and E2 is the month
number.
Note. Please keep in mind that both of the above solutions add up all values for a given month
regardless of the year. So, if your Excel worksheet contains data for several years, all of it will
be summed.
How to conditionally format dates based on month
Now that you know how to use the Excel MONTH and EOMONTH functions to perform various
calculations in your worksheets, you may take a step further and improve the visual
presentation. For this, we are going to use the capabilities of Excel conditional formatting for
dates.
In addition to the examples provided in the above mentioned article, now I will show you how
you can quickly highlight all cells or entire rows related to a certain month.

Example 1. Highlight dates within the current month


In the table from the previous example, suppose you want to highlight all rows with the current
month dates.
First off, you extract the month numbers from dates in column A using the simplest
=MONTH($A2) formula. And then, you compare those numbers with the current month returned
by =MONTH(TODAY()). As a result, you have the following formula which returns TRUE if the
months' numbers match, FALSE otherwise:
=MONTH($A2)=MONTH(TODAY())
Create an Excel conditional formatting rule based on this formula, and your result may resemble
the screenshot below (the article was written in April, so all April dates are highlighted).

Example 2. Highlighting dates by month and day


And here's another challenge. Suppose you want to highlight the major holidays in your
worksheet regardless of the year. Let's say Christmas and New Year days. How would you
approach this task?
Simply use the Excel DAY function to extract the day of the month (1 - 31) and the MONTH
function to get the month number, and then check if the DAY is equal to either 25 or 31, and if
the MONTH is equal to 12:

=AND(OR(DAY($A2)=25, DAY($A2)=31), MONTH(A2)=12)

This is how the MONTH function in Excel works. It appears to be far more versatile than it looks,
huh?
In a couple of the next posts, we are going to calculate weeks and years and hopefully you will
learn a few more useful tricks. If you are interested in smaller time units, please check out the
previous parts of our Excel Dates series (you will find the links below). I thank you for reading
and hope to see you next week!

WEEKDAY, DAY and other functions to calculate days in Excel


In this tutorial, you will find lots of formula examples demonstrating the use of WEEKDAY, DAY
and DAYS functions in Excel. See how to return a day of week from date, get the number of
days in the year, find how many days are between two dates and more.
There are a variety of functions to work with days of year and days of the week in Excel,
including WEEKDAY, DAY, DAYS, DATE and more. These functions can be used to determine
workdays and weekends, calculate the number of days between two dates, count the number of
days remaining in the year, return day of the week from date, and much more.
Weekday Excel functions are particularly useful for planning and scheduling, for example to
determine the timeframe of a project and automatically remove weekend days from the total.
So, let's run through the functions one-at-a-time and see how they can help you cope with
various tasks in Excel.

o
o
o
o
o

o
o

Calculating days of week in Excel (WEEKDAY function)


Find workdays and weekends
Highlight working days and weekends
Get a day of the week from date
Return day of week as a text value
Return a day name in custom format
Get the day of month from date in Excel (DAY function)
Count the number of days between two dates (DAYS function)
Working with days of year in Excel
How to get the day of year (1 - 365)
How to calculate the number of days remaining in the year
Working with days of week (Excel WEEKDAY function)
Microsoft Excel provides a special WEEKDAY function to return the day of the week
corresponding to a given date.
The result returned by an Excel WEEKDAY formula is an integer, ranging from 1 (Sunday) to 7
(Saturday) by default. If your formula's logic requires a different enumeration, you can start
counting with any day of week, as you will see in a moment.
The syntax of the Excel WEEKDAY function is as follows:

WEEKDAY(serial_number,[return_type])
Serial_number - a serial number that represents the date, or a reference to a cell with a
date or serial number.
If the term "serial number" does not make much sense to you, let me remind you that Excel
stores all dates as serial numbers beginning with January 1, 1900, which is stored as number 1.
And it is these numbers that the WEEKDAY function operates on. If you want to learn more

about how Excel stores dates and times, you may find the following article useful: Excel date
format.

Return_type (optional) - determines what day of the week to use as the first day in
calculations.
In your Excel WEEKDAY formulas, you can specify any of the following values for the
return_type argument:
Return_type

Number returned

1 or omitted

From 1 (Sunday) to 7 (Saturday)

From 1 (Monday) to 7 (Sunday)

From 0 (Monday) to 6 (Sunday)

11

From 1 (Monday) to 7 (Sunday)

12

From 1 (Tuesday) to 7 (Monday)

13

From 1 (Wednesday) to 7 (Tuesday)

14

From 1 (Thursday) to 7 (Wednesday)

15

From 1 (Friday) to 7 (Thursday)

16

From 1 (Saturday) to 7 (Friday)

17

From 1 (Sunday) to 7 (Saturday)

Note. Though the WEEKDAY function is available in all Excel versions, from Excel 2013 to
2000, the return_type values 11 through 17 were introduced in Excel 2010 only, therefore they
cannot be used in earlier versions.
And now, let's look at some examples of using the WEEKDAY function in Excel. All of the below
formulas return the day of the week corresponding to March 19, 2015. For the sake of clarity,

this date is stored as number 42082 in Excel.

At first sight, it may seems that the numbers returned by the Excel WEEKDAY function have
very little practical sense. But let's look at it from a different angle and discuss some formulas
that solve real-life tasks.
Example 1. Excel WEEKDAY formula to find workdays and weekends
If you have a long date column in your worksheet, you may want to know which dates are
working days and which are weekends.
An easiest way is to have a day name displayed in a cell, for example as "Friday, March 20,
2015" or just "Friday". And you can do this in no time by simply changing the date format.
However, this is not always an ideal approach, firstly, because a short date format is often
required, and secondly, because you may need to filter only weekends or only workdays in your
Excel list.
One of possible solutions is embedding the WEEKDAY function into the logical test of the IF
function:
=IF(WEEKDAY(A2,2)<6, "Workday", "Weekend")
In this Weekday formula, we set the return_type argument to 2, which corresponds to the
week beginning with Monday (day 1). So, if the day of the week in cell A2 is less than 6

(Monday through Friday), the formula returns "Workday", otherwise - "Weekend".

To filter weekdays or weekend days, you apply Excel's filter to your table (Data tab > Filter) and
select either "Workday" or "Weekend".

If your organization, or maybe some regional office of your company, works on a different
schedule where the days of rest are other than Saturday and Sunday, you can easily adjust this
WEEKDAY formula to your needs by specifying a different return_type .
For example, to treat Saturday and Monday as weekends, you set return_type to 12, since you
want the "Tuesday (1) to Monday (7)" week type:
=If(WEEKDAY(A2, 12)<6, "Weekday", "Weekend")

Example 2. How to highlight workdays and weekends in Excel


The Excel WEEKDAY formula discussed in the previous example has no problem with finding
working days and weekends, no matter which days of the week are days off. However, you can
improve the visual presentation of the results by shading workings days and weekend days in
different colors.
For this, you can create Excel conditional formatting rules with the following WEEKDAY
formulas to highlight weekends or workdays, or both:
Highlight weekends (Saturday and Sunday): =WEEKDAY($A2,2)<6
Highlight workdays (Monday - Friday): =WEEKDAY($A2,2)>5
The results look much better now, don't they?

Example 3. How to get a day of the week from date in Excel


If you have a list of dates in Excel and you aim to find a day of week for each date, you do not
actually need any special formulas :) The point is that Excel already knows what day of week a
given date is and all you need to do is get it to display that information.
For example, if your dates are in column A, you can put a simple =A2 formula in cell B2 and
then copy it down to other cells. After that, you select the entire column B and set the custom
date format to it, such as:

ddd - to display an abbreviated day name, e.g. Sun.


dddd - to display full day names, e.g. Sunday.

Please note that the results, which may look like usual text entries to you, are in fact fully
functional Excel dates that you can use in other calculations. You can tell these are dates by
their right alignment in a cell as opposed to left-aligned text values.
Example 4. Return day of week as a text value
An alternative way to determine a day of the week by date is using the Excel TEXT function. In
your TEXT formulas, you can specify the same formats as in the above example - "ddd" to
return a short name and "dddd" to return full names of the days of the week:
=TEXT(A1, "ddd")
=TEXT(A1,"dddd")
Where A1 is a cell with the original date.

When using this method, please remember that the TEXT function in Excel always returns text
strings regardless of the source cell's format. So, the day of week names you see in the above
screenshot are text entries, and not dates. And this is what makes them different from the
results of the previous example, which are still fully functional Excel dates.

Example 5. How to return a custom day name in Excel


Yet another way to find the day of the week from date in Excel is using the WEEKDAY function
in liaison with CHOOSE. An advantage of this formula is that it lets you return the day names in
any format of your choosing.
For example, if you want to display days of week as the first 2 letters, enter them
as valuearguments in the CHOOSE function:
=CHOOSE(WEEKDAY(A2),"Su","Mo","Tu","We","Th","Fr","Sa")

In this formula, the Excel WEEKDAY function gets the day of week as a serial number. And the
CHOOSE function uses that number as index_num (the 1st argument) that indicates which
value from the list of value arguments to return.
How to get the day of month from date (DAY function)
Microsoft Excel provides a special DAY function to retrieve the day of the month from a date:
DAY(serial_number)
The day is returned as a serial number ranging from 1 to 31. For example, in you have a list of
dates in column A and you want to extract the days into column B, you put the following formula
in cell B2 and then copy it down to other cells:
=DAY(A2)
Note. The Excel DAY function correctly handles dates in different Date formats, though the
problems may occur if dates are entered as text. Please see How to distinguish normal Excel
dates from text dates for full details.
An alternative way to extract a day of the month from a date is using the TEXT function, for
example:

=TEXT(A2, "d") - to display day numbers without leading zeros, or


=TEXT(A2, "dd") - to display day numbers with leading zeros.
Note. The Excel TEXT function always returns text strings, not numbers (please notice right
alignment of numbers in column B and left alignment of text values in columns C and D in the
screenshot below). So, if you plan to use the returned days in calculations or other formulas,
use the DAY function rather than TEXT.

How to calculate the number of days between two dates (DAYS function)
The syntax of the Excel DAYS function is so obvious that you will hardly need any
explanations :)
DAYS(end_date, start_date)
Supposing that the Start Date of your projects is in column A and the End Date in column B, you
can calculate the projects' duration (i.e. the number of days between two dates) using the
following formula:
=DAYS(B2,A2)

This formula will work with normal dates as well as dates formatted as text. If either the start
date or end date is a text value, Excel will try to convert it to date (you would use the

DATEVALUE function for this). If Excel is unable to parse your text sting as a valid date, the
DAYS formula will return the #VALUE! error.
Working with days of the year in Excel
When working with days of year in Excel, you have a few functions at your disposal. Which one
to choose depends on your data format and exactly what result you are after :)
Example 1. Get the day number of the year (1-365)
This example demonstrates how you can get the number of a certain day in a year, between 1
and 365 (1-366 in leap years) with January 1 considered day 1.
For this, you use a combination of the Excel DATE and YEAR functions:
=A2-DATE(YEAR(A2),1,0)
Where A2 is a cell containing the date.

And now, let's see what the formula actually does. The YEAR function retrieves the year of the
date in cell A2, and passes it to the DATE(year, month, day) function, which returns the
sequential number that represents a certain date.
So, in our formula, year is extracted from the original date (A2), month is 1 (January)
and day is 0. In fact, a zero day forces Excel to return December 31 of the previous year,
because we want January 1 to be treated as the 1st day. And then, you subtract the serial
number returned by the DATE formula from the original date (which is also stored as a serial
number in Excel) and the difference is the day of the year you are looking for. For example,
January 5, 2015 is stored as 42009 and December 31, 2014 is 42004, so 42009 - 42004 = 5.
If the concept of day 0 does not seem right to you, you can use the following formula instead:
=A2-DATE(YEAR(A2),1,1)+1

Example 2. Calculate the number of days remaining in the year


To compute the number of days remaining in the year, we are going to use the DATE and YEAR
functions again. The formula is based on the same approach as Example 3 above, so you are
unlikely to have any difficulties with understanding its logic:
=DATE(YEAR(A2),12,31)-A2

If you want to know how many days remain till the end of the year based on the current date,
you use the Excel TODAY() function, as follows:
=DATE(2015,12,31)-TODAY()
Where 2015 is the current year.
This is how you work with days of week and days of year in Excel. In the next article, we will
explore Excel functions to operate on bigger time units such as weeks, months and years.
Please stay tuned and thank you for reading!

How to convert date to text using Excel TEXT function and no-formula ways
In the previous article, we discussed different ways to convert text to date in Excel. If you are
looking for a solution to the opposite task - changing an Excel date to text - a few choices are
available to you again.
Traditionally, we'll begin with a formula solution and then explore a couple of non-formula ways.

Excel TEXT function to convert date to text format


Using Text to Columns feature
Convert dates to text strings via Notepad
Using TEXT function in Excel to convert date to text
The Excel TEXT function is specially designed to convert a numeric value to a text string and
display it in the format you specify.
The syntax of the Excel TEXT function is as follows:
TEXT(value, format_text)
Where:

value is a numeric value you want to convert to text. This can be a number, a formula
that returns a numeric value, or a reference to a cell containing a number.
format_text this is how you want to format the resulting text value, provided as a text
string enclosed in quotation marks.
For example, you can use the following formula to convert a date in cell A1 to a text string in the
traditional US date format (month/day/year):
=TEXT(A1,"mm/dd/yyyy")

As you see in the screenshot above, the value returned by the TEXT formula is aligned to the
left, which is the first sign that points to a date formatted as text. Apart from alignment in a cell,
there are a few more indicators that can help you distinguish between dates and text strings in
Excel.

Example 1. How to convert date to text strings in different formats


Since Excel dates are serial numbers in their nature, the Excel TEXT function has no problem
with converting them to text values. The most challenging part is probably specifying the proper
display formatting for the text dates.
Microsoft Excel understands the following date codes.
Months:

m - month number without a leading zero.


mm - month number with a leading zero.
mmm - short form of the month name, for example
mmmm - long form of the month name, for example
mmmmm - month as the first letter, for example M (stands for March and May)
Days:

d - days number without a leading zero.


dd - day number with a leading zero.
ddd - abbreviated day of the week, for example
dddd - full name of the day of the week, for example
Years:

yy - two-digit year.
Yyyy - four-digit year.
To display the converted text date exactly the way you want, you can separate the date codes
with various delimiters such as dash (-), slash (/), comma (,) colon (:), etc. Here are a few
examples:

"mm/dd/yyyy" - the date format used in the USA, displays as 03/08/2015.


"dd/mm/yyyy" - the date format used by the rest of the world, displays as 08/03/2015.
"dd-mmm-yy" - displays as 08-Mar-2015 to avoid any confusion : )
"dddd, mmmm d, yyyy" - full date, including the day of the week, displays as Sunday,
March 08, 2015.
For example, if you have a column of US dates in Excel and you need to export them to a .csv
file for your UK based partner, you can convert the dates to the UK format, as a courtesy:
=TEXT(A1,"mm/dd/yyyy")
Some more formula examples and their results are shown below:

Example 2. How to convert time to text strings


If your date entries display both dates and times and you want to change them to text strings
exactly as they are, you included the following time codes in the format_text argument of the
Excel TEXT function.
Hours:

h - hours without a leading zero, as 0-23.


hh - hours with a leading zero, as 00-23.
Minutes:

m - minutes without a leading zero, as 0-59


mm - minutes with a leading zero, as 00-59
Seconds:

s - seconds without a leading zero.


ss - seconds with a leading zero.
Periods of the day:

AM/PM - displays as AM or PM.


If not specified, 24-hour time format is used.
As you probably noticed, the m codes are used for months as well as minutes, and you might
be curious how Microsoft Excel distinguishes between them. If you put "m" immediately
after h codes (hours) or immediately before s codes (seconds), Excel understands you want to
display minutes rather than a month. Yep, it's that simple : )
The TEXT function in Excel allows including both date and time codes in
the format_textargument, for example:
=TEXT(A2,"dd/mm/yyyy hh:mm")

If you want to convert the time portion only, then put only the time codes, like this:
=TEXT(A2,"h:mm AM/PM")
The results of your TEXT formulas may look similar to this:

Example 3. How to convert the current date to text in Excel


In case you want to convert the current date to the text format, you can use the Excel TEXT
function in combination with the TODAY function that returns the current date, for example:
=TEXT(TODAY(), "dd-mmm-yyyy")
The result of this formula would show up as 08-Mar-2015. If you prefer to display the resulting
text string in some other format, please see the date codes discussed in Example 1.
Example 4. Excel TEXT formula to convert text to date
Though the main destination of the TEXT function in Excel is converting numbers to text, it can
also perform a reverse conversion, i.e. change text to date. For this, you simply add the double
negation (--) to your TEXT formula.
For example, to convert a text string in cell A1 to date, you use the formula =-TEXT(A1,"mm/dd/yy") and then format the cell as a date.

Converting date to text with Excel's Text to Columns wizard


As you've just seen, Excel's TEXT function makes a good job of converting dates to text. But if
you are not a big fan of Excel formulas, you might like this solution better.
If you had a chance to read the previous part of our Excel dates tutorial, you already know how
to use Text to Columns to change text to date. To convert dates to text strings, you proceed in

the same way with the only difference that you choose Text instead of Date on the final step of
the wizard.
Note. The Text to Column wizard always converts dates in the default short date
formatregardless of how the original dates are displayed in your worksheet. You can find more
about default date and time formats in the following article: Default date format in Excel.
If the default date format is not what you are looking for, you can jump right to the next
solutionthat lets you convert dates to text strings in any format of your choosing.
If you don't mind the default format, then perform the following steps:
1.
2.

In your Excel spreadsheet, select all of the dates you want to change to text.
On the Data tab, find the Data Tools group, and click Text to Columns.

3.

On step 1 of the wizard, select the Delimited file type and click Next.

4.

On step 2 of the wizard, make sure none of the delimiter boxes is checked and
click Next.

5.

On step 3 of the wizard, which is the final step, select Text under Column data
format and clickFinish.

Tip. If you don't want the resulting text strings to overwrite the original dates, specify
theDestination for the top cell of the new column.

That was really easy, right? The screenshot below demonstrates the result - dates converted to
text strings in the default short date format set in your Windows Regional settings, which is
"mm/dd/yyyy" in my case:

Convert Excel date to text via Notepad


Another quick no-formula way to turn Excel dates into text strings is using Notepad or any other
text editor. Unlike the Text to Columns wizard, it allows you to convert Excel date to text in any
format of your choosing.

1.

In your Excel worksheet, format the dates exactly as you want the text strings to look
like.
2.
Select all of the dates you want to convert and press Ctrl+C to copy them.

3.
4.

Open Notepad or any other text editor, and paste the copied dates there.
Notepad automatically converts the dates to the text format. Press Ctrl+A to select all
text strings, and then Ctrl+C to copy them.
5.
Switch back to Microsoft Excel, select the column where you want to insert the text
strings and apply the Text format to it. To do this, press Ctrl+1 to open the Format
Cells dialog and selectText on the Number tab.

6.

Finally, select the first cell where you want to insert the text strings and press Ctrl+V to
paste them.

The following screenshot shows the result, with the original Excel dates in column B and text
entries in column D. Please notice that the converted text strings reflect the original date format
with absolute accuracy, except they are left-alighted, as all text values are supposed to be in
Excel.

This is how you convert date to text in Excel. Next week we will explorer a few Excel functions
to work with weekdays and days of the year. And in the meantime, you may want to check out
the previous parts of our comprehensive tutorial to working with dates and times in Excel.

How to convert text to date in Excel


The tutorial explains how to use Excel functions to convert text to date and how to turn text
strings into dates in a non-formula way. You will also learn how to quickly change a number to
date format.
Since Excel is not the only application you work with, sometimes you'll find yourself working with
dates imported in an Excel worksheet from a .csv file or another external source. When that
happens, chances are the dates will export as text entries. Even though they look like dates,
Excel won't not recognize them as such.
There are many ways to convert text to date in Excel and this tutorial aims to cover them all, so
that you can choose a text-to-date conversion technique most suitable for your data format and
your preference for a formula or non-formula way.

o
o
o
o
o
o
o

How to spot "text dates" in Excel


How to convert number to date in Excel
How to convert text to date in Excel
DATEVALUE function
VALUE function
Mathematical operations
Converting text strings with custom delimiters
Text to Column wizard
Paste Special
Fixing dates with two-digit years
How to distinguish normal Excel dates from "text dates"
When importing data into Excel, there is often a problem with date formatting. The imported
entries may look like normal Excel dates to you, but they don't behave like dates. Microsoft
Excel treats such entries as text, meaning you cannot sort your table by date properly, nor can
you use those "text dates" in formulas, PivotTables, charts or any other Excel tool that
recognizes dates.
There are a few signs that can help you determine whether a given entry is a date or a text
value.
Dates

Right-aligned by default.
Have Date format in the Number
Formatbox on the Home tab > Number
If several dates are selected, the Status
Bar shows Average, Count and SUM.

Text values

Left-aligned by default.
General format displays in
the Number Format box on
the Home tab > Number
If several text dates are
selected, the Status Bar only
shows Count.
There may be a leading

apostrophe visible in the formula bar.

How to convert number to date in Excel


Since all Excel functions that change text to date return a number as a result, let's have a closer
look at converting numbers to dates first.
As you probably know, Excel stores dates and times as serial numbers and it is only a cell's
formatting that forces a number to be displayed as a date. For more information on how Excel
stores dates and times, please see Excel date format.
To convert a serial number to date in Excel, all you have to do is change the cell formatting. For
this, select a cell or a range of cells with the numbers you want to convert to dates and
press Ctrl+1 to open the Format Cells dialog. On the Number tab, choose Date, select the

desired date format under Type and click OK.

Yep, it's that easy! If you want something more sophisticated than predefined Excel date
formats, please see how to create a custom date format in Excel.
If some stubborn number refuses to change to a date, check out Excel date format not working troubleshooting tips.
How to convert text to date in Excel
When you spot text dates in your Excel file, most likely you would want to convert those text
strings to normal Excel dates so that you can reference them in your formulas to perform
calculations. And as is often the case in Excel, there are a few ways to tackle the task.
Excel DATEVALUE function - change text to date
The DATEVALUE function in Excel converts a date in the text format to a serial number that
Excel recognizes as a date.

The syntax of Excel's DATEVALUE is very straightforward:


=DATEVALUE(date_text)
So, the formula to convert a text value to date is as simple as =DATEVALUE(A1), where A1 is a
cell with a date stored as a text string.
Because the Excel DATEVALUE function converts a text date to a serial number, you will have
to make that number look like a date by applying the Date format to it, as we discussed a
moment ago.
The following screenshots demonstrates a few Excel DATEVALUE formulas in action:

Excel DATEVALUE function - things to remember


When converting a text string to a date using the DATEVALUE function, please keep in mind
that:

Time information in text strings is ignored, as you can see in rows 6 and 8 above. To
convert text values containing both dates and times, use the VALUE function.
If the year is omitted in a text date, Excel's DATEVALUE will pick the current year from
your computer's system clock, as demonstrated in row 4 above.
Since Microsoft Excel stores dates since January 1, 1900 , the use of the Excel
DATEVALUE function on earlier dates will result in the #VALUE! error.
The DATEVALUE function cannot convert a numeric value to date, nor can it process a
text string that looks like a number, for that you will need to use the Excel VALUE function, and
this is exactly what we are going to discuss next.
Excel VALUE function - convert a text string to date
Compared to DATEVALUE, the Excel VALUE function is more versatile. It can convert any text
string that looks like a date or number into a number, which you can easily change to a date
format of your choosing.
The syntax of the VALUE function is as follows:
=VALUE(text)

Where <code>text</code> is a text string or reference to a cell containing the text you want to
convert to number.
The Excel VALUE function can process both date and time, the latter is converted to a decimal
portion, as you can see in row 6 in the following screenshot:

Mathematical operations to convert text to dates


Apart from using specific Excel functions such as VALUE and DATEVALUE, you can perform a
simple mathematical operation to force Excel to do a text-to-date conversion for you. The
required condition is that an operation should not change the date's value (serial number).
Sounds a bit tricky? The following examples will make things easy!
Assuming that your text date is in cell A1, you can use any of the following formulas, and then
apply the Date format to the cell:

Addition: =A1 + 0
Multiplication: =A1 * 1
Division: =A1 / 1
Double negation: =--A1

As you can see in the above screenshot, mathematical operations can convert dates (rows 2
and 4), times (row 6) as well as numbers formatted as text (row 8). Sometimes the result is even
displayed as a date automatically, and you don't have to bother about changing the cell format.

How to convert text strings with custom delimiters to dates


If your text dates contain some delimiter other than a forward slash (/) or dash (-), Excel
functions won't be able to recognize them as dates and return the #VALUE! error.
To fix this, you can run Excel's Find and Replace tool to replace your delimiter with a slash (/),
all in one go:

Select all the text strings you want to convert to dates.


Press Ctrl+H to open the Find and Replace dialog box.
Enter your custom separator (a dot in this example) in the Find what field, and a slash in
theReplace with
Click the Replace All

Now, the DATEVALUE or VALUE function should have no problem with converting the text
strings to dates. In the same manner, you can fix dates containing any other delimiter, e.g. a
space or a backward slash.
If you prefer a formula solution, you can use Excel's SUBSTITUTE function instead of Replace
All to switch your delimiters to slashes.
Assuming the text strings are in column A, a SUBSTITUTE formula may look as follows:
=SUBSTITUTE(A1, ".", "/")
Where A1 is a text date and "." is the delimiter your strings are separated with.
Now, let's embed this SUBSTITUTE function into the VALUE formula:
=VALUE(SUBSTITUTE(A1, ".", "/"))
And have the text strings converted to dates, all with a single formula.

As you see, the Excel DATEVALUE and VALUE functions are quite powerful, but both have their
limits. For example, if you are trying to convert complex text strings like Thursday, January 01,
2015,neither function could help. Luckily, there is a non-formula solution that can handle this
task and the next section explains the detailed steps.
Text to Columns wizard - formula-free way to covert text to date
If you are a non-formula user type, a long-standing Excel feature called Text To Columns will
come in handy. It can cope with simple text dates demonstrated in Example 1 as well as multipart text strings shown in Example 2.
Example 1. Converting simple text strings to dates
If the text strings you want to convert to dates look like any of the following:

1/1/2015
1.2015
01 01 2015
2015/1/1
20150101
You don't really need formulas, nor exporting or importing anything. All it takes is 5 quick steps:
1.
2.

In your Excel worksheet, select a column of text entries you want to convert to dates.
Switch to the Data tab, Data Tools group, and click Text to Columns.

3.

In step 1 of the Convert Text to Columns Wizard, select Delimited and click Next.

4.

5.

In step 2 of the wizard, uncheck all delimiter boxes and click Next.

In the final step, select Date under Column data format, choose the
format corresponding to your dates, and click Finish.

In this example, we are converting the text dates formatted as "01 02 2015" (month day year),
so we select MDY from the drop down box.

Now, Excel recognizes your text strings as dates, automatically converts them to your default
date format and displays right-aligned in the cells. You can change the date format in the usual
way via the Format Cells dialog.
Note. For the Text to Column wizard to work correctly, all of your text strings should be
formatted identically. For example, if some of your entries are formatted
like day/month/yearformat while others are month/day/year, you would get incorrect results.
Example 2. Converting complex text strings to dates
If your dates are represented by multi-part text strings, such as:

Thursday, January 01, 2015


January 01, 2015 3 PM
You will have to put a bit more effort and use both the Text to Columns wizard and Excel DATE
function.
1.
2.
3.

Select all text strings to be converted to dates.


Click the Text to Columns button on the Data tab, Data Tools group.
On step 1 of the Convert Text to Columns Wizard, select Delimited and click Next.

4.

On step 2 of the wizard, select the delimiters your text strings contain.
For example, if you are converting strings separated by commas and spaces, like
"Thursday, January 01, 2015", you should choose both delimiters - Comma and Space.

It also makes sense to select the "Treat consecutive delimiters as one" option to ignore extra
spaces, if your data has any.
And finally, have a look at the Data preview window and verify if the text strings are split to
columns correctly, then click Next.
5.

On step 3 of the wizard, make sure all columns in the Data Preview section have
the Generalformat. If they don't, click on a column and select General under the Column
data formatoptions.
Note. Do not choose the Date format for any column because each column contains only
one component, so Excel won't be able to understand this is a date.
If you don't need some column, click on it and select Do not import column (skip).
If you don't want to overwrite the original data, specify where the columns should be inserted
- enter the address for the top left cell in the Destination field.

When done, click the Finish button.

As you see in the screenshot above, we are skipping the first column with the days of the
week, splitting the other data into 3 columns (in the General format) and inserting these
columns beginning from cell C2.
The following screenshot shows the result, with the original data in column A and the split
data in columns C, D and E.

6.

Finally, you have to combine the date parts together by using a DATE formula. The
syntax of the Excel DATE function is self-explanatory:

=DATE(year, month, day)


In our case, <code>year</code> is in column E and <code>day</code> is in column D, no
problem with these.
It's not so easy with <code>month</code> because it is text while the DATE function needs
a number. Luckily, Microsoft Excel provides a special MONTH function that can change a
month's name to a month's number:
=MONTH(serial_number)
For the MONTH function to understand it deals with a date, we put it like this:
=MONTH(1&C2)
Where C2 contains the name of the month, January in our case. "1&" is added to
concatenate a date (1 January) so that the MONTH function can convert it to the
corresponding month number.
And now, let's embed the MONTH function into the <code>month</code> argument of our
DATE formula:
=DATE(F2,MONTH(1&D2),E2)
And voila, our complex text strings are successfully converted to dates:

Quick conversion of text dates using Paste Special


To quickly convert a range of simple text strings to dates, you can use the following trick.

Copy any empty cell (select it and press Ctrl+C).


Select the range with text values you want to convert to dates.

Right-click the selection, click Paste Special, and select Add in the Paste Special dialog
box:

Click OK to complete the conversion and close the dialog.


What you have just done is tell Excel to add a zero (empty cell) to your text dates. To be able to
do this, Excel converts a text string to a number, and since adding a zero does not change the
value, you get exactly what you wanted - the date's serial number. As usual, you change a
number to the date format by using the Format Cells dialog.
Fixing text dates with two-digit years
The modern versions of Microsoft Excel are smart enough to spot some obvious errors in your
data, or better say, what Excel considers an error. When this happens, you will see an error
indicator (a small green triangle) in the upper-left corner of the cell and when you select the cell,
an exclamation mark appears:

Clicking the exclamation mark will display a few options relevant to your data. In case of a 2digit year, Excel will ask if you want to convert it to 19XX or 20XX.

If you have multiple entries of this type, you can fix them all in one fell swoop - select all the
cells with errors, then click on the exclamation mark and select the appropriate option.

How to turn on Error Checking in Excel


Usually, Error Checking is enabled in Excel by default. To make sure,
click File > Options > Formulas, scroll down to the Error Checking section and verify if the
following options are checked:

Enable background error checking under Error Checking;


Cells containing years represented as 2 digits under Error checking rules.

This is how you convert text to date in Excel and change dates to text. Hopefully, you have been
able to find a technique to your liking. In the next article, we will tackle the opposite task and
explore different ways of converting Excel dates to text strings. I thank you for reading and hope
to see you next week.

How to insert dates in Excel - add today's date, auto fill a column with dates
This tutorial demonstrates various ways of entering dates in Excel. See how to insert today's
date and current time as static or dynamic values, how to auto populate a column or row with
weekdays, and how to auto fill random dates in Excel.
There are several ways to add dates in Excel depending on what exactly you want to do. For
example, do you want to enter a today's date in some report or invoice? Or, perhaps you want
to insert a date in Excel that will update automatically and always display the current date and
time? Or, maybe you want to auto fill weekdays or input random dates in your worksheet?
In a moment, you will learn all these and a few more date entering techniques. If you are curious
to know how Excel stores dates and times, please check out part 1 of this tutorial - Excel date
format.

o
o

o
o
o
o

Entering dates in Excel


How to insert today's date in Excel
Shortcuts to show today's date and current time (time stamp)
Functions to insert today's date that updates automatically
How to auto populate dates in Excel
Add dates as a series that increases by one day
Auto fill weekdays, months or years
Auto insert every 2nd, 3rd or Nth day
Inseting random dates in Excel
How to enter a date in Excel
You can type a date in an Excel cell in a variety of ways, for example 1/1/2015, or 1-Jan-2015,
or 1-Jan, or January 1, 2015. When you type something like that in a cell, Microsoft Excel knows
you are entering a date and automatically applies the date format to that cell. Quite often, Excel
formats the newly inserted date according to your Windows default date settings, but sometimes
it may leave it exactly as you typed.
The most obvious visual indication that Excel has recognized the date you've entered is its rightalignment in a cell as opposed to left-aligned text values.

If Excel has failed to recognize your input as a date and you see it left-justified in a cell, try
inserting a date in some other format close to your default short or long date formats. These
formats are marked with an asterisk (*) in the Format Cell dialog window and you can quickly
access them on the Excel ribbon (Home tab > Number group):

You will be able to easily change the date format later via the Format Cells dialog that opens on
theCtrl + 1 shortcut. For more details, please see How to change the date format in Excel.
Note. If a date you've entered displays as a number of pound signs (#####) in a cell, most likely
the cell is not wide enough to fit the entire date. To fix this, double-click the right border of the
column to auto fit the date, or drag the right border to set the desired column width. If this does
not help, please check other Excel date format troubleshooting tips.
Inserting today's date and current time in Excel
In Microsoft Excel, you can input the current date and time either as a static or dynamic value.
Shortcuts to enter today date in Excel (as a timestamp)
To begin with, let's define what timestamp is. Timestamping is entering a "static date" that won't
change with the course of time or when the spreadsheet is recalculated.
So, if your goal is to enter the current date and/or time as a static value that won't automatically
update the next day, you can use one of the following shortcuts:

Ctrl + ; shortcut inserts the today date in a cell.


Ctrl + Shift + ; shortcut inserts the current time.
To enter the current date and time, press Ctrl + ; then press the Space key, and then Ctrl
+ Shift + ;.

Insert an automatically updatable today's date and current time


If you want to input today's date in Excel that will always remain up to date, use one of the
following Excel date functions:

=TODAY() - inserts the today date in a cell.


=NOW() - inserts the today date and current time in a cell.

Unlike Excel date shortcuts, the TODAY and NOW functions will always return today's date and
current time.
When using the Excel date functions, please keep in mind that:

The returned date and time are not refreshed continuously, they are updated only when
the spreadsheet is re-opened or re-calculated, or when a macro containing the function is run.
The functions take the current date and time from your computer's system clock.
How to auto populate dates in Excel
If you need to insert dates in a range of cells, you can let Excel "auto date" a column or row by
using the AutoFill feature.
Auto fill a date series that increases by one day
To automatically fill a column or row with an incrementing date series that increases by one day,
you use Excel's AutoFill feature in the usual way:

Enter your initial date in the first cell.


Click on the cell with the first date to select it, and then drag the fill handle across or
down the cells where you want Excel to add dates. The fill handle is a small green square that
appears at the bottom-right corner when you select a cell or a range of cells in Excel, as shown
in the screenshot below.

Auto fill weekdays, months or years


There are two ways to automatically populate the selected range of cells with weekdays,
months or years.
1.

You can use the Excel AutoFill options as described above. When the range is populated
with sequential dates, click the AutoFill Options icon and select the option you want:

2.

Another way is to enter your first date, select that cell, click the right mouse button and
drag the fill handle down the cells you want to auto fill with dates, and then release it. When

you do, Excel displays a context menu and you select the appropriate option from it.

Auto insert every 2nd, 3rd or Nth day


If you've tried a second solution described above, you probably noticed a whole lot more Excel
auto date options the fill handle provides. One of them is inserting every 2nd, 3rd, 4th, etc. day,
month or year in a worksheet. Let's try this now:

Add the first date in some cell.


Select that cell, right-click on the fill handle, drag it down or across several cells, and
then release.
In the context menu, click Series.
In the Series dialog box, choose the appropriate Date unit and enter the Step value.

How to inset random dates in Excel


Regrettably, Microsoft Excel does not provide an option to enter random dates automatically.
Luckily, AbleBits Random Generator for Excel does :)
You simply select a range of cells where you want to autofill dates in a random order, and switch
to the Random Generator's pane where you specify:

Start and End date;


What days to add - weekdays, weekends or both;
To add only unique dates, check the Unique values
Then you click the Generate button, and have the selected range populated with random dates.

Apart from dates, the Random Generator add-in can auto fill your worksheets with numbers,
Boolean vales and custom lists. If you think this is something that would be useful in your work,
we will gladly provide you with a 15% promotion code that we offer exclusively to our blog
readers: AB14-BlogSpo
This is how you insert date in Excel. I am hopeful these date entering techniques, shortcuts,
functions and Excel auto date features have proved useful to you. Anyway, thank you for
reading!

How to change date format in Excel and create custom formatting


The first part of our tutorial focuses of formatting dates in Excel and explains how to set the
default date and time formats, how to change date format in Excel, how to create custom date
formatting, and convert your dates to another locale.
Along with numbers, dates and times are the most common data types people use in Excel.
However, they may be quite confusing to work with, firstly, because the same date can be
displayed in Excel in a variety of ways, and secondly, because Excel always internally stores
dates in the same format regardless of how you have formatted a date in a given cell.
Knowing the Excel date formats a little in depth can help you save a ton of your time. And this is
exactly the aim of our comprehensive tutorial to working with dates in Excel. In the first part, we
will be focusing on the following features:

Excel date format


How to convert date to number in Excel
Default date format in Excel
How to change date format in Excel
How to convert date format to another locale
How to create a custom date and time formats
Excel date format not working - fixes and solutions
Excel date format
Before you can take advantage of powerful Excel date features, you have to understand how
Microsoft Excel stores dates and times, because this is the main source of confusion. While you
would expect Excel to remember the day, month and the year for a date, that's not how it
works...
Excel stores dates as sequential numbers and it is only a cell's formatting that causes a number
to be displayed as a date, time, or date and time.
Dates in Excel
All dates are stored as integers representing the number of days since January 1, 1900, which
is stored as number 1, to December 31, 9999 stored as 2958465.
In this system:

2 is 2-Jan-1900
3 is 3-Jan-1900
42005 is 1-Jan-2015 (because it is 42,005 days after January 1, 1900)
Time in Excel
Times are stored in Excel as decimals, between .0 and .99999, that represent a proportion of
the day where .0 is 00:00:00 and .99999 is 23:59:59.

For example:

0.25 is 06:00 AM
0.5 is 12:00 PM
0.541655093 is 12:59:59 PM
Dates & Times in Excel
Excel stores dates and times as decimal numbers comprised of an integer representing the date
and a decimal portion representing the time.
For example:

1.25 is January 1, 1900 6:00 AM


42005.5 is January 1, 2015 12:00 PM
How to convert date to number in Excel
If you want to know what serial number represents a certain date or time displayed in a cell, you
can do this in two ways.
1. Format Cells dialog
Select the cell with a date in Excel, press Ctrl+1 to open the Format Cells window and switch to
the General tab.
If you just want to know the serial number behind the date, without actually converting date to
number, write down the number you see under Sample and click Cancel to close the window. If

you want to replace the date with the number in a cell, click OK.

2. Excel DATEVALUE and TIMEVALUE functions


Use the DATEVALUE() function to convert an Excel date to a serial number, for
example =DATEVALUE("1/1/2015").
Use the TIMEVALUE() function to get the decimal number representing the time, for
example =TIMEVALUE("6:30 AM").
To know both, date and time, concatenate these two functions in the following way:
=DATEVALUE("1/1/2015") & TIMEVALUE("6:00 AM")

Note. Since Excel's serial numbers begins on January 1, 1900 and negative numbers aren't
recognized, dates prior to the year 1900 are not supported in Excel.
If you enter such a date in a sheet, say 12/31/1899, it will be a text value rather than a date,
meaning that you cannot perform usual date arithmetic on early dates. To make sure, you can
type the formula =DATEVALUE("12/31/1899") in some cell, and you will get an anticipated
result - the #VALUE! error.
Default date format in Excel
When you work with dates in Excel, the short and long date formats are retrieved from your
Windows Regional settings. These default formats are marked with an asterisk (*) in the Format
Cell dialog window:

The default date and time formats in the Format Cell box change as soon as you change the
date and time settings in Control Panel, which leads us right to the next section.

How to change the default date and time formats in Excel


If you want to set a different default date and/or time formats on your computer, for example
change the USA date format to the UK style, go to Control panel and click Region and
Language.If in your Control panel opens in Category view, then click Clock, Language, and
Region > Region and Language > Change the date, time, or number format.
On the Formats tab, choose the region under Format, and then set the date and time formatting
by clicking on an arrow next to the format you want to change and selecting the desired one
from the drop-down list:

Tip. If you are not sure what different codes (such as mmm, ddd, yyy) mean, click the "What
does the notation mean" link under the Date and time formats section, or check the Custom
Excel date formats in this tutorial.

If you are not happy with any time and date format available on the Formats tab, click
theAdditional settings button in the lower right-hand side of the Region and Language dialog
window. This will open the Customize dialog, where you switch to the Date tab and enter a
custom short or/and long date format in the corresponding box.

How to quickly apply default date and time formatting in Excel


Microsoft Excel has two default formats for dates and time - short and long, as explained
indefault Excel date format.
To quickly change date format in Excel to the default formatting, do the following:

Select the dates you want to format.

On the Home tab, in the Number group, click the drop-down arrow and select the
desired formatting option - the default short date, long date and long time are available.

If you want more date formatting options, either select More Number Formats from the dropdown list or click the Dialog Box Launcher next to Number. This will open a familiar Format
Cells dialog and you can change date format there.

Tip. If you want to quickly set date format in Excel to dd-mmm-yy, press Ctrl+Shift+#. Just keep
in mind that this shortcut always applies the dd-mmm-yy format, like 01-Jan-15, regardless of
your Windows Region settings.

Changing date format in Excel


In Microsoft Excel, dates can be displayed in a variety of ways. The easiest way to change the
date format of a given cell or a range of cells is to choose from a list of pre-defined formatting in
theFormat Cells box.
1. Select the dates whose format your want to change, or empty cells where you want to insert
dates.
2. Press Ctrl+1 to open the Format Cells dialog. Alternatively, you can right click the selected
cells and choose Format Cells from the context menu.
3. In the Format Cells window, switch to the Number tab, and select Date in the Category list.
4. Under Type, pick a desired date format. Once you do this, the Sample box will display the
format preview with the first date in your selected data.

5. If you are happy for the preview, click the OK button to save the format change and close the
window.

If the date format is not changing in your Excel sheet, most likely your dates are formatted as
text and you have to convert them to the date format first.
How to convert date format to another locale
Once you've got a file full of foreign dates and you would most likely want to change them to the
date format used in your part of the world. Let's say, you want to convert an American date
format (month/day/year) to a European style format (day/month/year).
The easiest way to change date format in Excel based on how another language displays dates
is as follows:

Select the column of dates you want to convert to another locale.


Press Crtl+1 to open the Format Cells
Select the language you want under Locale (location) and click OK to save the change.

If you want the dates to be displayed in another language, then you will have to create a custom
date format with a locale code.

Creating a custom date format in Excel


If none of the predefined Excel date formats is suitable for you, you are free to create your own.
1. In an Excel sheet, select the cells you want to format.
2. Press Ctrl+1 to open the Format Cells dialog.
3. On the Number tab, select Custom from the Categorylist and type the date format you want
in the Type box.

Tip. The easiest way to set a custom date format in Excel is to start from an existing format
close to what you want. To do this, click Date in the Category list first, and select one of existing
formats under Type. After that click Custom and make changes to the format displayed in
theType box.
When setting up a custom date format in Excel, you can use the following codes.
Code

Description

Example (January 1, 2005)

Month number without a leading


zero

mm

Month number with a leading zero

01

mmm

Month name, short form

Jan

mmmm

Month name, full form

January

mmmmm

Month as the first letter

J (stands for January, June and


July)

Day number without a leading zero

dd

Day number with a leading zero

01

ddd

Day of the week, short form

Mon

dddd

Day of the week, full form

Monday

yy

Year (last 2 digits)

05

yyyy

Year (4 digits)

2005

When setting up a custom time format in Excel, you can use the following codes.
Code

Description

Displays as

Hours without a leading zero

0-23

hh

Hours with a leading zero

00-23

Minutes without a leading zero

0-59

mm

Minutes with a leading zero

00-59

Seconds without a leading zero

0-59

ss

Seconds with a leading zero

00-59

AM/PM

Periods of the day


(if omitted, 24-hour time format is
used)

AM or PM

Note. If you're setting up a custom format that includes date and time values and you use "m"
immediately after "hh" or "h" or immediately before "ss" or "s", Microsoft Excel will
displayminutes instead of the month.
When creating a custom date format in Excel, you can use a comma (,) dash (-), slash (/), colon
(:) and other characters.
For example, the same date and time, say January 13, 2015 13:03, can be displayed in a
various ways:
Format

Displays as

dd-mmm-yy

13-Jan-15

mm/dd/yyyy

01/13/2015

m/dd/yy

1/13/15

dddd, m/d/yy h:mm AM/PM

Tuesday, 1/13/15 1:03 PM

ddd, mmmm dd, yyyy hh:mm:ss

Tue, January 13, 2015 13:03:00

How to create a custom Excel date format for another locale


If you want to display dates in another language, you have to create a custom format and prefix
a date with a corresponding locale code. The locale code should be enclosed in [square
brackets] and preceded with the dollar sign ($) and a dash (-). Here are a few examples:

[$-409] - English, Untitled States


[$-1009] - English, Canada
[$-407] - German, Germany
[$-807] - German, Switzerland
[$-804] - Bengali, India
[$-804] - Chinese, China
[$-404] - Chinese, Taiwan
You can find the full list of locale codes on this blog.

For example, this is how you set up a custom Excel date format for the Chinese locale in
the year-month-day (day of the week) time format:

The following image shows a few examples of the same date formatted with different locale
codes in the way traditional for the corresponding languages:

Excel date format not working - fixes and solutions


Usually, Microsoft Excel understands dates very well and you are unlikely to hit any roadblock
when working with them. If you happen to have an Excel date format problem, please check out
the following troubleshooting tips.

A cell is not wide enough to fit an entire date


If you see a number of pound signs (#####) instead of dates in your Excel worksheet, most
likely your cells are not wide enough to fit the whole dates.
Solution. Double-click the right border of the column to resize it to auto fit the dates.
Alternatively, you can drag the right border to set the column width you want.
Negative numbers are formatted as dates
In all modern versions of Excel 2013, 2010 and 2007, hash marks (#####) are also displayed
when a cell formatted as a date or time contains a negative value. Usually it's a result returned
by some formula, but it may also happen when you type a negative value into a cell and then
format that cell as a date.
If you want to display negative numbers as negative dates, two options are available to you:
Solution 1. Switch to the 1904 date system.
Go to File > Options > Advanced, scroll down to the When calculating this workbook section,
select the Use 1904 date system check box, and click OK.

In this system, 0 is 1-Jan-1904; 1 is 2-Jan-1904; and -1 is displayed as a negative date -2-Jan1904.

Of course, such representation is very unusual and takes time to get used to, but this is the right
way to go if you want to perform calculations with early dates.
Solution 2. Use the Excel TEXT function.
Another possible way to display negative numbers as negative dates in Excel is using the TEXT
function. For example, if you are subtracting C1 from B1 and a value in C1 is greater than in B1,
you can use the following formula to output the result in the date format:
=TEXT(ABS(B1-C1),"-d-mmm-yyyy")

You may want to change the cell alignment to right justified, and naturally, you can use any
othercustom date formats in the TEXT formula.
Note. Unlike the previous solution, the TEXT function returns a text value, that is why you won't
be able to use the result in other calculations.
Dates are imported to Excel as text values
When you are importing data to Excel from a .csv file or some other external database, dates
are often imported as text values. They may look like normal dates to you, but Excel perceives
them as text and treats accordingly.
Solution. You can convert "text dates" to the date format using Excel's DATEVALUE function or
Text to Columns feature. Please see the following article for full details: How to convert text to
date in Excel.

This is how you format dates in Excel. In the next part of our guide, we will discuss various ways
of how you can insert dates and times in your Excel worksheets. Thank you for reading and see
you next week!

Excel array formula examples for beginners and power users


Array formulas are one of the most confusing features in Excel, and yet one of the most
intriguing and exciting. Mastering Excel array formulas is a long road and last week we took the
first steps by learning the basics of array functions and formulas in Excel.
However, like with any other skill, the road to mastery is paved with practice. So, today we will
be focusing on advanced Excel array formula examples and try to make them both meaningful
and fun.

Count cells that meet certain conditions


Excel array formulas with several functions
Array formula to count all characters in a given range
Array formula to count any given character(s) in a range
Sum values in every other or Nth row
User-defined functions in Excel array formulas
Excel array formulas - limitations and alternatives
Example 1. Count cells that meet certain conditions
The introduction of SUMIF and COUNTIF functions as well as their plural counterparts in Excel
2007 made the use of array formulas superfluous in many scenarios. However, there are tasks
where an array formula is the most effective, if not the only, solution.
Suppose you have 2 columns of numbers, column A (planned) and column B (actual). And you
want to count how many times column B is greater than or equal to column A when a value in
column B is greater than 0.
This task requires comparing two ranges and this is exactly what Excel array formulas are
designed for.
So, you express the conditions as (B2:B10>=A2:A10) and (B2:B10>0), join them using the
asterisk (*) that acts as the AND operator in array formulas, and include this expression in the
SUM function's argument:

=SUM((B2:B10>=A2:A10) * (B2:B10>0))

Remember to press Ctrl + Shift + Enter to enter the Excel array formula correctly.
The next couple of paragraphs are intended for those who like looking under the hood. If you
are not interested in tech details, you can skip right to the next formula example.
For better understanding of this formula in particular and Excel array formulas in general, let's
select the two expressions within the SUM function's parentheses in the formula bar, and
press F9 to view the arrays behind the formula parts. If you want more information on how
the F9key works, please check out Evaluating portions of an array formula with F9.
So, what we have here is two arrays of Boolean values, where TRUE equates to 1 and FALSE
equates to 0. Since we are using the AND array operator (*) in the formula, SUM will add up
only those rows that have TRUE (1) in both arrays, as shown in the screenshot below:

Note. Not all Excel functions that support arrays can convert TRUE and FALSE into 1 and 0. In
more complex array formulas, you would need to use a double dash (--), which is technically
called the double unary operator, to convert non-numeric Boolean values returned by the
formula's expressions into numbers.
Including a double dash in the above formula won't do any harm either, it will just keep you on
the safe side: =SUM(--(B2:B10>=A2:A10) * (B2:B10>0))

And here is a more sophisticated Excel array formula example that absolutely requires the use
of the double unary operator.
Example 2. Using several functions in Excel array formulas
Array formulas can work with several Excel functions at a time and perform multiple calculations
within a single formula.
For example, if you have a table listing multiple product sales by several salesmen, and you
want to know the maximum sale made by a given person for a given product, you can write an
array formula based on the following pattern:
=MAX(IF((salesmen_range="name") * (products_range="name"), sales_range,""))
Assuming that the sales person names are in column A, product names are in column B and
sales are in column C, the following formula returns the largest sale Mike has made for Apples:
=MAX(IF(($A$2:$A$9="mike") * ($B$2:$B$9="apples"), $C$2:$C$9,""))
Naturally, you can replace the names in the formula with cell references so that your users can
simply type the names in certain cells without modifying your array formula:

In the screenshot above, the following Excel array formulas are used (don't forget to press Ctrl +
Shift + Enter to enter them correctly):
Maximum: =MAX(IF(($A$2:$A$9=$F$1) * ($B$2:$B$9=$F$2), $C$2:$C$9,""))
Minimum: =MIN(IF(($A$2:$A$9=$F$1) * ($B$2:$B$9=$F$2), $C$2:$C$9,""))
Average: =AVERAGE(IF(($A$2:$A$9=$F$1) * ($B$2:$B$9=$F$2), $C$2:$C$9,""))
Total: =SUM(IF(($A$2:$A$9=$F$1) * ($B$2:$B$9=$F$2), $C$2:$C$9,""))

Example 3. Array formula to count all characters in a given range


This array formula example shows how you can count the number of characters, including
spaces, in a range of cells.
The formula is as simple as this:
=SUM(LEN(range))
You use the LEN function to return the length of the text string in each individual cell, and then
you use the SUM function to add up those numbers.
For example, the array formula =SUM(LEN(A1:A10)) calculates the total number of all chars
with spaces in range A1:A10.
Example 4. Array formula to count any given character(s) in a range
If you want to know how many times a given character or a group of characters appears in a
specified range of cells, an array formula with the LEN function can help again. In this case, the
formula is a bit more complex:
=SUM((LEN(range) - LEN(SUBSTITUTE(range, character, ""))) / LEN(character))
And here is a practical example. Suppose, you have a list of orders where one cell may contain
several order numbers separated by commas or any other delimiter. There are several order
types and each has its own unique identifier - the first character in an order number.
Assuming that orders are in cells B2:B5 and the unique identifier in E1, the formula is as follows:
=SUM((LEN(B2:B5) - LEN(SUBSTITUTE(B2:B5, E1, ""))) / LEN(E1))

Example 5. Sum values in every other or Nth row


If you want to sum every other or every Nth row in a table, you will need the SUM and MOD
functions combined in an array formula:
=SUM((--(MOD(ROW(range), Nth row)=0)) * (range))

The MOD function returns the remainder rounded to the nearest integer after the number is
divided by the divisor. We embed the ROW function into it to get the row's number, and then
divide it by the Nth row (e.g. by 2 to sum every second cell) and check if the remainder is zero. If
it is, then the cell is summed.
The double unary operator (--) is used to convert non-numeric Boolean values TRUE and
FALSE returned by MOD into 1 and 0 for the SUM function to be able to add up the numbers.
For example, to count every other cell in range B2:B10, you use one of the following formulas:
Count even rows (2nd, 4th, etc.):
=SUM((--(MOD(ROW($B2:B10), 2)=0))*(B2:B10))
Count odd rows (1st, 3rd, etc.):
=SUM((--(MOD(ROW($B2:B10), 2)=1))*(B2:B10))
To get a universal formula that can sum values in any Nth rows that you specify and work
correctly with any ranges regardless of their location in a worksheet, the formula has to be
improved a little bit further:
=SUM((--(MOD((ROW($B$2:$B$7)-ROW($B$2)), E1)=E1-1))*($B$2:$B$7))
Where E1 is every Nth row you want to sum.

Example 6. User-defined functions in Excel array formulas


This example is purposed for power users that have some knowledge of Excel VBA macros and
user-defined functions.
You can utilize your own user-defined function in Excel array formulas, provided that a given
function supports calculations in arrays.
For example, one of our Excel gurus wrote a function called GetCellColor that can get a color of
all cells in a range, exactly as its name suggests. You can grab the function's code from this
article -How to count and sum cells by color in Excel.

And now, let's see how you can use the GetCellColor function in an array formula. Suppose you
have a table with a color coded column and you want to sum the values that meet several
conditions, including a cell's color. As an example, let's find the total of "green" and "yellow"
sales made by Neal:

As demonstrated in the image above, we use the following Excel array formula:
=SUM(--($A$2:$A$10=$F$1) * ($C$2:$C$10) * (-(GetCellColor($C$2:$C$10)=GetCellColor($E$2))))
Where cell F1 is the sales person name and E2 is the color pattern.
The formula sums cells in the range C2:C10 if the following 2 conditions are met:

$A$2:$A$10=$F$1 - checks if a cell in column A matches the seller name in F1, which
isNeal in this example.
GetCellColor($C$2:$C$10)=GetCellColor($E$2) - we use the custom user-defined
function to get the color of cells C2 through C10, and check if it matches the color pattern in E2,
green in this case.
Please pay attention that we use the double unary operator with both of the above expressions
in order to convert the Boolean values TRUE and FALSE they return into 1's and 0's the SUM
function can operate on. If both conditions are met, i.e. two 1's are returned, SUM adds up the
sales amount from a corresponding cell in column C.
More Excel array formula examples
And here are a few more examples of Excel array formulas that might be helpful.

Look up with multiple criteria - a powerful INDEX / MATCH function that can look up by
values in 2 different columns.
Get all duplicate values in the lookup range - how to get all instances of the lookup
value.
Case-sensitive lookup for all data types - self-explanatory : )
Array LOOKUP and SUM - how to look up in an array and sum all matching values.
Excel SUM function in array formulas - a few examples that demonstrate the uses of
SUM in array formulas.
Excel TRANSPOSE formula examples - how to convert rows to columns in Excel.
Sum the largest or smallest numbers in a range - how to sum a variable number of
largest / smallest values in the range.
Excel array formulas - limitations and alternatives
Array formulas are by far one of the most powerful features in Excel, but not all-powerful. Here
are the most critical limitations of arrays in Excel.
1. Large arrays may slow down Excel
Though Microsoft Excel does not impose any limit on the size of arrays you use in your
worksheets, you are limited by memory available on your computer because recalculating
formulas with large arrays is time consuming. So, in theory, you can create huge arrays
consisting of hundreds or thousands of elements, in practice this is not recommended because
they can drastically slow your workbooks.
2. Entire column arrays are not allowed
You are not allowed to create an array that includes a whole column or several columns for an
obvious reason explained above. Array formulas in Excel are very resource-hungry and
Microsoft is taking preventive measures against Excel's freezing.
3. Limit to array formulas referring to another sheet
In Excel 2003 and earlier versions, a given worksheet could contain a maximum of 65,472 array
formulas referring to another sheet. In modern versions of Excel 2013, 2010 and 2007, crossworksheet array formulas are limited by available memory only.
4. Debugging array formulas
If your array formula returns an incorrect result, make sure you pressed Ctrl + Shift +
Enter when entering it. If you did, select parts of the formula and press the F9 to evaluate and
debug them.
5. Alternatives to array formulas.
If you find Excel array formulas too complex and confusing, you can use one of Excel functions
that can naturally process arrays of data (without pressing Ctrl + Shift + Enter). A good example
is the SUMPRODUCT function that multiplies values in the specified arrays and returns the sum
of those products. Another example is Excel INDEX function with an empty value or 0 in the

row_num or col_num argument to return an array of values from the entire column or row,
respectively.
If you want to download the Excel array formula examples discussed in this tutorial to reverseengineer them for better understanding, you are most welcome to download formula examples.
This is an .xlsm file since example 6 includes a custom VBA function, so you will have to click
theEnable Content button after downloading to allow the macro to run.
That's all for today, thank you for reading!

Excel array formulas, functions and constants - examples and guidelines


In this tutorial, you will learn what an Excel array formula is, how to enter it correctly in your
worksheets, and how to use array constants and array functions in Excel.
Array formulas in Excel are an extremely powerful tool and one of the most difficult to master. A
single Excel array formula can perform multiple calculations and replace thousands of usual
formulas. And still, 90% of Excel users have never used array functions in their worksheets
simply because they are scared to start learning them.
Indeed, array formulas one of the most confusing Excel features to learn. The aim of this tutorial
is to make the learning curve as easy and smooth as possible.

What is an array formula in Excel?


How to enter an array formula (CTRL + SHIFT +ENTER)
How to evaluate portions of an array formula (F9 key)
Single-cell and multi-cell array formulas in Excel
Excel array constants
AND and OR operators in Excel array formulas
Double unary operator in array formulas
What is an array formula in Excel?
Before we start on Excel array functions and formulas, let's figure out what the term "array"
means. Essentially, an array in Excel is a collection of items. The items can be text or numbers
and they can reside in a single row or column, or in multiple rows and columns.
For example, if you put your weekly grocery list into an Excel array format, it would look like:
{"Milk", "Eggs", "Butter", "Corn flakes"}
Then, if you select cells A1 through D1, enter the above array preceded with the equal sign (=)
in the formula bar and press CTRL + SHIFT + ENTER, you will get the following result:

What you have just done is create a one-dimensional horizontal array. Nothing dreadful so far,
right?
Now, what is an Excel array formula? The difference between an array formula and regular
Excel formulas is that an array formula processes several values instead of just one. In other
words, an array formula in Excel evaluates all individual values in an array and performs
multiple calculations on one or several items according to the conditions expressed in the
formula.

Not only can an array formula deal with several values simultaneously, it can also return several
values at a time. So, the results returned by an Excel array formula is also an array.
Array formulas are available in all versions of Excel 2013, Excel 2010, Excel 2007 and lower.
And now, it seems to be the right time for you to create your first array formula.
Simple example of Excel array formula
Suppose you have some items in column B, their prices in column C, and you want to calculate
the grand total of all sales.
Of course, nothing prevents you from calculating subtotals in each row first with something as
simple as =B2*C2 and then sum those values:

However, an array formula can spare you those extra key strokes since it gets Excel to store
intermediate results in memory rather than in an additional column. So, all it takes is a single
array formula and 2 quick steps:
1. Select an empty cell and enter the following formula in it:
=SUM(B2:B6*C2:C6)
2. Press CTRL + SHIFT + ENTER to complete the array formula.
Once you do this, Microsoft Excel surrounds the formula with {curly braces}, which is a visual
indication of an array formula.

What the formula does is multiply the values in each individual row of the specified array (cells
B2 through C6), add the sub-totals together, and outputs the grand total:

This simple example shows how powerful an Excel array formula can be. When working with
hundreds and thousands of rows of data, just think how much time you can save by entering
one array formula in a single cell.
Why use array formulas in Excel?
Excel array formulas are the handiest tool to perform sophisticated calculations and do complex
tasks. A single array formula can replace literally hundreds of usual formulas. Array formulas are
very good for tasks such as:

Sum numbers that meet certain conditions, for example sum N largest or smallest
values in a range.
Sum every other row, or every Nth row or column, as demonstrated in this example.
Count the number of all or certain characters in a specified range. Here is an array
formula thatcounts all chars, and another one that counts any given characters.
How to enter array formula in Excel (Ctrl + Shift + Enter)
You already know that to enter an array formula in Excel, CTRL + SHIFT + ENTER shortcut is
required. This is a magic touch that turns a regular formula into an array formula.
There are 4 important things to keep in mind:
1. Once you've finished typing the formula and pressed Ctrl + Shift + Enter, Excel automatically
encloses the formula between {curly braces}. When you select such a cell(s), you can see the
braces in the formula bar, which gives you a clue that an array formula is in there.
2. Manually typing the braces around a formula won't convert it into an array formula. You must
press Ctrl + Shift + Enter to complete an array formula.
3. Every time you edit an array formula, the braces disappear and you must press Ctrl + Shift +
Enter again to save the changes in your formula.

4. If you forget to press Ctrl + Shift + Enter, your formula will behave like a usual Excel formula
and process only the first value(s) in the specified array(s).
Because all Excel array formulas require pressing Ctrl + Shift + Enter, they are sometimes
calledCSE formulas.
Use the F9 key to evaluate portions of an array formula
When working with array formulas in Excel, you can observe how they calculate and store their
items (internal arrays) to display the final result you see in a cell. To do this, select one or
several arguments within a function's parentheses, and then press the F9 key.
In the above example, to see the sub-totals of all products, you select B2:B6*C2:C6,
press F9 and get the following result.

Note. Please pay attention that you must select some part of the formula prior to pressing F9,
otherwise the F9 key will simply replace your Excel array formula with the calculated value(s).
Single-cell and multi-cell array formulas in Excel
Excel array formulas can return a result in a single cell or in multiple cells. An array formula
entered in a range of cells is called a multi-cell formula. An array formula residing in a single
cell is called a single-cell formula.
There exist a few Excel array functions that are designed to return multi-cell arrays, for example
TRANSPOSE, TREND, FREQUENCY, LINEST, etc.
Other functions, such as SUM, AVERAGE, AGGREGATE, MAX, MIN, can calculate array
expressions when entered into a single cell by using Ctrl + Shift + Enter.
The following examples demonstrate how to use a single-cell and multi-cell array formula in
Excel.

Example 1. A single-cell array formula


Suppose you have two columns listing the number of items sold in 2 different months, say
columns B and C, and you want to find the maximum sales increase.
Normally, you would add an additional column, say column D, that calculates the sales change
for each product using a formula like =C2-B2, and then find the maximum value in that
additional column =MAX(D:D).
An Excel array formula does not need an additional column since it perfectly stores intermediate
results in memory. So, you just enter the following formula and press Ctrl + Shift + Enter:
=MAX(C2:C6-B2:B6)

Example 2. A multi-cell array formula in Excel


In the previous SUM example, suppose you have to pay 10% tax from each sale and you want
to calculate the tax amount for each product with one formula.
Select the range of cell in some blank column, say D2:D6, and enter the following formula in the
formula bar:
=B2:B6 * C2:C6 * 0.1

Once you press Ctrl + Shift + Enter, Excel will place an instance of your array formula in each
cell of the selected range, and you will get the following result:

Example 3. Using an Excel array function to return a multi-cell array


As already mentioned, Microsoft Excel provides a few so called "array functions" that are
specially designed to work with multi-cell arrays. Excel TRANSPOSE is one of such functions
and we are going to utilize it to transpose the above table, i.e. convert rows to columns.
1. Select an empty range of cells where you want to output the transposed table. Since we are
converting rows to columns, be sure to select the same number of rows and columns as your
source table has columns and rows, respectively. In this example, we are selecting 6 columns
and 4 rows.
2. Press F2 to enter the edit mode.
3. Enter the array function =TRANSPOSE(array) and press Ctrl + Shift + Enter. In our example,
the formula is =TRANSPOSE($A$1:$D$6).

The result is going to look similar to this:

This is how you use an array function in Excel. To learn the nuts and bolts of Excel
TRANSPOSE, please check out this tutorial: How to transpose in Excel - convert rows to
columns.
How to work with multi-cell array formulas
When working with multi-cell array formulas in Excel, be sure to follow these rules to get the
correct results:
1. Select the range of cells where you want to output the results before entering the formula.
2. To delete a multi-cell array formula, either select all the cells containing it and press DELETE,
or select the entire formula in the formula bar, press DELETE, and then press Ctrl + Shift +
Enter.
3. You cannot edit, move or delete the contents of an individual cell in an Excel array formula.
Nor can you insert new cells into or delete existing cells from a multi-cell array formula.
Whenever you try doing this, Microsoft Excel will throw the warning "You cannot change part of
an array".
4. To shrink an array formula, i.e. to apply it to fewer cells, you need to delete the existing
formula first and then enter a new one.
5. To expand an array formula, i.e. apply it to more cells, select all cells containing the current
formula plus empty cells where you want to have it, press F2 to switch to the edit mode, adjust
the references in the formula and press Ctrl + Shift + Enter to update it.

6. You cannot use multi-cell array formulas in Excel tables.


7. You should enter a multi-cell array formula in a range of cells of the same size as the
resulting array returned by the formula. If your Excel array formula produces an array larger
than the selected range, the excess values won't appear on the worksheet. If an array returned
by the formula is smaller than the selected range, #N/A errors will appear in extra cells.
If your formula may return an array with a variable number of elements, enter it in a range equal
to or larger than the maximum array returned by the formula and wrap your formula in the
IFERROR function, as demonstrated in this example.
Excel array constants
In Microsoft Excel, an array constant is simply a set of static values. These values never change
when you copy a formula to other cells or values.
You already saw an example of an array constant created from a grocery list in the
very beginning of this tutorial. Now, let's see what other array types exist and how you create
them.
There exist 3 types of array constants in Excel:
1. Horizontal array constant
A horizontal array constant resides in a row. To create a row array constant, type the values
separated by commas and enclose then in braces, for example {1,2,3,4}.
Note. When creating an array constant, you should type the opening and closing braces
manually.
To enter a horizontal array in a spreadsheet, select the corresponding number of blank cells in a
row, type the formula ={1,2,3,4} in the formula bar, and press Ctrl + Shift + Enter. The result will
be similar to this:

As you see in the screenshot, Microsoft Excel wraps an array constant in another set of braces,
exactly like it does when you are entering an array formula in Excel.
2. Vertical array constant
A vertical array constant resides in a column. You create it in the same way as a horizontal array
with the only difference that you delimit the items with semicolons, for example:

={11; 22; 33; 44}

3. Two-dimensional array constant


To create a two-dimensional array in Excel, you separate the items in each row with commas,
and delimit each column with semicolons.
={"a", "b", "c"; 1, 2, 3}

Working with Excel array constants


Array constants are one of the cornerstones of Excel array formulas. The following information
and tips might help you use them in the most efficient way.
1. Elements of an array constant
An Excel array constant can contain numbers, text values, Booleans (TRUE and FALSE) and
error values, separated by commas or semicolons.
You can enter a numerical value as an integer, decimal, or in scientific notation. If you use text
values, they should be surrounded in double quotes (") like in any Excel formula.
An array constant cannot include other arrays, cell references, ranges, dates, defined names,
formulas, or Excel functions.
2. Naming array constants
To make an array constant easier to use, give it a name:

Switch to the Formulas tab > Defined Namesgroup and click Define Name. Alternatively,
press Crtl + F3 and click New.
Type the name in the Name

In the Refers tobox, enter the items of your array constant surrounded in braces with the
preceding equality sign (=). For example:
={"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"}

Click OK to save your named array and close the window.


To enter the named array constant in a sheet, select as many cells in a row or column as there
are items in your array, type the array's name in the formula bar preceded with the = sign and
press Ctrl + Shift + Enter.
The result should resemble this:

3. Preventing errors
If your array constant does not work correctly, check for the following problems:

Delimit the elements of your array constant with the proper character - comma in
horizontal array constants and semicolon in vertical ones.
Selected a range of cells that exactly matches the number of items in your array
constant. If you select more cells, each extra cell will have the #N/A error. If you select fewer
cells, only a part of the array will be inserted.
Using array constants in Excel formulas
Now that you are familiar with the concept of array constants, let's see how you can use arrays
in Excel formulas to solve your practical tasks.

Example 1. Sum N largest / smallest numbers in a range


You start by creating a vertical array constant containing as many numbers as you want to sum.
For example, if you want to add up 3 smallest or largest numbers in a range, the array constant
is {1,2,3}.
Then, you take either LARGE or SMALL function, specify entire range of cells in the first
parameter and include the array constant in the second. Finally, embed it in the SUM function,
like this:
Sum the largest 3 numbers: =SUM(LARGE(range, {1,2,3}))
Sum the smallest 3 numbers: =SUM(SMALL(range, {1,2,3}))
Don't forget to press Ctrl + Shift + Enter since you are entering the Excel array formula, and you
will get the following result:

In a similar fashion, you can calculate the average of N smallest or largest values in a range:
Average of the top 3 numbers: =AVERAGE(LARGE(range, {1,2,3}))
Average of the bottom 3 numbers: =AVERAGE(SMALL(range, {1,2,3}))
Example 2. Array formula to count cells with multiple conditions
Suppose, you have a list of orders and you want to know how many times a giver seller has sold
given products.
The easiest way would be using a COUNTIFS formula with multiple conditions. However, if you
want to include many products, your COUNTIFS formula may grow too big in size. To make it
more compact, you can use COUNTIFS together with SUM and include an array constant in
one or several arguments, for example:
=SUM(COUNTIFS(range1, "criteria1", range2, {"criteria1", "criteria2"}))

The real formula may look as follows:


=SUM(COUNTIFS(B2:B9, "sally", C2:C9, {"apples", "lemons"}))

Our sample array consists of only two elements since the goal is to demonstrate the approach.
In your real array formulas, you may include as many elements as your business logic requires,
provided that the total length of the formula does not exceed 8,192 characters in Excel 2013,
2010 and 2007 (1,024 characters in Excel 2003 and lower) and your computer is powerful
enough to process large arrays. Please see the limitations of array formulas in Excel for more
details.
And here is an advanced Excel array formula example that finds the sum of all matching values
in a table: SUM and VLOOKUP with an array constant.
AND and OR operators in Excel array formulas
An array operator tells the formula how you want to process the arrays - using AND or OR logic.

AND operator is the asterisk (*). It is used to return a value if ALL of the conditions
specified in your array formula evaluate to TRUE.
OR operator is the plus sign (+). You use it to return a value if ANY of the conditions in a
given expression evaluates to TRUE.
Array formula with the AND operator
In this example, we find the sum of sales where the sales person is Mike AND the product
isApples:
=SUM((A2:A9="Mike") * ( B2:B9="Apples") * ( C2:C9))
Or

=SUM(IF(((A2:A9="Mike") * ( B2:B9="Apples")), ( C2:C9)))

Excel array formula with the OR operator


The following array formula with the OR operator (+) adds up all sales where the sales person is
Mike OR product is Apples:
=SUM(IF(((A2:A9="Mike") + ( B2:B9="Apples")), ( C2:C9)))

Tip. In modern versions of Excel 2013, 2010 or 2007, the use of array formulas in such
scenarios is actually superfluous and a simple SUMIFS formula could produce exactly the same
results. Nevertheless, the AND and OR operators in array formulas may prove helpful in other
more complex scenarios, let alone very good gymnastics of mind : )
Double unary operator in Excel array formulas
If you've ever worked with array formulas in Excel, chances are you came across a few ones
containing a double dash (--) and you may have wondered what it was used for.

A double dash, which is technically called the double unary operator, is used to convert nonnumeric Boolean values (TRUE / FALSE) returned by some expressions into 1 and 0 that an
Excel array function can understand.
The following example will hopefully make things easier to understand. Suppose you have a list
of dates in column A and you want to know how many dates occur in January, regardless of the
year.
The following formula will work a treat:
=SUM(--(MONTH(A2:A10)=1))
Since this is an Excel array formula, remember to press Ctrl + Shift + Enter to complete it.
If you are interested in some other month, replace 1 with a corresponding number. For example,
2 stands for February, 3 means March, and so on. To make the formula more flexible, you can
specify the month number in some cell, like demonstrated in the screenshot:

And now, let's analyze how this Excel array formula works. The MONTH function returns the
month of each date in cells A2 through A10 represented by a serial number, which producing the
array {2;1;4;2;12;1;2;12;1}.
After that, each element of the array is compared to the value in cell D1, which is number 1 in
this example. The result of this comparison is an array of Boolean values TRUE and FALSE. As
you remember, you can select a certain portion of an array formula and press F9 to see what
that part equates to:

Finally, you have to convert these Boolean values to 1's and 0's that the SUM function can
understand. And this is what the double unary operator is needed for. The first unary coerces
TRUE/FALSE to -1/0, respectively. The second unary negates the values, i.e. reverses the sign,

turning them into +1 and 0, which most of Excel functions can understand and work with. If you
remove the double unary from the above formula, it won't work.
I am hopeful this short tutorial has proved helpful on your road to mastering Excel array
formulas. Next week, we are going to continue with Excel arrays by focusing on advanced
formula examples. Please stay tuned and thank you for reading!

How to count cells with text and characters in Excel 2010-2013


This tutorial shows how to count cells with text and characters in Excel 2010-2013. You will find
helpful Excel formulas for counting characters in one or several cells, character limits for cells
and get a link to see how to find the number of cells that contain specific text.
Initially Excel was designed to work with numbers, thus you can always choose one of three
ways to perform any counting or summing operation with digits. Fortunately, the developers of
this helpful application didn't forget about text. Thus, I'm writing this article to show you how to
use different options and formulas in Excel to count cells with text or count certain
characters in a string.
Below you can find the options I'm going to cover:

Excel - Count cells with text


Excel formula to count characters in a cell
Count characters in several cells in Excel
Formula to count specific characters in a cell
Count the number of occurrences of certain character in a range
Count the number of occurrences of certain text in a range
Excel character limits for cells
Count cells that contain specific text
At the end, you'll also find links to our previous blog posts related to counting cells in Excel.
Excel - Count cells with text
If you need to count the number of cells with text in Excel, you can use the COUNTIF
function:
=COUNTIF(A2:D10,"*")

Here A2:D10 is your range with data and "*" is a wildcard matching any number of characters.

Just enter the formula with the correct range to any cell where you want to see the result and
press Enter. The result will be right there.
Note. The logical values TRUE and FALSE are not counted as text. In addition, numbers are
not counted by "*" if they are not entered as text starting with an apostrophe ('). Empty cells
beginning with an apostrophe (') will be counted.
One more formula you can use to count cells with text in Excel is
=COUNTA(RANGE)-COUNT(RANGE).

This formula will ignore both dates and numbers.


Another function you can use in Excel to count the number of cells with text is an array formula
that needs to be entered with Ctrl+Shift+Enter. You can use SUMPRODUCT to count text
values along with the function ISTEXT like this:
=SUMPRODUCT(--ISTEXT(RANGE))
The double hyphen, or double unary, coerces the result of ISTEXT from a logical value of TRUE
or FALSE, to 1's and 0's. SUMPRODUCT then adds these values together to get a result.

Thus if you need to quickly count cells with text in Excel, feel free to use one of the formulas
above.
Excel formula to count characters in a cell
I can presume that in one of the future versions of Excel the Status Bar will show the number
characters in a string. While we are hoping and waiting for the feature, you can use the following
simple formula:
=LEN(A1)
In this formula A1 is the cell where the number of text characters will be calculated.

The point is Excel has character limitations. For example, the header cannot exceed 254
characters. If you exceed the maximum, the header will be cut. The formula can be helpful when
you have really long strings in your cells and need to make sure that your cells don't exceed 254
characters to avoid problems with importing or displaying your table in other sources.
Thus, after applying the function =LEN(A1) to my table, I can easily see the descriptions that are
too long and need to be shortened. Thus, feel free to use this formula in Excel each time you
need to count the number of characters in a string. Just create the Helper column, enter the
formula to the corresponding cell and copy it across your range to get the result for each cell in
your column.
Excel - Count characters in several cells
You may also need to count the number of characters from several cells. In this case you
can use the following formula:
=SUM(LEN(RANGE))

Note. The above formula must be entered as an array formula. To enter it as an array formula,
press Ctrl+Shift+Enter.

This formula can be helpful if you want to see if any rows exceed the limitations before merging
or importing your data tables. Just enter it to the Helper column and copy across using the fill
handle.
Excel formula to count certain characters in a cell
In this part, I'll show you how to calculate the number of times a single character occurs in a cell
in Excel. This function really helped me when I got a table with multiple IDs that couldn't contain
more than one zero. Thus, my task was to see the cells where zeros occurred and where there
were several zeros.
If you need to get the number of occurrences of certain character in a cell or if you want to see if
your cells contain invalid characters, use the following formula to count the number of
occurrences of a single character in a range:
=LEN(A1)-LEN(SUBSTITUTE(A1,"a",""))

Here "a" is a character you need to count in Excel.

What I really like about this formula is that it can count the occurrences of a single character as
well as part of some text string.
Count the number of occurrences of certain character in a range
If you want to count the number of occurrences of certain character in several cells or in
one column, you can create a Helper column and paste there the formula I described in the
previous part of the article =LEN(A1)-LEN(SUBSTITUTE(A1,"a","")). Then you can copy it
across the column, sum this column and get the expected result. Sounds too time consuming,
doesn't it?
Fortunately, Excel often gives us more than one way to get the same result and there is a more
simple option. You can count the number of certain characters in a range using this array
formula in Excel:
=SUM(LEN(RANGE)-LEN(SUBSTITUTE(RANGE,"a","")))
Note. The above formula must be entered as an array formula. Please make sure you
press Ctrl+Shift+Enter to paste it.

Count the number of occurrences of certain text in a range


The following array formula (must be entered with Ctrl+Shift+Enter) will help you count the
number of occurrences of certain text in a range:
=SUM((LEN(C2:D66)-LEN(SUBSTITUTE(C2:D66,"Excel","")))/LEN("Excel"))
For example, you can count the number of times the word "Excel" is entered in your table.
Please don't forget about space or the function will count words beginning with certain text, not
the isolated words.

Thus, if you have certain text snippet scattered around your table and need to count its
occurrences really quickly, use the formula above.
Excel character limits for cells
If you have worksheets with large amount of text in several cells, you may find the following
information helpful. The point is that Excel has a limitation on the number of characters you can
enter to a cell.

Thus, the total number of characters that a cell can contain is 32,767.
A cell can display only 1,024 characters. At the same time, the Formula bar can show
you all 32,767 symbols.
The maximum length of formula contents is 1,014 for Excel 2003. Excel 2007-2013 can
contain 8,192 characters.
Please consider the facts above when you have long headers or when you are going to merge
or import your data.
Count cells that contain specific text
If you need to count the number of cells that contain certain text, feel free to use the COUNTIF
function. You will find it beautifully described in COUNTIF formulas with wildcard characters
(partial match).
You may also be interested in
We have already written about counting and calculating in Excel. If you haven't found the
necessary information please have a look at one of the following articles published on our blog.

3 ways to count empty cells in Excel. In this post, you'll find quick tips for counting blank
cells in your table.
Learn how to count non-empty cells in Excel if you need to see the number of nonblanks in your worksheet.
COUNTIF in Excel - count if not blank, greater than, duplicate or unique. This article
focuses on the Excel COUNTIF function designed for counting cells with the condition you
specify.
If your task is to calculate cells by color, feel free to read how to count and sum cells by
color in Excel 2010 and 2013.
Last but not least, explore the possibilities of Excel COUNTIFS and COUNTIF with
multiple criteria.
Hope this article will help you next time you need to count the number of cells with text or
certain character occurrences in your spreadsheet. I tried to cover all options that can help you I described how to count cells with text, showed you an Excel formula for counting characters in
one cell or in a range of cells, you found how to count the number of occurrences of certain
characters in a range. Also you can benefit from one of the links to our previous posts to find
many additional details.

That's all for today. Be happy and excel in Excel!

6 most efficient uses of the INDEX function in Excel


In this tutorial, you will find a number of Excel INDEX formula examples that demonstrate the
most efficient uses of INDEX in Excel.
Of all Excel functions whose power is often underestimated and underutilized, INDEX would
definitely rank somewhere in the top 10. In the meantime, this Excel function is smart, supple
and versatile.
So, what is the INDEX function in Excel? Essentially, an INDEX formula returns a cell reference
from within a given array or range. In other words, you use INDEX when you know (or can
calculate) the position of an element in a range and you want to get the actual value of that
element.
This may sound a bit trivial, but once you realize the real potential of the Excel INDEX function,
it could make crucial changes to the way you calculate, analyze and present data in your
worksheets.

o
o
o
o
o
o

Excel INDEX function - syntax and basic uses


How to use INDEX function in Excel - formula examples
Get Nth item from the list
Get all values in a row or column
INDEX with other Excel functions
Excel INDEX formula for dynamic range
Vlookup with INDEX / MATCH
Get one range from the list of ranges
Excel INDEX function - syntax and basic uses
There are two versions of the INDEX function in Excel - array form and reference form. Both
forms can be used in all versions of Microsoft Excel 2013, Excel 2010, Excel 2007 and 2003.
INDEX array form
The INDEX array form returns the value of an element in a table or an array based on the row
and column numbers you specify.

INDEX( array, row_num, [column_num])


array - is a range of cells, named range, or table.
row_numr - is the row number in the array from which to return a value. If row_num is
omitted, column_num is required.
column_num - is the column number from which to return a value. If column_num is
omitted, row_num is required.
For example, the formula =INDEX(A1:D6, 4, 3) returns the value at the intersection of the
4th row and 3rd column in range A1:D6, which is the value in cell C4.

To get an idea of how the Excel INDEX formula works on real data, please have a look at the
following example:

Instead of entering the row and column numbers in the formula, you can supply the cell
references to get a more universal formula: =INDEX($B$2:$D$6, G2, G1)
So, this INDEX formula returns the number of items exactly at the intersection of the product
number specified in G2 (row_num) and week number entered in cell G1 (column_num).
Tip. The use of absolute references ($B$2:$D$6) instead of relative references (B2:D6) in the
array argument makes it easier to copy the formula to other cells. Alternatively, you can convert
a range to a table (Ctrl + T) and refer to it by the table name.
INDEX array form - things to remember
1. If the array argument consists of only one row or column, you may or may not specify the
corresponding row_num or column_num argument.
2. If the array argument includes more than one row and row_num is omitted or set to 0, the
Excel INDEX function returns an array of the entire column. Similarly, if array includes more
than one column and the column_num argument is omitted or set to 0, the INDEX formula
returns the entire row. Here's a formula example that demonstrates this behavior.
3. The row_num and column_num arguments must refer to a cell within array; otherwise, the
INDEX formula will return the #REF! error.
INDEX reference form
The reference form of the Excel INDEX function returns the cell reference at the intersection of
the specified row and column.

INDEX(reference, row_num, [column_num], [area_num] )


reference - is one or several ranges.
If you are entering more than one range, separate the ranges by commas and enclose the
reference argument in parentheses, for example (A1:B5, D1:F5).

If each range in reference contains only one row or column, the corresponding row_num or
column_num argument is optional.

row_num - the row number in the range from which to return a cell reference, it's similar
to the array form.
column_num - the column number from which to return a cell reference, also works
similarly to the array form.
area_num - an optional parameter that specifies which range from the reference
argument to use. If omitted, the INDEX formula will return the result for the first range listed in
reference.
For example, the formula =INDEX((A2:D3, A5:D7), 3, 4, 2) returns the value of cell D7, which is
at the intersection of the 3rd row and 4th column in the second area (A5:D7).

INDEX reference form - things to remember


1. If the row_num or column_num argument is set to zero (0), an Excel INDEX formula returns
the reference for the entire column or row, respectively.
2. If both row_num and column_num are omitted, the INDEX function returns the area specified
in the area_num argument.
3. All of the _num arguments (row_num, column_num and area_num) must refer to a cell within
reference; otherwise, the INDEX formula will return the #REF! error.
Both of the INDEX formulas we've discussed so far are very simple and only illustrate the
concept. Your real formulas are likely to be far more complex than that, so let's explore a few
most efficient uses of INDEX in Excel.
How to use INDEX function in Excel - formula examples
Perhaps there aren't many practical uses of Excel INDEX by itself, but in combination with other
functions such as MATCH or COUNTA, it can make very powerful formulas.

Source data
All of our Excel INDEX formulas (except for the last one), we will use the below data. For
convenience purposes, it is organized in a table named SourceData.

The use of tables or named ranges can make formulas a bit longer, but it also makes them
significantly more flexible and better readable. To adjust any INDEX formula for your
worksheets, you need only to modify a single name, and this fully makes up for a longer formula
length.
Of course, nothing prevents you from using usual ranges if you want to. In this case, you simply
replace the table name SourceData with the appropriate range reference.
1. Getting the Nth item from the list
This is the basic use and the easiest Excel INDEX function example. To fetch a certain item
from the list, you just write =INDEX(range, n) where range is a range of cells or a named range,
and n is the position of the item you want to get.

When working with Excel tables, you can select the column using the mouse and Excel will pull
the column's name along with the table's name in the formula:

To get a value of the cell at the intersection of a given row and column, you use the same
approach with the only difference that you specify both - the row number and the column
number. In fact, you already saw such a formula in action when we discussed INDEX array
form.
And here's one more example. In our sample table, to find the 2nd biggest planet in the Solar
system, you sort the table by the Diameter column, and use the following INDEX formula:
=INDEX(SourceData, 2, 3)

Array is the table name, or a range reference, SourceData in this example.


Row_num is 2 because you are looking for the second item in the list, which is in the 2nd
Column_num is 3 because Diameter is the 3rd column in the table.
If you want to return the planet's name rather than diameter, change column_num to 1. And
naturally, you can use a cell reference in the row_num and/or column_num arguments to make

your Excel INDEX formula more versatile, as demonstrated in the screenshot below:

2. Getting all values in a row or column


Apart from retrieving a single cell, the Excel INDEX function is able to return an array of values
from the entire row or column. To get all values from a certain column, you have to omit the
row_num argument or set it to 0. Likewise, to get the entire row, you pass empty value or 0 in
column_num.
Such INDEX formulas can hardly be used on their own, because Excel is unable to fit the array
of values returned by the formula in a single cell, and you would get the #VALUE! error instead.
However, if you use INDEX in conjunction with other Excel functions, such as SUM or
AVERAGE, you will get awesome results.
For example, you could use the following Index Excel formula to calculate the average planet
temperature in the Solar system:
=AVERAGE(INDEX(SourceData, , 4))

In the above formula, the column_num argument is 4 because Temperature in the 4th column in
our table. The row_num parameter is omitted.

In a similar manner, you can find the minimum and maximum temperatures:
=MAX(INDEX(SourceData, , 4))
=MIN(INDEX(SourceData, , 4))
And calculate the total planet mass (Mass is the 2nd column in the table):
=SUM(INDEX(SourceData, , 2))
From practical viewpoint, the INDEX function in the above formula is superfluous. You can
simply write =AVERAGE(range) or =SUM(range) and get the same results.
When working with real data, this feature may prove helpful as part of more complex formulas
you use for data analysis.
3. Using INDEX with other Excel functions (SUM, AVERAGE, MAX, MIN)
From the previous examples, you might be under an impression that an INDEX formula in Excel
returns values, but the reality is that it returns a reference to the cell containing the value. And
this example demonstrates the true nature of the Excel INDEX function.
Since the result of an INDEX formula is a reference, we can use it within other functions to
make adynamic range. Sounds confusing? The following formula will make everything clear.
Suppose you have a formula =AVERAGE(A1:A10) that returns an average of the values in cells
A1:A10. Instead of writing the range directly in the formula, you can replace either A1 or A10, or
both, with INDEX functions, like this:

=AVERAGE(A1 : INDEX(A1:A20,10))
Both of the above formulas will deliver the same result because the INDEX function also returns
a reference to cell A10 (row_num is set to 10, col_num omitted). The difference is that the range
is the AVERAGE / INDEX formula is dynamic, and once you change the row_num argument in
INDEX, the range processed by the AVERAGE function will change and the formula will return a
different result.
Apparently, the INDEX formula's route appears overly complicated, but it does have practical
applications, as demonstrated in the following examples.
Example 1. Calculate average of the top N items in the list
Let's say you want to know the average diameter of the N biggest planets in our system. So,
you sort the table by Diameter column from largest to smallest, and use the following Average /
Index formula:
=AVERAGE(C5 : INDEX(SourceData[Diameter], B1))

Example 2. Sum items between the specified two items


In case you want to define the upper-bound and lower-bound items in your formula, you just
need to employ two INDEX functions to return the first and the last item you want.
For example, the following formula returns the sum of values in the Diameter column between
the two items specified in cells B1 and B2:
=SUM(INDEX(SourceData[Diameter],B1) : INDEX(SourceData[Diameter], B2))

4. INDEX formula to create dynamic ranges and drop-down lists


As it often happens, when you start organizing data in a worksheet, you may not know how
many entries you will eventually have. It's not the case with our planets table, which seems to
be complete, but who knows...
Anyway, if you have a changing number of items in a given column, say from A1 to An, you may
want to create a named range that includes all cells with data. At that, you want the range to
adjust automatically as you add new items or delete some of the existing ones. For example, if
you currently have 10 items, your named range is A1:A10. If you add a new entry, the named
range automatically expands to A1:A11, and if you change your mind and delete that newly
added data, the range automatically reverts to A1:A10.
The main advantage of this approach is that you do not have to constantly update all formulas in
your workbook to ensure they refer to correct ranges.
One way to define a dynamic range is using Excel OFFSET function:
=OFFSET(Sheet_Name!$A$1, 0, 0, COUNTA(Sheet_Name!$A:$A), 1)
Another possible solution is to use Excel INDEX along with COUNTA:
=Sheet_Name!$A$1:INDEX(Sheet_Name!$A:$A, COUNTA(Sheet_Name!$A:$A))
In both formulas, A1 is the cell containing the first item of the list and the dynamic range
produced by both formulas will be identical.
The difference is in the approaches. The Excel INDEX function finds a cell at the intersection of
a particular row and column, while the OFFSET function moves from the starting point by a
certain number of rows and/or columns. The COUNTA function, used in both formulas,

calculates the number of non-empty cells in the column and ensures that only cells with data are
included in the named range.
The following screenshot demonstrates how you can use such Index formula to create
a dynamic drop-down list.

Tip. The easiest way to create a dynamically updated drop-down list in Excel is making anamed
list based on a table. In this case, you won't need any complex formulas since Excel tables are
dynamic ranges per se.
You can also use the INDEX function in Excel to create dependent drop-down lists and the
following tutorial explains the steps: Making a cascading drop-down list in Excel.

5. Powerful Vlookups with INDEX / MATCH


Performing vertical lookups in Excel - this is where the Excel INDEX function truly shines. If you
have ever tried using Excel VLOOKUP function, you are well aware of its numerous limitations,
such as inability to pull values from columns to the left of the lookup column or 255 chars limit
for a lookup value.
The INDEX / MATCH liaison is superior to VLOOKUP in many respects:

No problems with left vlookups.


No limit to the lookup value size.
No sorting is required (VLOOKUP with approximate match does require sorting the
lookup column in ascending order).
You are free to insert and remove columns in a table without updating every associated
formula.
And the last but not the least, INDEX / MATCH does not slow down your Excel like
multiple Vlookups do.
You use INDEX / MATCH in the following way:
=INDEX (column to return a value from, (MATCH (lookup value, column to lookup against,
0))
For example, if we flip our source table so that Planet Name becomes the right-most column,
the INDEX / MATCH formula still fetches a matching value from the left-hand column without a
hitch.

For more tips and formula example, please see the Excel INDEX / MATCH tutorial.

6. Excel INDEX formula to get 1 range from a list of ranges


Another smart and powerful use of the INDEX function in Excel is the ability to get one range
from a list of ranges.
Suppose, you have several lists with a different number of items in each. Believe me or not, you
can calculate the average or sum the values in any selected range with a single formula.
First off, you create a named range for each list; let it be PlanetsD and MoonsD in this example:

I hope the above image explains the reasoning behind the ranges' names : ) BTW,
the Moons table is far from complete, there are 176 known natural moons in our Solar System,
Jupiter alone has 63 currently, and counting. For this example, I picked random 11, well...
maybe not quite random - moons with the most beautiful names : )
Please excuse the digression, back to our Excel INDEX formula. Assuming that PlanetsD is
your range 1 and MoonsD is range 2, and cell B1 is where you put the range number, you can
use the following Index formula to calculate the average of values in the selected named range:
=AVERAGE(INDEX((PlanetsD, MoonsD), , , B1))
Please pay attention that now we are using the Reference form of the INDEX function, and the
number in the last argument (area_num) tells the formula which range to pick.
In the screenshot below, area_num (cell B1) is set to 2, so the formula calculates the average
diameter of Moons because the range MoonsD comes 2nd in the reference argument.

If you work with multiple lists and don't want to bother remembering the associated numbers,
you can employ a nested IF function to do this for you:
=AVERAGE(INDEX((PlanetsD, MoonsD), , , IF(B1="planets", 1, IF(B1="moons", 2))))
In the IF function, you use some simple and easy-to-remember list names that you want your
users to type in cell B1 instead of numbers. Please keep this in mind, for the formula to work
correctly, the text in B1 should be exactly the same (case-insensitive) as in the IF's parameters,
otherwise your Index formula will throw the #VALUE error.
To make the formula even more user-friendly, you can use Excel Data Validation to create
a drop-down list with predefined names to prevent spelling errors and misprints:

Finally, to make your INDEX formula absolutely perfect, you can enclose it in the IFERROR
functionthat will prompt the user to choose an item from the drop-down list if no selection has
been made yet:
=IFERROR(AVERAGE(INDEX((PlanetsD, MoonsD), , , IF(B1="planet", 1, IF(B1="moon",
2)))), "Please select the list!")
This is how you use INDEX formulas in Excel. I am hopeful these examples showed you a way
to harness the potential of the Excel INDEX function in your worksheets. Thank you for reading!

Using OFFSET function in Excel - formula examples


In this tutorial, we are going to shed some light on one of the most mysterious inhabitants of the
Excel universe - the OFFSET function.

So, what is OFFSET in Excel? In a nutshell, the OFFSET formula returns a reference to a range
that is offset from a starting cell or a range of cells by a specified number of rows and columns.
The Excel OFFSET function may be a bit tricky to get, so let's go over a short technical
explanation first (I'll do my best to keep it simple) and then we will cover a few of the most
efficient ways to use OFFSET in Excel.

o
o
o
o

Excel OFFSET function - syntax and basic uses


Using OFFSET in Excel - formula examples
Excel OFFSET and SUM
OFFSET and AVERAGE / MAX / MIN
Excel OFFSET formula to create a dynamic range
Excel OFFSET and VLOOKUP
OFFSET function - limitations and alternatives

Excel OFFSET function - syntax and basic uses


The syntax of the OFFSET function is as follows:
OFFSET(reference, rows, cols, [height], [width])
The first 3 arguments are required and the last 2 are optional. All of the arguments can be
references to other cells or results returned by other Excel formulas.
It looks like Microsoft made a good effort to put some meaning into the parameters' names, and
they do give a hint at what you are supposed to specify in each.

Required arguments:
Reference - a cell or a range of adjacent cells from which you base the offset. You can
think of it as the starting point.
Rows - The number of rows to move from the starting point, up or down. If rows is a
positive number, the formula moves below the starting reference, in case of a negative number
it goes above the starting reference.
Cols - The number of columns you want the formula to move from the starting point. As
well as rows, cols can be positive (to the right of the starting reference) or negative (to the left of
the starting reference).
Optional arguments:
Height - the height, in number of rows, of the returned reference.
Width - the width, in number of columns, of the returned reference.
Both the height and width arguments must always be positive numbers. If either is omitted, the
height or width of the starting reference is used.
And now, let's illustrate the theory with an example of the simplest OFFSET formula.
Excel OFFSET formula example
The following OFFSET formula returns a cell reference based on a starting point, rows and cols
that you specify:
=OFFSET(A1,3,1)
The formula tells Excel to take cell A1 as the starting point (reference), then move 3 rows down
(rows argument) and 1 column to the left (cols argument). As the result, this OFFSET formula
returns the value in cell B4.
The image on the left shows the function's route and the screenshot on the right demonstrates
how you can use the OFFSET formula on real-life data. The only difference between the two
formulas is that the second one (on the right) includes a cell reference (E1) in the rows
argument. But since cell E1 contains number 3, and exactly the same number appears in the

rows argument of the first formula, both would return an identical result - the value in B4.

Excel OFFSET formulas - things to remember


The OFFSET function is Excel doesn't actually move any cells or ranges, it just returns a
reference.
When an OFFSET formula returns a range of cells, the rows and cols arguments always
refer to the upper-left cell in the returned rage.
The reference argument must include a cell or range of adjacent cells, otherwise your
formula will return the #VALUE! error.
If the specified rows and/or cols move a reference over the edge of the spreadsheet,
your Excel OFFSET formula will return the #REF! error.
The OFFSET function can be used within any other Excel function that accepts a cell /
range reference in its arguments.
For example, if you try to use the formula =OFFSET(A1,3,1,1,3) on its own, it will throw a
#VALUE! error, since a range to return (1 row, 3 columns) does not fit into a single cell.
However, if you embed it into the SUM function, like this:
=SUM(OFFSET(A1,3,1,1,3))
The formula will return the sum of values in a 1-row by 3-column range that is 3 rows below and
1 column to the right of cell A1, i.e. the total of values in cells B4:D4.

Why do I use OFFSET in Excel?


Now that you know what the Excel OFFSET function does, you may be asking yourself "Why
bother using it?" Why not simply write a direct reference like B4:D4?
The Excel OFFSET formula is very good for:
Creating dynamic ranges: References like B1:C4 are static, meaning they always refer to a
given range. But some tasks are easier to perform with dynamic ranges. This is particularly the
case when you work with changing data, e.g. you have a worksheet where a new row or column
is added every week.
Getting the range from the starting cell. Sometimes, you may not know the actual address of
the range, though you do know it starts from a certain cell. In such scenarios, using OFFSET in
Excel is the right way to go.
How to use OFFSET function in Excel - formula examples
I hope you haven't get bored with that much of theory. Anyway, now we are getting to the most
exciting part - practical uses of the OFFSET function.
Excel OFFSET and SUM functions
The example we discussed a moment ago demonstrates the simplest usage of OFFSET & SUM
in Excel. Now, let's look at these functions at another angle and see what else they can do.
Example 1. A dynamic SUM / OFFSET formula
When working with continuously updated worksheets, you may want to have a SUM formula
that automatically picks all newly added rows.
Suppose, you have the source data similar to what you see in the screenshot below. Every
month a new row is added just above the SUM formula, and naturally, you want to have it
included in the total. On the whole, there are two choices - either update the range in the SUM

formula each time manually or have the Excel OFFSET formula do this for you.

Since the first cell of the range to sum will be specified directly in the SUM formula, you only
have to decide on the parameters for the Excel OFFSET function, which will get that last cell of
the range:

Reference - the cell containing the total, B9 in our case.


Rows - the cell right above the total, which requires the negative number -1.
Cols - it's 0 because you don't want to change the column.
So, here goes the SUM / OFFSET formula pattern:
=SUM(first cell:(OFFSET(cell with total, -1,0)
Tweaked for the above example, the formula looks as follows:
=SUM(B2:(OFFSET(B9, -1, 0)))

And as demonstrated in the below screenshot, it works flawlessly:

Example 2. Excel OFFSET formula to sum the last N rows


In the above example, suppose you want to know the amount of bonuses for the last N months
rather than grand total. You also want the formula to automatically include any new rows you
add to the sheet.
For this task, we are going to use Excel OFFSET in combination with the SUM and COUNT /
COUNTA functions:
=SUM(OFFSET(B1,COUNT(B:B)-E1+1,0,E1,1))
or
=SUM(OFFSET(B1,COUNTA(B:B)-E1,0,E1,1))

The following details can help you understand the formulas better:

Reference - the header of the column whose values you want to sum, cell B1 in this
example.
Rows - to calculate the number of rows to offset, you use either the COUNT or COUNTA
function.
COUNT returns the number of cells in column B that contain numbers, from which you subtract
the last N months (the number is cell E1), and add 1.
If COUNTA is your function of choice, you don't need to add 1, since this function counts all nonempty cells, and a header row with a text value adds an extra cell that our formula needs.
Please note that this formula will work correctly only on a similar table structure - one header
row followed by rows with numbers. For different table layouts, you may need to make some
adjustments in the OFFSET/COUNTA formula.

Cols - the number of columns to offset is zero (0).


Height - the number of rows to sum is specified in E1.
Width - 1 column.
Using Excel OFFSET function with AVERAGE, MAX, MIN
In the same manner as we calculated the bonuses for the last N months, you can get an
average of the last N days, weeks or years as well as find their maximum or minimum values.
The only difference between the formulas is the first function's name:
=AVERAGE(OFFSET(B1,COUNT(B:B)-E1+1,0,E1,1))
=MAX(OFFSET(B1,COUNT(B:B)-E1+1,0,E1,1))
=MIN(OFFSET(B1,COUNT(B:B)-E1+1,0,E1,1))

The key benefit of these formulas over the usual AVERAGE(B5:B8) or MAX(B5:B8) is that you
won't have to update the formula every time your source table gets updated. No matter how
many new rows are added or deleted in your Excel worksheet, the OFFSET formulas will
always refer to the specified number of last (lower-most) cells in the column.

Excel OFFSET formula to create a dynamic range


Used in conjunction with COUNTA, the OFFSET function can help you make a dynamic range
that may prove useful in many scenarios, for example to create automatically updatable dropdown lists.
The OFFSET formula for a dynamic range is as follows:
=OFFSET(Sheet_Name!$A$1, 0, 0, COUNTA(Sheet_Name!$A:$A), 1)
Where:

Reference is expressed as the sheet name followed by the exclamation mark and the
address of the cell containing the first item to be included in the named range. Please note the
use of the absolute cell references (with the $ sign), for example Sheet1!$A$1.
Rows and Cols parameters are both 0, since there are no columns or rows to offset.
Height is the key point that does the trick. You use the COUNTA function to calculate the
number of non-blank cells in the column containing the named range's items. Please pay
attention that in COUNTA's parameter, you should specify the sheet name in addition to the
column name, e.g. COUNTA(Sheet_Name!$A:$A).
Width is 1 column.
Once you've created a dynamic named range with the above OFFSET formula, you can use
Excel Data Validation to make a dynamic dropdown list that will update automatically as soon

as you add or remove items from the source list.

For the detailed step-by-step guidance on creating drop-down lists in Excel, please check out
the following tutorials:

Creating drop-down lists in Excel - static, dynamic, from another workbook


Making a dependent drop down list
Excel OFFSET & VLOOKUP
As everyone knows, simple vertical and horizontal lookups in Excel are performed with the
VLOOKUP or HLOOKUP function, respectively. However, these functions have too many
limitations and often stumble in more powerful and complex lookup formulas. So, in order to
perform more sophisticated lookups in your Excel tables, you have to look for alternatives such
as INDEX, MATCH and OFFSET.

Example 1. OFFSET formula for a left Vlookup in Excel


One of the most infamous limitations of the Excel VLOOKUP function is inability to look at its
left, meaning that VLOOKUP can only return a value to the right of the lookup column.
In our sample lookup table, there are two columns - month names (column A) and bonuses
(column B). If you want to get a bonus for a certain month, this simple VLOOKUP formula will
work without a hitch:
=VLOOKUP(B1, A5:B11, 2, FALSE)
However, as soon as you swap the columns in the lookup table, this will immediately result in
the #N/A error:

To handle a left-side lookup, you need a more versatile function that does not really care where
the return column resides. One of possible solutions is using a combination of INDEX and
MATCH functions. Another approach is using OFFSET, MATCH and ROWS:
=OFFSET(lookup table, MATCH(lookup value, OFFSET(lookup table, 0, 1, ROWS(lookup
table), 1) ,0) -1, 0, 1, 1)
In our example, the lookup table is A5:B9 and the lookup value is in cell B1, so the above
formula evolves into:
=OFFSET(A5:B9, MATCH(B1, OFFSET(A5:B9, 0, 1, ROWS(A5:B9), 1) ,0) -1, 0, 1, 1)

I know the formula looks a bit clumsy, but it does work :)

Example 2. How to do an upper lookup in Excel


As is the case with Excel VLOOKUP being unable to look at the left, its horizontal counterpart HLOOKUP function - cannot look upwards to return a value.
If you need to scan an upper row for a matching value, the OFFSET / MATCH / ROWS formula
can help again, but this time you will have to enhance it with the COLUMNS function, like this:
=OFFSET(lookup table, 0, MATCH(lookup value, OFFSET(lookup table, ROWS(lookup
table) -1, 0, 1, COLUMNS(lookup table)), 0) -1, 1, 1)
Assuming that the lookup table is E4:I5 and the lookup value is in cell E1, the formula goes as
follows:
=OFFSET(E4:I5, 0, MATCH(E1, OFFSET(E4:I5, ROWS(E4:I5) -1, 0, 1, COLUMNS(E4:I5)), 0)
-1, 1, 1)

Example 3. Two-way lookup (by column and row values)


Two-way lookup in Excel returns a value based on matches in both the rows and columns. And
you can use the following double lookup array formula to find a value at the intersection of a
certain row and column:
=OFFSET(lookup table, MATCH(row lookup value, OFFSET(lookup table, 0, 0,
ROWS(lookup table), 1), 0) -1, MATCH(column lookup value, OFFSET(lookup table, 0, 0, 1,
COLUMNS(lookup table)), 0) -1)
Given that:

The lookup table is A5:G9;


The value to match on the rows is B2; and
The value to match on the columns is B1
You get the following two-dimensional lookup formula:
=OFFSET(A5:G9, MATCH(B2, OFFSET(A5:G9, 0, 0, ROWS(A5:G9), 1), 0)-1, MATCH(B1,
OFFSET(A5:G9, 0, 0, 1, COLUMNS(A5:G9)), 0) -1)
It's not the easiest thing to remember, is it? In addition, this is an array formula, so don't forget to
press Ctrl + Shift + Enter to enter it correctly.

Of course, this lengthy OFFSET formula is not the only possible way to do a double lookup in
Excel. You can get the same result by using the VLOOKUP & MATCH functions,
SUMPRODUCT, or INDEX & MATCH. There is even a formula-free way - to employ named
ranges and the intersection operator (space). The following tutorial explains all alternative
solutions in full detail: How to do two-way lookup in Excel.

Excel OFFSET function - limitations and alternatives


Hopefully, the formula examples on this page have shed some light on how to use OFFSET in
Excel. However, to efficiently leverage the function in your own workbooks, you should not only
be knowledgeable of its strengths, but also be wary of its weaknesses.
The most critical limitations of the Excel OFFSET function are as follows:

Excel OFFSET is a resource-hungry function. Whenever there is any change in the


source data, your OFFSET formulas are recalculated, keeping Excel busy for a little longer. This
is not an issue for a single formula in a small spreadsheet. But if there are dozens or hundreds
of formulas in a workbook, Microsoft Excel may take quite a while to recalculate.
Excel OFFSET formulas are hard to review. Because references returned by the Excel
OFFSET function are dynamic, big formulas (especially with nested OFFSETs) can be quite
tricky to debug.
Alternatives to using OFFSET in Excel
As is often the case in Excel, the same result can be achieved in a number of different ways.
So, here are three elegant alternatives to Excel OFFSET.
1. Excel tables
Since Excel 2002, we have a truly wonderful feature - fully-fledged Excel tables, as opposed to
usual ranges. To make a table from structured data, you simply click Insert > Table on
the Hometab or press Ctrl + T.
By entering a formula in one cell in an Excel table, you can create a so-called "calculated
column" that automatically copies the formula to all other cells in that column and adjusts the
formula for each row in the table.
Moreover, any formula that refers to a table's data automatically adjusts to include any new
rows you add to the table or exclude the rows you delete. Technically, such formulas operate on
table columns or rows, which are dynamic ranges in nature. Each table in a workbook has a
unique name (the default ones are Table1, Table2, etc.) and you are free to rename your table
via theDesign tab > Properties group > Table Name text box.
The following screenshot demonstrates the SUM formula that refers to the Bonus column of
Table3. Please pay attention that the formula includes the table's column name rather than a

range of cells.

2. Excel INDEX function


Although not exactly in the same way as OFFSET, Excel INDEX can also be used to create
dynamic range references. Unlike OFFSET, the INDEX function is not volatile, so it won't slow
down your Excel.
3. Excel INDIRECT function
Using the INDIRECT function you can create dynamic range references from many sources
such as cell values, cell values and text, named ranges. It can also dynamically refer to another
Excel sheet or workbook. You can find all these formula examples in our Excel INDIRECT
function tutorial.
Do you remember the question asked at the beginning of this tutorial - What is OFFSET in
Excel? I hope now you know the answer : ) If you want some more hands-on experience, feel
free todownload the workbook containing all of the OFFSET formulas on this page and reverse
engineer them for deeper understanding. Thank you for reading!

How to use INDIRECT function in Excel - formula examples


This Excel INDIRECT tutorial explains the function's syntax, basic uses and provides a number
of formula examples that demonstrate how to use INDIRECT in Excel.
A great lot of functions exist in Microsoft Excel, some being easy-to-understand, other requiring
a long learning curve, and the former being used more often than the latter. And yet, Excel
INDIRECT is one of the kind. This Excel function does not perform any calculations, nor does it
evaluate any conditions or logical tests.
Well then, what is the INDIRECT function in Excel and what do I use it for? This is a very good
question and hopefully you will get a comprehensive answer in a few minutes when you've
finished reading this tutorial.

o
o
o
o
o
o
o
o

Excel INDIRECT function - syntax and basic uses


Excel INDIRECT formula examples
Creating indirect references from cell values
References from cell values and text
INDIRECT with named ranges
INDIRECT formula to dynamically refer to another sheet
INDIRECT formula to dynamically refer to another workbook
Locking a cell reference
INDIRECT with other functions (ROW, ADDRESS, VLOOKUP)
INDIRECT & Excel Data Validation
Possible errors and issues in INDIRECT formulas
Excel INDIRECT function - syntax and basic uses
As its name suggests, Excel INDIRECT is used to indirectly reference cells, ranges, other
sheets or workbooks. In other words, the INDIRECT function lets you create "dynamic" cell or
range references rather than "hard coding" them into your Excel formulas. As a result, you can
change a cell reference within a formula without changing the formula itself. Moreover, these
indirect references won't change when some new rows or columns are inserted in the
worksheet or when you delete any existing ones.
All this may be easier to understand from an example. However, to be able to write a formula,
even the simplest one, you need to know the function's arguments, right? So, let's have a quick
look at Excel INDIRECT syntax first.
INDIRECT function arguments
The INDIRECT function has only two arguments, the first is obligatory while the second is
optional:
INDIRECT(ref_text, [a1])

ref_text - is a cell reference, or a reference to a cell in the form of a text string, or a named
range.
a1 - is a logical value that specifies what type of reference is contained in the ref_text argument:

If TRUE or omitted, ref_text is interpreted as an A1-style cell reference.


If FALSE, ref_text is treated as a R1C1 reference.
While the R1C1 reference type might be useful in certain situations, you'll probably want to use
the familiar A1 references most of the time. Anyway, nearly all INDIRECT formulas in this tutorial
will use A1 references, so we will be omitting the second argument.
Basic use of the INDIRECT function
To get into the function's insight, let's write a simple formula that demonstrates how you use
INDIRECT in Excel.
Suppose, you have number 3 in cell A1, and text A1 in cell C1. Now, put the
formula =INDIRECT(C1) in any other cell and see what happens:

The INDIRECT function refers to the value in cell C1, which is A1.
The function is routed to cell A1 where it picks the value to return, which is number 3.

So, what the INDIRECT function actually does in this example is converting a text string into
a cell reference.
If you think this still has very little practical sense, please bear with me and I will show you some
more formulas that reveal the real power of the Excel INDIRECT function.
How to use INDIRECT in Excel - formula examples
As demonstrated in the above example, you can use the Excel INDIRECT function to put the
address of one cell into another as a usual text string, and get the value of the 1st cell by
referencing the 2nd. However, that trivial example is no more than a hint at the INDIRECT
capabilities.
When working with real data, the INDIRECT function can turn any text string into a reference
including very complex strings that you build using the values of other cells and results returned
by other Excel formulas. But let's not put the cart before the horse, and run through several
Excel Indirect formulas, one at a time.

Creating indirect references from cell values


As you remember, the Excel INDIRECT function allows for A1 and R1C1 reference styles.
Usually, you cannot use both styles in a single sheet at a time, you can only switch between the
two reference types via File > Options > Formulas > R1C1 check box. This is the reason why
Excel users rarely consider using R1C1 as an alternative referencing approach.
In an INDIRECT formula, you can use either reference type on the same sheet if you want to.
Before we move any further, you may want to know the difference between A1 and R1C1
reference styles.
A1 style is the usual reference type in Excel that refers to a column followed by a row number.
For example, B2 refers to the cell at the intersection of column B and row 2.
R1C1 style is the opposite reference type - rows followed by columns, which does take some
time getting used to : ) For example, R4C1 refers to cell A4 which is in row 4, column 1 in a
sheet. If no number comes after the letter, then you are referring to the same row or column.
And now, let's see how the INDIRECT function handles A1 and R1C1 references:

As you see in the screenshot above, three different Indirect formulas return the same result.
Have you already figured out why? I bet you have : )

Formula in cell D1: =INDIRECT(C1)


This is the easiest one. The formula refers to cell C1, fetches its value - text string A2, converts
it into a cell reference, heads over to cell A2 and returns its value, which is 222.

Formula in cell D3: =INDIRECT(C3,FALSE)


FALSE in the 2nd argument indicates that the referred value (C3) should be treated like a R1C1
cell reference, i.e. a row number followed by a column number. Therefore, our INDIRECT
formula interprets the value in cell C3 (R2C1) as a reference to the cell at the conjunction of row
2 and column 1, which is cell A2.

Formula in cell D5: =INDIRECT(C5,FALSE)


Like the previous one, this INDIRECT formula also has FALSE in the second argument,
meaning that it interprets the value in the first argument as a R1C1 reference. So, the formula

grabs the value in cell C5 (R3C) and turns it into the cell address C3 (row 3 in the same column)
and then gets forwarded to the known route.
However, if the value in cell C5 were R3C3 rather than R3C, the same formula would return the
value in cell C3 (R2C1) without going any further. In all honesty, I failed to come up with any
plausible explanation of such behavior, maybe it's just a quirk of Excel INDIRECT.
Creating indirect references from cell values and text
Similarly to how we created references from cell values, you can combine a text string and
a cell reference within your INDIRECT formula, tied together with the concatenation operator
(&).
In the following example, the formula: =INDIRECT("B"&C2) returns a value from cell B2 based
on the following logical chain:
The INDIRECT function concatenates the elements in the ref_text argument - text B and the
value in cell C2 -> the value in cell C2 is number 2, which makes a reference to cell B2 -> the
formula goes to cell B2 and returns its value, which is number 10.

Using the INDIRECT function with named ranges


Apart from making references from cell and text values, you can get the Excel INDIRECT
function to refer to named ranges.
Suppose, you have the following named ranges in your sheet:

Apples - B2:B6
Bananas - C2:C6
Lemons - D2:D6
To create a dynamic reference to any of the above named ranges, just enter its name in some
cell, say G1, and refer to that cell from an Indirect formula =INDIRECT(G1).
And now, you can take a step further and imbed this INDIRECT formula into other Excel
functions to calculate the sum and average of the values in a given named range, or find the
maximum / minimum value within the rage:

=SUM(INDIRECT(G1))
=AVERAGE(INDIRECT(G1))
=MAX(INDIRECT(G1))

=MIN(INDIRECT(G1))

Now that you've got the general idea of how to use the INDIRECT function in Excel, we can
experiment with more powerful formulas.
INDIRECT formula to dynamically refer to another worksheet
The usefulness of the Excel INDIRECT function is not limited to building "dynamic" cell
references. You can also utilize it to refer to cells in other worksheets "on the fly", and here's
how.
Suppose, you have some important data in Sheet 1, and you want to pull that data in Sheet 2.
The following screenshot demonstrates how an Excel Indirect formula can handle this task:

Let's break apart the formula you see in the screenshot and understand.
As you know, the usual way to reference another sheet in Excel is writing the sheet's name
followed by the exclamation mark and a cell / range reference, like SheetName!Range. Since a
sheet name often contains a space(s), you'd better enclose it (the name, not a space : ) in
single quotes to prevent an error, for example 'My Sheet!'$A$1.
And now, all you have to do is to enter the sheet name in one cell, the cell address in another,
concatenate them in a text string, and feed that string to the INDIRECT function. Remember

that in a text string, you have to enclose each element other than a cell address or number in
double quotes and link all elements together using the concatenation operator (&).
Given the above, we get the following pattern:
INDIRECT("'" & Sheet's name & "'!" & Cell to pull data from)
Going back to our example, you put the sheet's name in cell A1, and type the cell addresses in
column B, as demonstrated in the screenshot above. As the result, you get the following
formula:
INDIRECT("'" & $A$1 & "'!" & B1)
Also, please pay attention that if you are copying the formula into multiple cells, you have to lock
the reference to the sheet's name using the absolute cell references like $A$1.
Notes:

If either of the cells that contain the 2nd sheet's name and cell address (A1 and B1 in the
above formula) is empty, your Indirect formula will return an error. To prevent this, you can wrap
the INDIRECT function in the IF function:
IF(OR($A$1="",B1=""), "", INDIRECT("'" & $A$1 & "'!" & B1))

For the INDIRECT formula that refers to another sheet to work correctly, the referred
sheet should be open, otherwise the formula will return a #REF error. To avoid the error, you
can use the IFERROR function, which will display an empty string, whatever error occurs:
IFERROR(INDIRECT("'" & $A$1 & "'!" &B1), "")
Excel INDIRECT formula to refer to another workbook
The Indirect formula that refers to a different Excel workbook is based on the same approach as
areference to another spreadsheet. You just have to specify the workbook's name is addition to
the sheet name and cell address.
To make things easier, let's start with making a reference to another book in the usual way
(apostrophes are added in case your book and/or sheet names contain spaces):
'[Book_name.xlsx]Sheet_name'!Range
Assuming that the book name is in cell A2, the sheet name is in B2, and the cell address is in
C2, we get the following formula:
=INDIRECT("'[" & $A$2 & "]" & $B$2 & "'!" & C2)

Since you don't want the cells containing the book's and sheet's names to change when copying
the formula to other cells, you lock them by using the absolute cell references, $A$2 and $B$2,
respectively.

And now, you can easily write your own formula to dynamicity refer to another Excel workbook
by using the following pattern:
=INDIRECT("'[" & Book name & "]" & Sheet name & "'!" & Cell address)
Note. The workbook your formula refers to should always be open, otherwise the INDIRECT
function will throw a #REF error. As usual, the IFERROR function can help you avoid it:
=IFERROR(INDIRECT("'[" & A2 & "]" & $A$1 & "'!" & B1), "")
Using Excel INDIRECT function to lock a cell reference
Normally, Microsoft Excel changes cell references when you insert new or delete existing rows
or columns in a sheet. To prevent this from happening, you can use the INDIRECT function to
work with cell references that should remain intact in any case.
To illustrate the difference, please do the following:
1. Enter any value in any cell, say, number 20 in cell A1.
2. Refer to A1 from two other cells in different ways: =A1 and =INDIRECT("A1")
3. Insert a new row above row 1.
See what happens? The cell with the equal to logical operator still returns 20, because its
formula has been automatically changed to =A2. The cell with the INDIRECT formula now
returns 0, because the formula was not changed when a new row was inserted and it still refers
to cell A1, which is currently empty:

After this demonstration, you may be under the impression that the INDIRECT function is more
a nuisance than help. Okay, let's try it another way.
Suppose, you want to sum the values in cells A2:A5, and you can easily do this using the SUM
function:
=SUM(A2:A5)
However, you want the formula to remain unchanged, no matter how many rows are deleted or
inserted. The most obvious solution - the use of absolute references - won't help. To make sure,
enter the formula =SUM($A$2:$A$5) in some cell, insert a new row, say at row 3, and find the
formula converted to =SUM($A$2:$A$6).
Of course, such courtesy of Microsoft Excel will work fine in most cases. Nevertheless, there
may be scenarios when you don't want the formula to get changed automatically. The solution is
to use the INDIRECT function, like this:
=SUM(INDIRECT("A2:A5"))
Since Excel perceives "A1:A5" as a mere text string rather than a range reference, it won't make
any changes when you insert or delete a row(s).
Using INDIRECT with other Excel functions
Apart from SUM, INDIRECT is frequently used with other Excel functions such as ROW,
COLUMN, ADDRESS, VLOOKUP, SUMIF, to name a few.
Example 1. INDIRECT and ROW functions
Quite often, the ROW function is used in Excel to return an array of values. For example, you
can use the following array formula (remember it requires pressing Ctrl + Shift + Enter) to return
the average of the 3 smallest numbers in the range A1:A10:
=AVERAGE(SMALL(A1:A10,ROW(1:3)))
However, if you insert a new row in your worksheet, anywhere between rows 1 and 3, the range
in the ROW function will get changed to ROW(1:4) and the formula will return the average of the
4 smallest numbers instead of 3.
To prevent this from happening, nest INDIRECT in the ROW function and your array formula will
always remain correct, no matter how many rows are inserted or deleted:

=AVERAGE(SMALL(A1:A10,ROW(INDIRECT("1:3"))))

Here's a couple more examples of using INDIRECT and ROW in conjunction with the SUM and
SUMIF functions: How to sum the largest or smallest numbers in a range.
Example 2. INDIRECT and ADDRESS functions
You can use Excel INDIRECT together with the ADDRESS function to get a value in a certain
cell on the fly.
As you may remember, the ADDRESS function is used in Excel to get a cell address by the row
and column numbers. For example, the formula =ADDRESS(1,3) returns the string $C$1 since
C1 is the cell at the intersection of the 1st row and 3rd column.
To create an indirect cell reference, you simply embed the ADDRESS function into an
INDIRECT formula like this: =INDIRECT(ADDRESS(1,3))
Of course, this trivial formula only demonstrates the technique. For real-life examples of using
INDIRECT & ADDRESS functions in Excel, please see: How to convert rows to columns in
Excel.
And here are a few more formula examples that may prove useful:

VLOOKUP and INDIRECT - how to dynamically pull data from different sheets.
INDIRECT with INDEX / MATCH - how to bring a case-sensitive VLOOKUP formula to
perfection.
Excel INDIRECT and COUNTIF - how to use the COUNTIF function on a noncontiguous range or a selection of cells.

Using INDIRECT with Data Validation in Excel


You can use the Excel INDIRECT function with Data Validation to create cascading drop down
lists that display different choices depending on what value the user selected in the first
dropdown.
A simple dependent drop-down list is really easy to make. All it takes is a few named ranges to
store the dropdown's items and a simple =INDIRECT(A2) formula where A2 is the cell
displaying your first drop-down list.

To make more complex 3-level menus or drop-downs with multi-word entries, you will need a bit
more complex INDIRECT formula with a nested SUBSTITUTE function.
For the detailed step-by-step guidance on how to use INDIRECT with Excel Data Validation,
please check out this tutorial: How to make a dependent drop down list in Excel.
Excel INDIRECT function - possible errors and issues
As demonstrated in the above examples, the INDIRECT function is quite helpful when dealing
with cell and range references. However, not all Excel users eagerly embrace it mostly because
extensive use of INDIRECT in Excel formulas results in lack of transparency. The INDIRECT

function is difficult to review since the cell it refers to is not the ultimate location of the value
used in the formula, which is pretty confusing indeed, especially when working with large
complex formulas.
In addition to the above said, like any other Excel function, INDIRECT may throw an error if you
misuse the function's arguments. Here's a list of most typical mistakes:
Excel INDIRECT #REF! error
Most often, the INDIRECT function returns a #REF! error in three cases:
1. ref_text is not a valid cell reference. If the ref_text parameter in your Indirect formula is not
a valid cell reference, the formula will result in the #REF! error value. To avoid possible issues,
please check the INDIRECT function's arguments.
2. Range limit is exceeded. If the ref_text argument of your Indirect formula refers to a range
of cells beyond the row limit of 1,048,576 or the column limit of 16,384, you will also get the
#REF error in Excel 2007, 2010 and Excel 2013. Earlier Excel versions ignore the exceeded
limit and do return some value, though often not the one you'd expect.
2. The referred sheet or workbook is closed. If your Indirect formula refers to another Excel
workbook or worksheet, that other workbook / spreadsheet must be open, otherwise INDIRECT
returns the #REF! error.
Excel INDIRECT #NAME? error
This is the most obvious case, implying that there is some error in the function's name, which
leads us to the next point : )
Using the INDIRECT function in non-English locales
You may be curious to know that the English name of the INDIRECT function has been
translated into 14 languages, including:
Danish - INDIREKTE
Finnish - EPSUORA
German - INDIREKT
Hungarian - INDIREKT
Italian - INDIRETTO

Norwegian - INDIREKTE
Polish - ADR.POR
Spanish - INDIRECTO
Swedish - INDIREKT
Turkish - DOLAYLI

If you are interested to get the full list, please check out this page.
A common problem with non-English localizations is not the INDIRECT function's name, but
rather different Regional Settings for the List Separator. In the standard Windows configuration
for North America and some other countries, the default List Separator is a comma. While in
European countries, the comma is reserved as the Decimal Symbol and the List Separator is
set to semicolon.

As a result, when copying a formula between two different Excel locales, you may get the error
message "We found a problem with this formula" because the List separator used in the
formula is different from what is set on your machine. If you run into this error when copying
some INDIRECT formula from this tutorial into your Excel, simply replace all commas (,) with
semicolons (;) to get it fixed.
To check which List Separator and Decimal Symbol are set on your machine, open the Control
Panel, and go to Region and Language > Additional Settings.
Hopefully, this tutorial has shed some light on using INDIRECT in Excel. Now that you know its
strengths and limitations, it's time to give it a shot and see how the INDIRECT function can
simplify your Excel tasks. Thank you for reading!

How to calculate compound interest in Excel - formula for daily, monthly, yearly
compounding
The tutorial explains the compound interest formula for Excel and provides examples of how to
calculate the future value of the investment at annual, monthly or daily compounding interest
rate. You will also find the detailed steps to create your own Excel compound interest calculator.
Compound interest is one of the basic building blocks in banking and one of the most powerful
financial forces around that determine the outcome of your investments.
Unless you are an accounting graduate, financial analyst or an experienced investor, it might be
a bit difficult to grasp the concept from specialized financial books and manuals. The aim of this
article is to make it easy : ) You will also learn how to use a compound interest formula in Excel
and create a universal compound interest calculator for your own worksheets.

o
o
o
o

What is compound interest?


How to calculate compound interest in Excel
Calculating annual compound interest
General compound interest formula
Compound interest formula for Excel (daily, monthly, weekly compounding)
Excel compound interest calculator
Compound interest calculators online
What is compound interest?

It might be easier to start with simple interest that is calculated only on the principal amount.
For example, you put $10 into a bank account. How much will your deposit be worth in one year
at an annual interest rate of 7%? The answer is $10.7, and your earned interest is $0.70.
In case of compound interest, the principal in each time period is different. The bank won't
give the earned interest back to you, instead they add it to your principle investment. This
increased amount becomes the principal for the next time period (compounding period) and also
earns interest. In other words, you earn interest not only on the principal amount, but also on the
interest earned in each compounding period.
In our example, in addition to the principle amount of $10, the earned interest of $0.70 will also
earn interest next year. So, how much will your $10 deposit be worth after 2 years at the annual
interest rate of 7%? The answer is $11.45 and you can calculate it in several ways, as
demonstrated below.

How to calculate compound interest in Excel


Long time investments can be an effective strategy to increase your wealth, and even small
deposits can make a big difference over time. The Excel compound interest formulas explained
further will help you get the savings strategy to work. Eventually, we are going to make a
universal formula that calculates the future value of the investment at any of the compounding
interest rates - daily, weekly, monthly, quarterly, or annual.
Calculating annual compound interest in Excel
To understand the idea of compound interest better, let's begin with a very simple example
discussed at the beginning of this tutorial and write a formula to calculate annual compound
interest in Excel. As you remember, you are investing $10 at the annual interest rate of 7% and
want to know how yearly compounding increases your savings.
Annual compound interest - Formula 1
An easy and straightforward way to calculate the amount earned with an annual compound
interest is using the formula to increase a number by percentage: =Amount * (1 + %).
In our example, the formula is =A2*(1+$B2) where A2 is your initial deposit and B2 is the annual
interest rate. Please pay attention that we fix the reference to column B by using the $ sign.

As you remember, 1% is one part of a hundred, i.e. 0.01, so 7% is 0.07, and this is how
percentages are actually stored in Excel. Keeping this in mind, you can verify the result returned
by the formula by performing a simple calculation of 10*(1+0.07) or 10*1.07 and make sure that
your balance after 1 year will be $10.70 indeed.
And now, let's calculate the balance after 2 years. So, how much will your $10 deposit be worth
in two years' time at an annual interest rate of 7%? The answer is $11.45 and you can get it by

copying the same formula to column D.

To calculate how much money you will find in your bank account at the end of 3 years, simply
copy the same formula to column E and you will get $12.25.

Those of you who have some experience with Excel formulas have probably figured out that
what the above formula actually does is multiplying the initial deposit of $10 by 1.07 three times:
=10*1.07*1.07*1.07=12.25043
Round it to two decimal places and you will get the same number as you see in cell E2 in the
screenshot above - $12.25. Naturally, you can directly calculate the balance after 3 years using
this formula:
=A2*1.07*1.07*1.07

Annual compound interest - Formula 2


Another way to make an annual compound interest formula is to calculate the earned interest
for each year and then add it to the initial deposit.

Assuming that your Initial deposit is in cell B1 and Annual interest rate in cell B2, the following
formula works a treat: =B1 + B1 * $B$2

For the formula to work correctly, please mind the following details:

Fix the reference to the Annual Interest Rate cell (B2 in our case) by adding the $ sign, it
should be an absolute column and absolute row, like $B$2.
For Year 2 (B6) and all subsequent years, change the formula to:
Year 1 balance + Year 1 balance * Interest Rate
In this example, you'd enter the formula =B5 + B5 * $B$2 in cell B6 and then copy it down to
other rows, like demonstrated in the screenshot below.

To find out how much interest you actually earned with annual compound interest, enter the
formula =B5-B1 (Balance after 1 year - Initial deposit) in cell C5.
Then enter =B6-B5 (Balance after 2 years - Balance after 1 year) in cell C6 and drag the
formula down to other cells.

You should see the earned interest's growth like in the screenshot below that reveals the real
power of compound interest.

The above examples do a good job illustrating the idea of compound interest, don't they? But
none of the formulas is good enough to be called a universal compound interest formula for
Excel. Firstly, because they do not let you specify a compounding period, and secondly,
because you have to build an entire table rather than simply enter a certain duration and interest
rate.
Well, let's take a step forward and create a universal compound interest formula for Excel that
can calculate how much money you will earn with yearly, quarterly, monthly, weekly or daily
compounding.
General compound interest formula
When financial advisors analyze the impact of compound interest on an investment, they usually
consider three factors that determine the future value of the investment (FV):

PV - present value of the investment


i - interest rate earned in each period
n - number of periods
By knowing these components, you can use the following formula to find out the future value of
the investment with a certain compounded interest rate:
FV = PV * (1 + i)n
To illustrate the point better, here are a couple of quick examples.
Example 1: Monthly compound interest formula
Suppose, you invest $2,000 at 8% interest rate compounded monthly and you want to know the
value of your investment after 5 years.

First off, let's write down a list of components for your compound interest formula:

PV = $2,000
i = 8% per year, compounded monthly (0.08/12= 006666667)
n = 5 years x 12 months (5*12=60)
Input the above numbers in the formula, and you will get:
= $2,000 * (1 + 0.8/12)5x12
or
= $2,000 * 1.00666666760
or
= $2,000 * 1.489845708 = $2,979.69
Example 2: Daily compound interest formula
I hope the monthly compound interest example is well understood, and now you can use the
same approach for daily compounding. The initial investment, interest rate, duration and the
formula are exactly the same as in the above example, only the compounding period is different:

PV = $2,000
i = 8% per year, compounded daily (0.08/365 = 0.000219178)
n = 5 years x 365 days (5*365 =1825)
Supply the above numbers into the compound interest formula, and you will get the following
result:
=$2,000 * (1 + 0.000219178)1825 = $2,983.52
As you see, with daily compounding interest, the future value of the same investment is a bit
higher than with monthly compounding. This is because the 8% interest rate adds interest to the
principal amount each day rather than each month. As you can guess, the monthly
compounding result will be higher than annual compounding.
All this is good, but what you really want is an Excel formula for compound interest, right? Just
bear with me for a little longer, please. Now we are getting to the most interesting part - building
your own powerful and versatile compound interest calculator in Excel.
Universal compound interest formula in Excel (daily, weekly, monthly, yearly
compounding)
Usually, there is more than one way to do something in Excel and a compound interest formula
is not an exception :) Although Microsoft Excel provides no special function for calculating

compound interest, you can use other functions to create your own compound interest
calculator.
Let's start creating our Excel compound interest calculator with entering the basic factors that
determine the future value of an investment in an Excel worksheet:

initial investment (A3)


annual interest rate (A4)
number of compounding periods per year (A5)
number of years (A6)
When done, your Excel sheet may look similar to this:

All you need now is the compound interest formula to calculate the earned amount (Balance)
based on the input values. The best news is that you don't have to re-invent the wheel. We will
simply take the time-tested compound interest formula used by banking and other financial
institutions and slightly modify its expressions so that Excel can understand it.
Compound interest formula for Excel:
=Initial investment * (1 + Annual interest rate / Compounding periods per year) ^
(Years * Compounding periods per year)
When adjusted for the compound interest calculator shown in the screenshot above, the formula
takes the following shape:

=B3 * (1 + B4 /B5) ^ (B6 * B5)

The numbers look rather familiar? Yep, these are the same values and calculations that we've
performed with a monthly compound interest formula, and the result proves that we did
everything right!
If you want to know how much your investment will be worth at an 8% annual interest rate
compounded quarterly, simply enter 4 in cell B5:

To calculate the future value of your investment with semi-annual compounding, enter 2 as the
Compounding periods per year value. For weekly interest rates, enter 52, this is how many
weeks each year contains. If you are interested in daily compounding, enter 365, and so on.
As you see, we've created a truly universal compound interest calculator for Excel. Hopefully,
now you have no regrets that you invested a few precious minutes in figuring out the tricky
compound interest formula used by financial planners : )
And now, it's time to use this formula in your Excel spreadsheets, or you can download the
compound interest calculator we've just created.

Advanced compound interest calculator for Excel


If for some reason you are not quite happy with the compound interest formula discussed
above, you can create your Excel compound interest calculator with the Future Value function
that is available in Microsoft Excel 2013, 2010, 2007, 2003 and 2000.
Excel's FV function returns the future value of an investment based on factors similar to what we
have just discussed, though its syntax is a bit different:
FV(rate, nper, pmt, [pv], [type])
In the function, the first 3 arguments are obligatory and the last 2 are optional.

rate - an interest rate per period, exactly as the argument's name suggests.
nper - the number of payment periods.
pmt - an additional payment that is made each period, represented as a negative
number. If the pmt argument is omitted, the pv parameter must be included.
pv (optional) - the present value of the investment (principle investment), which is also
anegative number. If the pv argument is omitted, it is assumed to be zero (0), in this case the
pmt parameter must be specified.
type (optional) - specifies when additional payments are due: 0 or omitted - at the end of
the period, and 1 - at the beginning of the period.
Let's use Excel FV formula with the same values as in monthly compound interest
examples and see whether we get the same result.
As you may remember, we deposited $2,000 for 5 years into a savings account at 8% annual
interest rate compounded monthly, with no additional payments. So, our Excel compound
interest formula goes as follows:
=FV(0.08/12, 5*12, ,-2000)
If you need some explanation of the parameters, here you go:

rate - 0.008/12 since you have the 8% annual interest rate compounded monthly.
nper - 5*12, i.e. 5 years * 12 months
pmt is left blank because our task does not involve additional payments to the principle
investment of $2,000.
pv is -2000 since the syntax of the FV function requires using a negative number in this
argument.

As demonstrated in the following screenshot, the FV formula returns the same result as the
compound interest calculator that we created in the previous example.

Naturally, nothing prevents you from replacing the values in the FV function with cell references,
and then your FV formula will double-check the result returned by our Excel compound interest
calculator.
For example, the screenshot below shows the future value of $4,000 investment after 15 years
at an annual interest rate of 7% compounded weekly.

To make your Excel compound interest calculator even more powerful, you can extend it with
theAdditional contributions option (additional payments) and modify the compound interest
formula accordingly:
=FV(B4/B5, B6*B5, -B8, -B3, B9)

Where:

B3 - principle investment
B4 - an annual interest rate
B5 - the number of compounding periods per year
B6 - the number of years to save
B8 - additional contributions (optional)
B9 - additional contributions type. Remember that you enter 1 if you deposit an
additional amount at the beginning of the compounding period, 0 or omitted if additional
payments are made at the end of the period.

If you are curious to try this advanced compound interest calculator for Excel to compute your
savings, feel free to download it.
Compound interest calculators online
If you prefer investing money rather than time in figuring out how to calculate compound interest
in Excel, online compound interest calculators may come in handy. You can find plenty of them
by entering something like "compound interest calculator" in your preferred search engine. In
the meantime, let me quickly present a couple of my favorite ones.
Compound interest calculator by Bankrate
The key benefits of Bankrate compound interest calculator is ease-of-use and visual
presentation of the results. This calculator lets you enter the savings inputs manually in boxes or
by moving a slider. As you do this, the estimated total is displayed on top and immediately

reflected in the graph below:

Clicking the View Report button generates a "Summary Report" as well as "Savings Balance"
that provides the detailed info on the amount of additional contributions, earned interest and
balance for each year.
Compound interest calculator by Money-Zine
The online calculator from Money-Zine is much simpler compared to Bankrate's one. It asks you
to specify only 3 values: the principle investment, interest rate and duration. As soon as you
supply these numbers and click the Calculate button, it will show you all types of compound
interest rate (daily, weekly, monthly, annual, etc.) as well as the future values with a

corresponding compounding.

Compound interest calculator by MoneySmart


This is a really nice online compound interest calculator run by Australian Securities and
Investments Commission. It lets you input all relevant factors that determine the future value of
your investment and outputs the result as a graph. By hovering over a certain bar in the graph,

you can see the summary info for that particular year.

This is how you calculate compound interest in Excel and outside it :) I hope at least one
compound interest formula discussed in this article has proved helpful to you. Anyway, I thank
you for reading and hope to see you on our blog next week!

How to calculate percentage in Excel


In this tutorial, you will lean a quick way to calculate percentages in Excel, find the basic
percentage formula and a few more formulas for calculating percentage increase, percent of
total and more.
Calculating percentage is useful in many areas of life, whether it is restaurant tipping, reseller
commission, your income tax or interest rate. Say, you've been lucky enough to get a 25% off
promotion code on a new plasma TV. Is this a good deal? And how much will you eventually
have to pay?
In this tutorial, we are going to explore a few techniques that will help you efficiently calculate
percent in Excel and learn the basic percentage formulas that will take the guesswork out of
your calculations.

Percentage basics
Excel percentage formula
Calculating percentage of total
Calculating percent change (percentage increase / decrease)
Calculate amount and total by percentage
Increase / decrease a number by percent
Percentage basics
The term "per cent" is derived from the Latin per centum, meaning "by the hundred". As you
probably remember from high school math class, a percentage is a fraction of 100 that is
calculated by dividing the numerator by the denominator and multiplying the result by 100.
The basic percentage formula is as follows:
(Part/Whole)*100 = Percentage
For example, if you had 20 apples and you gave 5 to your friends, how much did you give,
percentage wise? By performing a simple calculation =5/20*100 you get the answer - 25%.
This is how you normally calculate percentages in school and everyday life. Computing
percentage in Microsoft Excel is even easier since Excel performs some operations for you
automatically, in the background.
Regrettably, there is no universal Excel formula for percentage that would cover all possible
scenarios. If you ask someone "Which percent formula do I use to get the result I want?", most
likely, you will get an answer like "Well, that depends on what exactly result you want to
achieve."
So, let me show you a few simple formulas for calculating a percent in Excel such as a
percentage increase formula, a formula to get percentages of a total and more.

Basic Excel percentage formula


The basic formula to calculate percentage in Excel is this:
Part/Total = Percentage
If you compare it to the basic math formula for percentage, you will notice that Excel's
percentage formula lacks the *100 part. When calculating a percent in Excel, you do not have to
multiply the resulting fraction by 100 since Excel does this automatically when the percentage
format is applied to a cell.
And now, let's see how you can use the Excel percentage formula on real-life data. Suppose,
you have the number of "Ordered items" in column B and "Delivered items" in column C. To find
out the percentage of delivered products, perform the following steps:

Enter the formula =C2/B2 in cell D2, and copy it down to as many rows as you need.
Click the Percent Style button (Home tab > Number group) to display the resulting
decimal fractions as percentages.
Remember to increase the number of decimal places if needed, as explained
in Percentage tips.
Done! : )
The same sequence of steps shall be performed when using any other percentage formula in
Excel.
In the following example, column D displays a rounded percent of delivered items, without any
decimal places showing.

Calculating percentage of total in Excel


In fact, the above example is a particular case of calculating percentages of a total. Now, let's
investigate a few more examples that will help you make quick work of calculating a percent of a
total in Excel on different data sets.
Example 1. The total is at the end of the table in a certain cell
A very common scenario is when you have a total in a single cell at the end of a table. In this
case, the percentage formula will be similar to the one we've just discussed with the only
difference that a cell reference in the denominator is absolute (with $).
For example, if you have some values in column B and their total in cell B10, you'd use the
following formula to calculate percentages of the total: =B2/$B$10
You use a relative cell reference to cell B2 because you want it to get changed when you copy
the formula to other cells of column B. But you enter $B$10 as an absolute cell reference
because you want to leave the denominator fixed on B10 when auto-filling the formula down to
row 9.
Tip. To make the denominator an absolute reference, either type the dollar sign ($) manually or
click the cell reference in the formula bar and press F4.
The screenshot below demonstrates the results returned by the formula, the Percentages of
Totalcolumn is formatted as percentage with 2 decimal places showing.

Example 2. Parts of the total are in multiple rows


In the above example, suppose you have several rows for the same product and you want to
know what part of the total is made by all orders of that particular product.

In this case, you can use the SUMIF function to add up all numbers relating to a given product
first, and then divide that number by the total, like this:
=SUMIF(range, criteria, sum_range) / total
Given that column A contains all product names, column B lists corresponding quantities, cell E1
is the name of the product you are interested in, and the total is in cell B10, your real-life formula
may look similar to this:
=SUMIF(A2:A9 ,E1, B2:B9) / $B$10

Naturally, you can put the product name directly in the formula, like this:
=SUMIF(A2:A9, "cherries", B2:B9) / $B$10
If you want to find out what part of the total a few different products make, add up the results
returned by several SUMIF functions, and then divide that number by the total. For example, the
following formula calculates the percent of cherries and apples:
=(SUMIF(A2:A9, "cherries", B2:B9) + SUMIF(A2:A9, "apples", B2:B9)) / $B$10
For more information about the SUM function, please check out the following tutorials:

How to use the SUMIF function in Excel


Excel SUMIFS and SUMIF with multiple criteria
How to calculate percent change in Excel
Of all formulas for calculating percentage in Excel, a percent change formula is probably the
one you would use most often.

Excel formula for percentage change (percentage increase / decrease)


To calculate percent change between values A and B, use the following formula:
(B - A) / A = Percent Change
When applying this formula to real data, it is important that you correctly determine which value
is A and which is B. For example, yesterday you had 80 apples and how you have 100, meaning
that now you have 20 apples more than before, which is 25% increase. If you had 100 apples
and now you have 80, your number of apples has reduced by 20, which is 20% decrease.
Considering the above, our Excel formula for percentage change takes the following shape:
(New Value - Old Value) / Old Value = Percent Change
And now, let's see how you can use this percentage change formula (aka Excel percentage
increase formula) in your spreadsheets.
Example 1. Calculating percent change between 2 columns
Suppose that you have the last month prices in column B and this month prices in column C.
Then you can enter the following formula in cell D2 to calculate percentage change in your
Excel sheet:
=(C2-B2)/B2
This percent change formula calculates the percentage increase / decrease in this month
(column C) comparted to last month (column B).
After copying the formula to other rows, remember to click the Percent Style button on the
ribbon to display decimals as percentages and you will get a result similar to what you see in the
screenshot below. In this example, positive percentages that show percentage increase are
formatted in usual black, while the negative percentages (percent decrease) are formatted in
red by using the technique explained in this tip.

Example 2. Calculating percentage change between rows


In case you have one column of numbers, say column C that lists weekly or monthly sales, you
can calculate percentage change using this formula:
=(C3-C2)/C2
Where C2 is the 1st and C3 is the 2nd cell with data.
Note. Please pay attention that you should skip the first row with data and put your Excel
percentage formula into the 2nd cell, which is D3 in this example.
After applying the percent format to the column with the percent change formula, you will get the
following result:

If you want to calculate percentage change compared to a certain cell, then you need to fix the
reference to that cell by using the absolute cell reference with the $ sign, e.g. $C$2.
For instance, here is the Excel percentage change formula that calculates the percent increase /
decrease for each month compared to January (C2):
=(C3-$C$2)/$C$2

When you drag the formula down to copy it to other cells, the absolute reference ($C$2) will
stay the same, while the relative reference (C3) will change to C4, C5 and so on.

Calculating amount and total by percentage


As you've just seen, calculating percentages in Excel is easy, and so is calculating amounts and
totals if you know the percentage.
Example 1. Calculate amount by total and percentage
Suppose you are buying a new laptop for $950 and they charge 11% VAT on this purchase. The
question is - how much do you have to pay on top of the net price? In other words, what is 11%
of $950?
The following formula will help:
Total * Percentage = Amount
Assuming that the total value is in cell A2 and percent in B2, the above formula turns into a
simple =A2*B2 and returns 104.50.

Remember, when you type a number followed by the percent sign (%) in Excel, the number is
interpreted as a hundredth of its value. For example, 11% is actually stored as 0.11 and Excel
uses this underlying value in all formulas and calculations.

In other words, the formula =A2*11% is equivalent to =A2*0.11. Naturally, you are free to use
the decimal number corresponding to the percentage directly in a formula if this works better for
your worksheets.
Example 2. Calculating total by amount and percentage
For example, you friend offered you his old computer for $400, which is 30% off the original
price. You want to know what the original price was.
Since 30% is the discount, you deduct it from 100% first to know what percentage you actually
have to pay (100% - 30% = 70%). Now you need the formula to calculate the original price, i.e.
to find the number whose 70% equals 400.
The formula goes as follows:
Amount / Percentage = Total
Applied to real data, it may take any of the following shapes:
=A2/B2 or =A2/0.7 or =A2/70%

How to increase / decrease a number by percentage


The holiday season is upon us and this indicates a change in your usual weekly spendings. You
may want to consider different options to find out your optimum weekly allowance.
To increase an amount by a percentage, use this formula:
= Amount * (1 + %)
For example, the formula =A1*(1+20%) increases the value in cell A1 by 20%.
To decrease an amount by a percentage:
= Amount * (1 - %)
For instance, the formula =A1*(1-20%) reduces the value in cell A1 by 20%.
In our example, if A2 is your current expenditures and B2 is the percentage you want to
increase or reduce that amount by, here are the formulas you'd enter in cell C2:

Increase by percentage: =A2*(1+B2)


Reduce by percentage: =A2*(1-B2)

How to increase / reduce an entire column by a percentage


Suppose, you have a column of numbers that you want to increase or reduce by a certain
percent, and you want to have the updated numbers in the same column rather than add a new
column with the formula.
Here are 5 quick steps to handle this task:
1. Enter all the numbers you want to increase or decrease in some column, column B in this
example.
2. In an empty cell, enter one of the below formulas:
Increase by percentage: =1+20%
Reduce by percentage: =1-20%

Naturally, you are free to replace 20% in the above formulas with the percentage you want.
3. Select the cell with the formula (C2 in our case) and copy it by pressing Ctrl + C.

4. Select the range of cells you want to change, right click the selection and then click Paste
Special

5. In the Paste Special dialog window,


select Values under Paste, Multiply under Operation and click OK.

And here's the result - all the numbers in column B are increased by 20%:

In the same fashion, you can multiply or divide a column of numbers by a certain percentage.
Simply enter the desired percentage in an empty cell and follow the steps above.
This is how you calculate percentage in Excel. And even if working with percentages has never
been your favorite kind of math, by using these basic percentage formulas you can get Excel to
do the work for you. That's all for today, thank you for reading!

Using logical functions in Excel: AND, OR, XOR and NOT


The tutorial explains the essence of Excel logical functions AND, OR, XOR and NOT and
provides formula examples that demonstrate their common and inventive uses.
Last week we tapped into the insight of Excel logical operators that are used to compare data in
different cells. Today, you will see how to extend the use of logical operators and construct more
elaborate logical tests to perform more complex calculations and more powerful data analysis.
Excel logical functions such as AND, OR, XOR and NOT will help you in doing this.

Excel logical functions - overview


Excel AND function
OR function in Excel
Excel XOR function
NOT function in Excel
Excel logical functions - overview
Microsoft Excel provides 4 logical functions to work with the logical values. The functions are
AND, OR, XOR and NOT. You use these functions when you want to carry out more than one
comparison in your formula or test multiple conditions instead of just one. As well as logical
operators, Excel logical functions return either TRUE or FALSE when their arguments are
evaluated.
The following table provides a short summary of what each logical function does to help you
choose the right formula for a specific task.
Function

Description

AND

Returns TRUE if all of the


arguments evaluate to
TRUE.

OR

XOR

Returns TRUE if any


argument evaluates to
TRUE.

Returns a logical
Exclusive Or of all
arguments.

Formula
Example

Formula Description

=AND(A2>=10,
B2<5)

The formula returns TRUE if a


value in cell A2 is greater than or
equal to 10, and a value in B2 is
less than 5, FALSE otherwise.

=OR(A2>=10,
B2<5)

The formula returns TRUE if A2


is greater than or equal to 10 or
B2 is less than 5, or both
conditions are met. If neither of
the conditions it met, the formula
returns FALSE.

=XOR(A2>=10,
B2<5)

The formula returns TRUE if


either A2 is greater than or equal
to 10 or B2 is less than 5. If
neither of the conditions is met or
both conditions are met, the
formula returns FALSE.

NOT

Returns the reversed


logical value of its
argument. I.e. If the
argument is FALSE, then
TRUE is returned and
vice versa.

=NOT(A2>=10)

The formula returns FALSE if a


value in cell A1 is greater than or
equal to 10; TRUE otherwise.

In additions to the four logical functions outlined above, Microsoft Excel provides 3 conditional
functions - IF, IFERROR and IFNA.
Excel logical functions - facts and figures
1. In arguments of the logical functions, you can use cell references, numeric and text values,
Boolean values, comparison operators, and other Excel functions. However, all arguments must
evaluate to the Boolean values of TRUE or FALSE, or in references or arrays containing logical
values.
2. If an argument of a logical function contains text values or empty cells, such values are
ignored.
3. If an argument of a logical function contains numbers, then zero evaluates to FALSE, and all
other numbers including negative numbers evaluate to TRUE. For example, if cells A1:A5
contain numbers, the formula =AND(A1:A5) will return TRUE if none of the cells contains 0,
FALSE otherwise.
4. A logical function returns the #VALUE! error if none of the arguments evaluate to logical
values.
5. A logical function returns the #NAME? error if you've misspell the function's name or
attempted to use the function in an earlier Excel version that does not support it. For example,
the XOR function can be used in Excel 2013 only.
6. In Excel 2013, 2010 and 2007, you can include up to 255 arguments in a logical function,
provided that the total length of the formula does not exceed 8,192 characters. In Excel 2003
and lower, you can supply up to 30 arguments and the total length of your formula shall not
exceed 1,024 characters.
Using the AND function in Excel
The AND function is the most popular member of the logic functions family. It comes in handy
when you have to test several conditions and make sure that all of them are met. Technically,
the AND function tests the conditions you specify and returns TRUE if all of the conditions
evaluate to TRUE, FALSE otherwise.
The syntax for the Excel AND function is as follows:

AND(logical1, [logical2], ...)


Where logical is the condition you want to test that can evaluate to either TRUE or FALSE. The
first condition (logical1) is required, subsequent conditions are optional.
And now, let's look at some formula examples that demonstrate how to use the AND functions in
Excel formulas.
Formula

Description

=AND(A2="Bananas",
B2>C2)

Returns TRUE if A2 contains "Bananas" and B2 is greater


than C2, FALSE otherwise.

=AND(B2>20, B2=C2)

Returns TRUE if B2 is greater than 20 and B2 is equal to


C2, FALSE otherwise.

=AND(A2="Bananas",
B2>=30, B2>C2)

Returns TRUE if A2 contains "Bananas", B2 is greater than


or equal to 30 and B2 is greater than C2, FALSE otherwise.

Excel AND function - common uses


By itself, the Excel AND function is not very exciting and has narrow usefulness. But in
combination with other Excel functions, AND can significantly extend the capabilities of your
worksheets.
One of the most common uses of the Excel AND function is found in the logical_test argument
of the IF function to test several conditions instead of just one. For example, you can nest any of
the AND functions above inside the IF function and get a result similar to this:

=IF(AND(A2="Bananas", B2>C2), "Good", "Bad")

For more IF / AND formula examples, please check out his tutorial: Excel IF function with
multiple AND conditions.
An Excel formula for the BETWEEN condition
If you need to create a between formula in Excel that picks all values between the given two
values, a common approach is to use the IF function with AND in the logical test.
For example, you have 3 values in columns A, B and C and you want to know if a value in
column A falls between B and C values. To make such a formula, all it takes is the IF function
with nested AND and a couple of comparison operators:
Formula to check if X is between Y and Z, inclusive:
=IF(AND(A2>=B2,A2<=C2),"Yes", "No")
Formula to check if X is between Y and Z, not inclusive:
=IF(AND(A2>B2, A2<C2),"Yes", "No")

As demonstrated in the screenshot above, the formula works perfectly for all data types numbers, dates and text values. When comparing text values, the formula checks them
character-by-character in the alphabetic order. For example, it states that Apples in not
between Apricot andBananas because the second "p" in Apples comes before "r" in Apricot.
Please see Using Excel comparison operators with text values for more details.
As you see, the IF /AND formula is simple, fast and almost universal. I say "almost" because it
does not cover one scenario. The above formula implies that a value in column B is smaller than
in column C, i.e. column B always contains the lower bound value and C - the upper bound
value. This is the reason why the formula returns "No" for row 6, where A6 has 12, B6 - 15 and
C6 - 3 as well as for row 8 where A8 is 24-Nov, B8 is 26-Dec and C8 is 21-Oct.
But what if you want your between formula to work correctly regardless of where the lowerbound and upper-bound values reside? In this case, use the Excel MEDIAN function that
returns the median of the given numbers (i.e. the number in the middle of a set of numbers).
So, if you replace AND in the logical test of the IF function with MEDIAN, the formula will go like:
=IF(A2=MEDIAN(A2:C2),"Yes","No")

And you will get the following results:

As you see, the MEDIAN function works perfectly for numbers and dates, but returns the #NUM!
error for text values. Alas, no one is perfect : )
If you want a perfect Between formula that works for text values as well as for numbers and
dates, then you will have to construct a more complex logical text using the AND / OR functions,
like this:
=IF(OR(AND(A2>B2, A2<C2), AND(A2<B2, A2>C2)), "Yes", "No")

Using the OR function in Excel


As well as AND, the Excel OR function is a basic logical function that is used to compare two
values or statements. The difference is that the OR function returns TRUE if at least one if the
arguments evaluates to TRUE, and returns FALSE if all arguments are FALSE. The OR function
is available in all versions of Excel 2013 - 2000.
The syntax of the Excel OR function is very similar to AND:

OR(logical1, [logical2], ...)


Where logical is something you want to test that can be either TRUE or FALSE. The first logical
is required, additional conditions (up to 255 in modern Excel versions) are optional.
And now, let's write down a few formulas for you to get a feel how the OR function in Excel
works.
Formula

Description

=OR(A2="Bananas",
A2="Oranges")

Returns TRUE if A2 contains "Bananas" or "Oranges",


FALSE otherwise.

=OR(B2>=40, C2>=20)

Returns TRUE if B2 is greater than or equal to 40 or C2 is


greater than or equal to 20, FALSE otherwise.

=OR(B2=" ", C2="")

Returns TRUE if either B2 or C2 is blank or both, FALSE


otherwise.

As well as Excel AND function, OR is widely used to expand the usefulness of other Excel
functions that perform logical tests, e.g. the IF function. Here are just a couple of examples:
IF function with nested OR
=IF(OR(B2>30, C2>20), "Good", "Bad")
The formula returns "Good" if a number in cell B3 is greater than 30 or the number in C2 is
greater than 20, "Bad" otherwise.
Excel AND / OR functions in one formula
Naturally, nothing prevents you from using both functions, AND & OR, in a single formula if your
business logic requires this. There can be infinite variations of such formulas that boil down to
the following basic patterns:
=AND(OR(Cond1, Cond2), Cond3)

=AND(OR(Cond1, Cond2), OR(Cond3, Cond4)


=OR(AND(Cond1, Cond2), Cond3)
=OR(AND(Cond1,Cond2), AND(Cond3,Cond4))
For example, if you wanted to know what consignments of bananas and oranges are sold out,
i.e. "In stock" number (column B) is equal to the "Sold" number (column C), the following
OR/AND formula could quickly show this to you:
=OR(AND(A2="bananas", B2=C2), AND(A2="oranges", B2=C2))

OR function in Excel conditional formatting


=OR($B2="", $C2="")

The rule with the above OR formula highlights rows that contain an empty cell either in column
B or C, or in both.

For more information about conditional formatting formulas, please see the following articles:

Excel conditional formatting formulas


Changing the row color based on a cell's value
Changing a cell's color based on another cell value
How to highlight every other row in Excel
Using the XOR function in Excel
In Excel 2013, Microsoft introduced the XOR function, which is a logical Exclusive OR function.
This term is definitely familiar to those of you who have some knowledge of any programming
language or computer science in general. For those who don't, the concept of 'Exclusive Or'
may be a bit difficult to grasp at first, but hopefully the below explanation illustrated with formula
examples with help.
The syntax of the XOR function is identical to OR's :
XOR(logical1, [logical2],...)
The first logical statement (Logical 1) is required, additional logical values are optional. You can
test up to 254 conditions in one formula, and these can be logical values, arrays, or references
that evaluate to either TRUE or FALSE.

In the simplest version of the XOR formula that contains just 2 logical statements, the Excel
XOR function returns TRUE if either argument evaluates to TRUE. If both arguments are TRUE
or neither is TRUE, XOR returns FALSE. This might be easier to understand from the formula
examples:
Formula

Result

Description

=XOR(1>0, 2<1)

TRUE

Returns TRUE because the 1st argument is TRUE and the


2nd argument is FALSE.

=XOR(1<0, 2<1)

FALSE

Returns FALSE because both arguments are FALSE.

=XOR(1>0, 2>1)

FALSE

Returns FALSE because both arguments are TRUE.

When more logical statements are added, the XOR function in Excel results in:

TRUE if an odd number of the arguments evaluate to TRUE;


FALSE if is the total number of TRUE statements is even, or if all statements are FALSE.
The screenshot below illustrates the point:

If you are not sure how the Excel XOR function can be applied to a real-life scenario, consider
the following example. Suppose you have a table of contestants and their results for the first 2
games. You want to know which of the payers shall play the 3rd game based on the following
conditions:

Contestants who won Game 1 and Game 2 advance to the next round automatically and
don't have to play Game 3.
Contestants who lost both first games are knocked out and don't play Game 3 either.
Contestants who won either Game 1 or Game 2 shall play Game 3 to determine who
goes into the next round and who doesn't.
A simple XOR formula works exactly as we want:

=XOR(B2="Won", C2="Won")

And if you nest this XOR function into the logical test of the IF formula, you will get even more
sensible results:
=IF(XOR(B2="Won", C2="Won"), "Yes", "No")

Using the NOT function in Excel


The NOT function is one of the simplest Excel functions in terms of syntax:
NOT(logical)
You use the NOT function in Excel to reverse a value of its argument. In other words, if logical
evaluates to FALSE, the NOT function returns TRUE and vice versa. For example, both of the
below formulas return FALSE:
=NOT(TRUE)
=NOT(2*2=4)
Why would one want to get such ridiculous results? In some cases, you might be more
interested to know when a certain condition isn't met than when it is. For example, when
reviewing a list of attire, you may want to exclude some color that does not suit you. I'm not
particularly fond of black, so I go ahead with this formula:

=NOT(C2="black")

As usual, in Microsoft Excel there is more than one way to do something, and you can achieve
the same result by using the Not equal to operator: =C2<>"black".
If you want to test several conditions in a single formula, you can use NOT in conjunctions with
the AND or OR function. For example, if you wanted to exclude black and white colors, the
formula would go like:
=NOT(OR(C2="black", C2="white"))
And if you'd rather not have a black coat, while a black jacket or a back fur coat may be
considered, you should use NOT in combination with the Excel AND function:
=NOT(AND(C2="black", B2="coat"))
Another common use of the NOT function in Excel is to reverse the behavior of some other
function. For instance, you can combine NOT and ISBLANK functions to create the
ISNOTBLANK formula that Microsoft Excel lacks.
As you know, the formula =ISBLANK(A2) returns TRUE of if the cell A2 is blank. The NOT
function can reverse this result to FALSE: =NOT(ISBLANK(A2))
And then, you can take a step further and create a nested IF statement with the NOT / ISBLANK
functions for a real-life task:

=IF(NOT(ISBLANK(C2)), C2*0.15, "No bonus :(")

Translated into plain English, the formula tells Excel to do the following. If the cell C2 is not
empty, multiply the number in C2 by 0.15, which gives the 15% bonus to each salesman who
has made any extra sales. If C2 is blank, the text "No bonus :(" appears.
In essence, this is how you use the logical functions in Excel. Of course, these examples have
only scratched the surface of AND, OR, XOR and NOT capabilities. Knowing the basics, you
can now extend your knowledge by tackling your real tasks and writing smart elaborate formulas
for your worksheets.

Excel logical operators: equal to, not equal to, greater than, less than
Many tasks you perform in Excel involve comparing data in different cells. For this, Microsoft
Excel provides six logical operators, which are also called comparison operators. This tutorial
aims to help you understand the insight of Excel logical operators and write the most efficient
formulas for your data analysis.

o
o
o

Excel logical operators


Equal to
Not equal to
Greater than / less than / greater than or equal to / less than or equal to
Common uses of logical operators in Excel
Excel logical operators - overview
A logical operator is used in Excel to compare two values. Logical operators are sometimes
called Boolean operators because the result of the comparison in any given case can only be
either TRUE or FALSE.
Six logical operators are available in Excel. The following table explains what each of them does
and illustrates the theory with formula examples.
Condition

Operator

Formula
Example

Description

Equal to

=A1=B1

The formula returns TRUE if a value in cell A1 is


equal to the values in cell B1; FALSE otherwise.

Not equal to

<>

=A1<>B1

The formula returns TRUE if a value in cell A1 is


not equal to the value in cell B1; FALSE otherwise.

Greater than

>

=A1>B1

The formula returns TRUE if a value in cell A1 is


greater than a value in cell B1; otherwise it returns
FALSE.

Less than

<

=A1<B1

The formula returns TRUE if a value in cell A1 is


less than in cell B1; FALSE otherwise.

=A1>=B1

The formula returns TRUE if a value in cell A1 is


greater than or equal to the values in cell B1;
FALSE otherwise.

=A1<=B1

The formula returns TRUE if a value in cell A1 is


less than or equal to the values in cell B1; FALSE
otherwise.

Greater than or
equal to
Less than or
equal to

>=

<=

The screenshot below demonstrates the results returned by Equal to, Not equal to, Greater
thanand Less than logical operators:

It may seem that the above table covers it all and there's nothing more to talk about. But in fact,
each logical operator has its own specificities and knowing them can help you harness the real
power of Excel formulas.
Using "Equal to" logical operator in Excel
The Equal to logical operator (=) can be used to compare all data types - numbers, dates, text
values, Booleans, as well as the results returned by other Excel formulas. For example:
=A1=B1

Returns TRUE if the values in cells A1 and B1 are the same, FALSE
otherwise.

=A1="oranges"

Returns TRUE if cells A1 contain the word "oranges", FALSE otherwise.

=A1=TRUE

Returns TRUE if cells A1 contain the Boolean value TRUE, otherwise it


returns FALSE.

=A1=(B1/2)

Returns TRUE if a number in cell A1 is equal to the quotient of the


division of B1 by 2, FALSE otherwise.

Example 1. Using the "Equal to" operator with dates


You might be surprised to know that the Equal to logical operator cannot compare dates as
easily as numbers. For example, if the cells A1 and A2 contain the date "12/1/2014", the formula
=A1=A2 will return TRUE exactly as it should.
However, if you try either =A1=12/1/2014 or =A1="12/1/2014" you will get FALSE as the result.
A bit unexpected, eh?
The point is that Excel stores dates as numbers beginning with 1-Jan-1900, which is stored as
1. The date 12/1/2014 is stored as 41974. In the above formulas, Microsoft Excel interprets
"12/1/2014" as a usual text string, and since "12/1/2014" is not equal to 41974, it returns
FALSE.

To get the correct result, you must always wrap a date in the DATEVALUE function, like
this =A1=DATEVALUE("12/1/2014")

Note. The DATEVALUE function needs to be used with other logical operator as well, as
demonstrated in the examples that follow.
The same approach should be applied when you use Excel's equal to operator in the logical test
of the IF function. You can find more info as well as a few formula examples in this
tutorial: Using Excel IF function with dates.
Example 2. Using the "Equal to" operator with text values
Using Excel's Equal to operator with text values does not require any extra twists. The only thing
you should keep in mind is that the Equal to logical operator in Excel is case-insensitive,
meaning that case differences are ignored when comparing text values.
For example, if cell A1 contains the word "oranges" and cell B1 contains "Oranges", the formula
=A1=B1 will return TRUE.
If you want to compare text values taking in to account their case differences, you should use
the EXACT function instead of the Equal to operator. The syntax of the EXACT function is as
simple as:
EXACT(text1, text2)
Where text 1 and text2 are the values you want to compare. If the values are exactly the same,
including case, Excel returns TRUE; otherwise, it returns FALSE. You can also use the EXACT
function in IF formulas when you need a case-sensitive comparison of text values, as shown in

the below screenshot:

Note. If you want to compare the length of two text values, you can use the LEN function
instead, for example =LEN(A2)=LEN(B2) or =LEN(A2)>=LEN(B2).
Example 3. Comparing Boolean values and numbers
There is a widespread opinion that, in Microsoft Excel, the Boolean value of TRUE always
equates to 1 and FALSE to 0. However, this is only partially true, and the key word here is
"always" or more precisely "not always" : )
When writing an 'equal to' logical expression that compares a Boolean value and a number, you
need to specifically point out for Excel that a non-numeric Boolean value should be treated as a
number. You can do this by adding the double minus sign in front of a Boolean value or a cell
reference, e. g. =A2=--TRUE or =A2=--B2.
The 1st minus sign, which is technically called the unary operator, coerces TRUE/FALSE to -1/0,
respectively, and the second unary negates the values turning them into +1 and 0. This will
probably be easier to understand looking at the following screenshot:

Note. You should add the double unary operator before a Boolean when using other logical
operators such as not equal to, greater than or less than to correctly compare a numeric and
Boolean values.

When using logical operators in complex formulas, you might also need to add the double unary
before each logical expression that returns TRUE or FALSE as the result. Here's an example of
such a formula: SUMPRODUCT and SUMIFS in Excel.
Using "Not equal to" logical operator in Excel
You use Excel's Not equal to operator (<>) when you want to make sure that a cell's value is not
equal to a specified value. The use of the Not equal to operator is very similar to the use
of Equal tothat we discussed a moment ago.
The results returned by the Not equal to operator are analogous to the results produced by the
Excel NOT function that reverses the value of its argument. The following table provides a few
formula examples.
Not equal to operator

=A1<>B1

=A1<>"oranges"

=A1<>TRUE

=A1<>(B1/2)

NOT function

Description

=NOT(A1=B1)

Returns TRUE if
the values in
cells A1 and B1
are not the
same, FALSE
otherwise.

=NOT(A1="oranges")

Returns TRUE if
cell A1 contains
any value other
than "oranges",
FALSE if it
contains
"oranges" or
"ORANGES" or
"Oranges", etc.

=NOT(A1=TRUE)

Returns TRUE if
cell A1 contains
any value other
than TRUE,
FALSE
otherwise.

=NOT(A1=B1/2)

Returns TRUE if
a number in cell
A1 is not equal
to the quotient
of the division of
B1 by 2, FALSE
otherwise.

=A1<>DATEVALUE("12/1/2014")

=NOT(A1=DATEVALUE("12/1/2014"))

Returns TRUE if
A1 contains any
value other than
the date of 1Dec-2014,
regardless of
the date format,
FALSE
otherwise.

Greater than, Less than, Greater than or equal to, Less than or equal to
You use these logical operators in Excel to check how one number compares to another.
Microsoft Excel provides 4 comparison operates whose names are self-explanatory:

Greater than (>)


Greater than or equal to (>=)
Less than (<)
Less than or equal to (<=)
Most often, Excel comparison operators are used with numbers, date and time values. For
example:
=A1>20

Returns TRUE if a number in cell A1 is greater than 20,


FALSE otherwise.

=A1>=(B1/2)

Returns TRUE if a number in cell A1 is greater than or


equal to the quotient of the division of B1 by 2, FALSE
otherwise.

=A1<DATEVALUE("12/1/2014")

Returns TRUE if a date in cell A1 is less than 1-Dec-2014,


FALSE otherwise.

=A1<=SUM(B1:D1)

Returns TRUE if a number in cell A1 is less than or equal


to the sum of values in cells B1:D1, FALSE otherwise.

Using Excel comparison operators with text values


In theory, you can also use the greater than, greater than or equal to operators as well as
their less than counterparts with text values. For example, if cell A1 contains "apples" and B1
contains "bananas", guess what the formula =A1>B1 will return? Congratulations to those
who've staked on FALSE : )
When comparing text values, Microsoft Excel ignores their case and compares the values
symbol by symbol, "a" being considered the lowest text value and "z" - the highest text value.
So, when comparing the values of "apples" (A1) and "bananas" (B1), Excel starts with their first
letters "a" and "b", respectively, and since "b" is greater than "a", the formula =A1>B1 returns
FALSE.

If the first letters are the same, then the 2nd letters are compared, if they happen to be identical
too, then Excel gets to the 3rd, 4th letters and so on. For example, if A1 contained "apples" and
B1 contained "agave", the formula =A1>B1 would return TRUE because "p" is greater than "g".

At first sight, the use of comparison operators with text values seems to have very little practical
sense, but you never know what you might need in the future, so probably this knowledge will
prove helpful to someone.
Common uses of logical operators in Excel
In real work, Excel logical operators are rarely used on their own. Agree, the Boolean values
TRUE and FALSE they return, though very true (excuse the pun), are not very meaningful. To
get more sensible results, you can use logical operators as part of Excel functions or conditional
formatting rules, as demonstrated in the below examples.
1. Using logical operators in arguments of Excel functions
When it comes to logical operators, Excel is very permissive and allows using them in
parameters of many functions. One of the most common uses is found in Excel IF
function where the comparison operators can help to construct a logical test, and the IF formula
will return an appropriate result depending on whether the test evaluates to TRUE or FALSE.
For example:
=IF(A1>=B1, "OK", "Not OK")
This simple IF formula returns OK if a value in cell A1 is greater than or equal to a value in cell
B1, "Not OK" otherwise.
And here's another example:
=IF(A1<>B1, SUM(A1:C1), "")
The formula compares the values in cells A1 and B1, and if A1 is not equal to B1, the sum of
values in cells A1:C1 is returned, an empty string otherwise.
Excel logical operators are also widely used in special IF functions such as SUMIF, COUNTIF,
AVERAGEIF and their plural counterparts that return a result based on a certain condition or
multiple conditions.
You can find a wealth of formula examples in the following tutorials:

Using IF function in Excel


How to use SUMIF in Excel
Excel SUMIFS and SUMIF with multiple criteria
Using COUNTIF in Excel
Excel COUNTIFS and COUNTIF with multiple criteria
2. Using Excel logical operators in mathematical calculations
Of course, Excel functions are very powerful, but you don't always have to use them to achieve
the desired result. For example, the results returned by the following two formulas are identical:
IF function: =IF(B2>C2, B2*10, B2*5)
Formula with logical operators: =(B2>C2)*(B2*10)+(B2<=C2)*(B2*5)

I guess the IF formula is easier to interpret, right? It tells Excel to multiply a value in cell B2 by
10 if B2 is greater than C2, otherwise the value in B1 is multiplied by 5.
Now, let's analyze what the 2nd formula with the greater than and less than or equal to logical
operators does. It helps to know that in mathematical calculations Excel does equate the
Boolean value TRUE to 1, and FALSE to 0. Keeping this in mind, let's see what each of the
logical expressions actually returns.
If a value in cell B2 is greater than a value in C2, then the expression B2>C2 is TRUE, and
consequently equal to 1. On the other hand, B2<=C2 is FALSE and equal to 0. So, given that
B2>C2, our formula undergoes the following transformation:

Since any number multiplied by zero gives zero, we can cast away the second part of the
formula after the plus sign. And because any number multiplied by 1 is that number, our
complex formula turns into a simple =B2*10 that returns the product of multiplying B2 by 10,
which is exactly what the above IF formula does : )

Obviously, if a value in cell B2 is less than in C2, then the expression B2>C2 evaluates to
FALSE (0) and B2<=C2 to TRUE (1), meaning that the reverse of the described above will
occur.
3. Logical operators in Excel conditional formatting
Another common use of logical operators is found in Excel Conditional Formatting that lets you
quickly highlight the most important information in a spreadsheet.
For example, the following simple rules highlight selected cells or entire rows in your worksheet
depending on a value in column A:
Less than (orange): =A1<5
Greater than (green): =A1>20

For the detailed-step-by-step instructions and rule examples, please see the following articles:

Excel conditional formatting formulas


How to change the row color based on a cell's value
Two ways to change background color based on cell value
How to highlight every other row in Excel
As you see, the use of logical operators in Excel is intuitive and easy. In the next article, we are
going to learn the nuts and bolts of Excel logical functions that allow performing more than one
comparison in a formula. Please stay tuned and thank you for reading!

Excel IF function: nested IF formulas with multiple conditions, IFERROR, IFNA and
more
In Part 1 of our Excel IF function tutorial, we started to learn the nuts and bolts of the Excel IF
function. As you remember, we discussed a few IF formulas for numbers, dates and text values
as well as how to use the IF function with blank and non-blank cells.
However, for powerful data analysis, you may often need to evaluate multiple conditions at a
time, meaning you have to construct more sophisticated logical tests using multiple IF functions
in one formula. The formula examples that follow below will show you how to do this correctly.
You will also learn how to use Excel IF in array formulas and learn the basics of the IFEFFOR
and IFNA functions.

Excel IF function with multiple AND/OR conditions


Using nested IF functions in Excel
How to use Excel IF in array formulas
Using IF together with other Excel functions
Excel IFERROR and IFNA functions
How to use Excel IF function with multiple conditions
In summary, there can be 2 basic types of multiple conditions - with AND and OR logic.
Consequently, your IF function should embed an AND or OR function in the logical test,
respectively.

AND function. If your logical test contains the AND function, Microsoft Excel returns
TRUE if all the conditions are met; otherwise it returns FALSE.
OR function. In case you use the OR function in the logical test, Excel returns TRUE
if any of the conditions is met; FALSE otherwise.
To illustrate the point better, let's have a look at a few IF examples with multiple conditions.
Example 1. Using IF & AND function in Excel
Suppose, you have a table with the results of two exam scores. The first score, stored in column
C, must be equal to or greater than 20. The second score, listed in column D, must be equal to
or exceed 30. Only when both of the above conditions are met, a student passes the final exam.
The easiest way to make a proper formula is to write down the condition first, and then
incorporate it in the logical_test argument of your IF function:
Condition: AND(B2>=20, C2>=30)
IF/AND formula: =IF((AND(C2>=20, D2>=30)), "Pass", "Fail")
Easy, isn't it? The formula tells Excel to return "Pass" if a value in column C >=20 AND a value
in column D >=30. Otherwise, the formula returns "Fail". The screenshot below proves that our

Excel IF /AND function is correct:

Note. Microsoft Excel checks all conditions in the AND function, even if one of the already
tested conditions evaluates to FALSE. Such behavior is a bit unusual since in most of
programming languages, subsequent conditions are not tested if any of the previous tests has
returned FALSE.
In practice, a seemingly correct IF / AND formula may result in an error because of this
specificity. For example, the formula =IF(AND(A2<>0,(1/A2)>0.5),"Good", "Bad") will return
"Divide by Zero Error" (#DIV/0!) if cell A2 is equal to 0. The avoid this, you should use a nested
IF function: =IF(A2<>0, IF((1/A2)>0.5, "Good", "Bad"), "Bad")
Example 2. Using IF with OR function in Excel
You use the combination of IF & OR functions in a similar way. The difference from the IF / AND
formula discussed above is that Excel returns TRUE if at least one of the specified conditions is
met.
So, if we modify the above formula in the following way:
=IF((OR(C2>=20, D2>=30)), "Pass", "Fail")
Column E will have the "Pass" mark if either the first score is equal to or greater than 20 OR the
second score is equal to or greater than 30.

As you see in the screenshot below, our students have a better chance to pass the final exam
with such conditions (Scott being particularly unlucky failing by just 1 point : )

Naturally, you are not limited to using only two AND/OR functions in your Excel IF formulas. You
can use as many logical functions as your business logic requires, provided that:

In Excel 2013, 2010 and 2007, your formula includes no more than 255 arguments, and
the total length of the formula does not exceed 8,192 characters.
In Excel 2003 and lower, you can use up to 30 arguments and the total length of your
formula shall not exceed 1,024 characters.
Example 3. Using IF with AND & OR functions
In case you have to evaluate your data based on several sets of multiple conditions, you will
have to employ both AND & OR functions at a time.
In the above table, suppose you have the following criteria to evaluate the students' success:

Condition 1: column C>=20 and column D>=25


Condition 2: column C>=15 and column D>=20
If either of the above conditions is met, the final exam is deemed passed, otherwise - failed.
The formula might seem tricky, but in a moment, you will see that it is not! You just have to
express two conditions as AND statements and enclose them in the OR function since you do
not require both conditions to be met, either will suffice:
OR(AND(C2>=20, D2>=25), AND(C2>=15, D2>=20)
Finally, use the above OR function as the logical test in the IF function and supply value_if_true
and value_if_false arguments. As the result, you will get the following IF formula with multiple
AND / OR conditions:

=IF(OR(AND(C2>=20, D2>=25), AND(C2>=15, D2>=20)), "Pass", "Fail")


The screenshot below indicates that we've got the formula right:

Using multiple IF functions in Excel (nested IF functions)


If you need to create more elaborate logical tests for your data, you can include additional IF
statements in the value_if_true and value_if_false arguments of your Excel IF formulas. These
multiple IF functions are called "nested IF functions" and they may prove particularly useful if
you want your formula to return 3 or more different results.
Here's an easy-to-understand example. Suppose you want not simply to qualify the students'
results as Pass/Fail, but rather define the total score as "Good", "Satisfactory" and "Poor". For
example:

Good: 60 or more (>=60)


Satisfactory: between 40 and 60 (>40 and <60)
Poor: 40 or less (<=40)
To begin with, you can add an additional column (E) with the following formula that sums
numbers in columns C and D: =C2+D2

And now, let's write a nested IF function based on the above conditions. It's considered a good
practice to start with the most important condition and make your functions as simple as
possible. Our Excel nested IF formula is as follows:
=IF(E2>=60, "Good", IF(E2>40, "Satisfactory", "Poor "))
As you see, just one nested IF function is sufficient in this case. Naturally, you can nest more IF
functions if you want to. For example:
=IF(E2>=70, "Excellent", IF(E2>=60, "Good", IF(E2>40, "Satisfactory", "Poor ")))
The above formula adds one more conditions - the total score of 70 points and more is qualified
as "Excellent".

I've heard some people say that multiple Excel IF functions are driving them crazy : ) Probably, it
will help if you try to look at our nested IF formula in this way:

What the formula actually tells Excel to do is to test the condition of the first IF function and
return the value supplied in the value_if_true argument if the condition is met. If the condition
of the 1st IF function is not met, then test the 2nd IF, and so on.
=IF(check if E2>=70, if true - return "Excellent", or else
IF(check if E2>=60, if true - return "Good", or else
IF(check if E2>40, if true - return "Satisfactory", if false
- return " Poor ")))
Excel nested IF functions - things to remember!
1. In modern versions of Excel 2013, 2010 and 2010, you can use up to 64 nested IF functions.
In older versions of Excel 2003 and lower, up to 7 nested IF functions can be used.
2. If your IF formula includes more than 5 nested IF functions, you may want to optimize it by
using the alternatives described below.
Alternatives to multiple IF functions in Excel
To get around the limit of seven nested IF functions in older Excel versions and to make your IF
formula more compact and fast, consider using the following approaches instead of multiple IF
statements.
1. To test many conditions, use the LOOKUP, VLOOKUP, INDEX/MATCH or CHOOSE
functions.
2. Use IF with logical functions OR / AND, as demonstrated in the above examples.
3. Use the CONCATENATE function or the concatenate operator (&).
As well as other Excel functions, CONCATENATE can include as many as 30 parameters in
older Excel versions and up to 255 arguments in modern versions, which equates to testing 255
different conditions.
For example, if you want to return different values depending on the content of cell B1, you can
use the following formulas:
Nested IF functions:
=IF(C1="a", "Excellent", IF(C1="b", "Good", IF(C1="c", "Poor", "")))
CONCATENATE function:
=CONCATENATE(IF(C1="a", "Excellent", ""), IF(C1="b", "Good", ""), IF(C1="c", "Poor ",
""))

Concatenate operator:
=IF(C1="A", "Excellent", "") & IF(C1="B", " Good", "") & IF(C1="C", "Poor", "")
As you see, the use of CONCATENATE does not make the formula shorter, but it does make it
easier-to-understand compared to nested IF functions.

4. For powerful Excel users, the best alternative to using multiple nested IF functions might be
creating a custom worksheet function using VBA.
Using Excel IF in array formulas
Like other Excel functions, IF can be used in array formulas. You may need such a formula if
you want to evaluate every element of the array when the IF statement is carried out.
For example, the following array SUM/IF formula demonstrates how you can sum cells in the
specified range based on a certain condition rather than add up the actual values:
=SUM(IF(B1:B5<=1,1,2))
The formula assigns a certain number of "points" to each value in column B - if a value is equal
to or less than 1, it equates to 1 point; and 2 points are assigned to each value greater than 1.
And then, the SUM function adds up the resulting 1's and 2's, as shown in the screenshot

below.

Note. Since this is an array formula, remember to press Ctrl + Shift + Enter to enter it correctly.
Using IF function together with other Excel functions
Earlier in this tutorial, we've discussed a few IF formula examples demonstrating how to use the
Excel IF function with logical functions AND and OR. Now, let's see what other Excel functions
can be used with IF and what benefits this gives to you.
Example 1. Using IF with SUM, AVERAGE, MIN and MAX functions
When discussing nested IF functions, we wrote the formula that returns different ranking
(Excellent, Good, Satisfactory or Poor) based on the total score of each student. As you
remember, we added a new column with the formula that calculates the total of scores in
columns C and D.
But what if your table has a predefined structure that does not allow any modifications? In this
case, instead of adding a helper column, you could add values directly in your If formula, like
this:
=IF((C2+D2)>=60, "Good", IF((C2+D2)>=>40, "Satisfactory", "Poor "))
Okay, but what if your table contains a lot of individual scores, say 5 different columns or more?
Summing so many figures directly in the IF formula would make it enormously big. An
alternative is embedding the SUM function in the IF's logical test, like this:

=IF(SUM(C2:F2)>=120, "Good", IF(SUM(C2:F2)>=90, "Satisfactory", "Poor "))

In a similar fashion, you can use other Excel functions in the logical test of your IF formulas:
IF and AVERAGE:
=IF(AVERAGE(C2:F2)>=30,"Good",IF(AVERAGE(C2:F2)>=25,"Satisfactory","Poor "))
The formulas retunes "Good" if the average score in columns C:F is equal to or greater than 30,
"Satisfactory" if the average score is between 29 and 25 inclusive, and "Poor" if less than 25.
IF and MAX/MIN:
To find the highest and lowest scores, you can use the MAX and MIN functions, respectively.
Assuming that column F is the total score column, the below formulas work a treat:
MAX: =IF(F2=MAX($F$2:$F$10), "Best result", "")
MIN: =IF(F2=MIN($F$2:$F$10), "Worst result", "")
If you'd rather have both the Min and Max results in the same column, you can nest one of the
above functions in the other, for example:

=IF(F2=MAX($F$2:$F$10) ,"Best result", IF(F2=MIN($F$2:$F$10), "Worst result", ""))

In a similar manner, you can use the IF function with your custom worksheet functions. For
example, you can use it with the GetCellColor / GetCellFontColor functions to return different
results based on a cell color.
In addition, Excel provides a number of special IF functions to analyze and calculate data based
on different conditions.
For example, to count the occurrences of a text or numeric value based on a single or multiple
conditions, you can use COUNTIF and COUNTIFS, respectively. To find out a sum of values
based on the specified condition(s), use the SUMIF or SUMIFS functions. To calculate the
average according to certain criteria, use AVERAGEIF or AVERAGEIFS.
For the detailed step-by-step formula examples, check out the following tutorials:

How to use the COUNTIF in Excel


Using Excel COUNTIFS and COUNTIF with multiple conditions
SUMIF in Excel - formula examples to conditionally sum cells
How to use Excel SUMIFS and SUMIF with multiple criteria
Example 2. IF with ISNUMBER and ISTEXT functions
You already know a way to spot blank and non-blank cells using the ISBLANK function.
Microsoft Excel provides analogous functions to identify text and numeric values - ISTEXT and
ISNUMBER, respectively.
Here's is example of the nested Excel IF function that returns "Text" if cell B1 contains any text
value, "Number" if B1 contains a numeric value, and "Blank" if B1 is empty.

=IF(ISTEXT(B1), "Text", IF(ISNUMBER(B1), "Number", IF(ISBLANK(B1), "Blank", "")))

Note. Please pay attention that the above formula displays "Number" for numeric values and
dates. This is because Microsoft Excel stores dates as numbers, starting from January 1, 1900,
which equates to 1.
Example 3. Using the result returned by IF in another Excel function
Sometimes, you can achieve the desired result by embedding the IF statement in some other
Excel function, rather than using another function in a logical test.
Here's another way how you can use the CONCATINATE and IF functions together:
=CONCATENATE("You performed ", IF(C1>5,"fantastic!", "good"))
I believe you hardly need any explanation of what the formula does, especially looking at the
screenshot below:

Excel IFERROR and IFNA functions


Both of the functions - IFERROR and IFNA - are used in Excel to trap errors in formulas. And
both functions can return a special value that you specify if a formula produces an error.
Otherwise, the result of the formula is returned.
The difference is that IFERROR handles all possible Excel errors, including #VALUE!, #N/A,
#NAME?, #REF!, #NUM!, #DIV/0!, and #NULL!. While the Excel IFNA function specializes
solely in #N/A errors, exactly as its name suggests.

The syntax of the Error functions is as follows.


IFERROR function
IFERROR(value, value_if_error)
IFNA function
IFNA(value, value_if_na)
The first parameter (value) is the argument that is checked for an error.
The second parameter (value_if_error / value_if_na) is the value to return if the formula
evaluates to an error (any error in case of IFERROR; the #N/A error in case of IFNA).
Note. If any of the arguments is an empty cell, both of the Error functions treat it as an empty
string ("").
The following example demonstrates the simplest usage of the IFERROR function:
=IFERROR(B2/C2, "Sorry, an error has occurred")

As you see in the screenshot above, column D displays the quotient of the division of a value in
column B by a value in column C. You can also see two error messages in cells D2 and D5
because everyone knows that you cannot divide a number by zero.
In some cases, you'd better use the IF function to prevent an error then ISERROR or ISNA to
catch an error. Firstly, it's a faster way (in terms of CPU) and secondly it is a good programming
practice. For example, the following IF formula produces the same result as the IFERROR
function demonstrated above:
=IF(C2=0, "Sorry, an error has occurred", B2/C2)
But of course, there are cases when you cannot pre-test all function parameters, especially in
very complex formulas, and foresee all possible errors. In such cases, the ISERROR() and

IFNA() functions come in really handy. You can find a few advanced examples of using
IFERROR in Excel in these articles:

Excel VLOOKUP with IFERROR / ISERROR


Using INDEX / MATCH with IFERROR
And that's all I have to say about using the IF function in Excel. Hopefully, the IF examples
we've discussed in this tutorial will help you to get started on the right track. Thank you for
reading!

Using IF function in Excel: formulas for numbers, text, dates, blank cells
The IF function is one of the most popular and useful functions in Excel. You use the IF function
to ask Excel to test a condition and to return one value if the condition is met, and another value
if the condition is not met.
In this tutorial, we are going to learn the syntax and common usages of Excel IF function, and
then will have a closer look at formula examples that will hopefully prove helpful both to
beginners and experienced Excel users.

o
o
o
o

Excel IF function - syntax and usage


Using the IF function in Excel - formula examples
IF examples for numbers
How to use the IF function with text values
Using Excel IF function with dates
Excel IF examples for blank, non-blank cells
Excel IF function - syntax and usage
The IF function is one of Excel's logical functions that evaluates a certain condition and returns
the value you specify if the condition is TRUE, and another value if the condition is FALSE.
The syntax for Excel IF is as follows:
IF(logical_test, [value_if_true], [value_if_false])
As you see, the IF function has 3 arguments, but only the first one is obligatory, the other two
are optional.

logical_test - a value or logical expression that can be either TRUE or FALSE.


Required.In this argument, you can specify a text value, date, number, or any comparison
operator. For example, your logical test can be expressed as or B1="sold", B1<12/1/2014,
B1=10 or B1>10.
value_if_true - the value to return when the logical test evaluates to TRUE, i.e. if the
condition is met. Optional.For example, the following formula will return the text "Good" if a
value in cell B1 is greater than 10: =IF(B1>10, "Good")
value_if_false - the value to be returned if the logical test evaluates to FALSE, i.e. if the
condition is not met. Optional.For example, if you add "Bad" as the third parameter to the above
formula, it will return the text "Good" if a value in cell B1 is greater than 10, otherwise, it will
return "Bad": =IF(B1>10, "Good", "Bad")

Excel IF function - things to remember!


Though the last two parameters of the IF function are optional, your formula may produce
unexpected results if you don't know the underlying logic beneath the hood.
1. If value_if_true is omitted.
If the value_if_true argument is omitted in your Excel IF formula (i.e. there is only a comma
following logical_test), the IF function returns zero (0) when the condition is met. Here is an
example of such a formula: =IF(B1>10,, "Bad")
If you don't want your IF formula to display any value when the condition is met, enter double
quotes ("") in the second parameter, like this: =IF(B1>10, "", "Bad") Technically, in this case the
formula returns an empty string, which is invisible to the user but perceivable to other Excel
functions.
The following screenshot demonstrates the above approaches in action, and the second one
seems to be more sensible:

2. If value_if_false is omitted.
If you don't care what happens if the specified condition is not met, you can omit the 3rd
parameter in your Excel IF formulas, which will result in the following.
If the logical test evaluates to FALSE and the value_if_false parameter is omitted (there is just
a closing bracket after the value_if_true argument), the IF function returns the logical value
FALSE. It's a bit unexpected, isn't it? Here is an example of such a formula: =IF(B1>10,
"Good")
If you put a comma after the value_if_true argument, your IF function will returns 0, which
doesn't make much sense either: =IF(B1>10, "Good",)
And again, the most reasonable approach is to put "" in the third argument, in this case you will
have empty cells when the condition is not met: =IF(B1>10, "Good", "")

3. Get the IF function to display logical values TRUE or FALSE


If you want your Excel IF formula to display the logical values TRUE and FALSE when the
specified condition is met and not met, respectively, type TRUE in the value_if_true argument.
The value_if_false parameter can be FALSE or omitted. Here's a formula example:
=IF(B1>10, TRUE, FALSE)
or

=IF(B1>10, TRUE)

Note. If you want your IF formula to return TRUE and FALSE as the logical values (Boolean)
that other Excel formulas can recognize, make sure you don't enclose them in double quotes. A
visual indication of a Boolean is middle align in a cell, as you see in the screenshot above.
If you want to "TRUE" and "FALSE" to be usual text values, enclose them in "double quotes". In
this case, the returned values will be aligned left and formatted as General. No Excel formula
will recognize such "TRUE" and "FALSE" text as logical values.
4. Get IF to perform a math operation and return a result
Instead of returning certain values, you can make your IF formula to test the specified condition,
perform a corresponding math operation and return a value based on the result. You do this by
using arithmetic operators or other Excel functions in the value_if_true and
/or value_if_false arguments. Here are just a couple of formula examples:
Example 1: =IF(A1>B1, C3*10, C3*5)
The formula compares the values in cells A1 and B1, and if A1 is greater than B1, it multiplies
the value in cell C3 by 10, by 5 otherwise.
Example 2: =IF(A1<>B1, SUM(A1:D1), "")
The formula compares the values in cells A1 and B1, and if A1 is not equal to B1, the formula
returns the sum of values in cells A1:D1, an empty string otherwise.
Using the IF function in Excel - formula examples
Now that you are familiar with the Excel IF function's syntax, let's look at some formula
examples and learn how to use IF as a worksheet function in Excel.

IF function examples for numbers: greater than, less than, equal to


The use of the IF function with numeric values is based on using different comparison operators
to express your conditions. You will find the full list of logical operators illustrated with formula
examples in the table below.
Condition

Operator

Formula Example

Description

Greater than

>

=IF(A2>5, "OK",)

If the number in cell A2 is greater than 5,


the formula returns "OK"; otherwise 0 is
returned.

Less than

<

=IF(A2<5, "OK",
"")

If the number in cell A2 is less than 5, the


formula returns "OK"; an empty string
otherwise.

Equal to

=IF(A2=5, "OK",
"Wrong number")

If the number in cell A2 is equal to 5, the


formula returns "OK"; otherwise the
function displays "Wrong number".

Not equal to

<>

=IF(A2<>5,
"Wrong number",
"OK")

If the number in cell A2 is not equal to 5,


the formula returns "Wrong number ";
otherwise - "OK".

Greater than
or equal to

>=

=IF(A2>=5, "OK",
"Poor")

If the number in cell A2 is greater than or


equal to 5, the formula returns "OK";
otherwise - "Poor".

Less than or
equal to

<=

=IF(A2<=5, "OK",
"")

If the number in cell A2 is less than or


equal to 5, the formula returns "OK"; an
empty string otherwise.

The screenshot below demonstrates the IF formula with the "Greater than or equal to" logical
operator in action:

Excel IF function examples for text values


Generally, you write an IF formula for text values using either "equal to" or "not equal to"
operator, as demonstrated in a couple of IF examples that follow.
Example 1. Case-insensitive IF formula for text values
Like the overwhelming majority of Excel functions, IF is case-insensitive by default. What it
means for you is that logical tests for text values do not recognize case in usual IF formulas.
For example, the following IF formula returns either "Yes" or "No" based on the "Delivery Status"
(column C):
=IF(C2="delivered", "No", "Yes")
Translated into the plain English, the formula tells Excel to return "No" if a cell in column C
contains the word "Delivered", otherwise return "Yes". At that, it does not really matter how you
type the word "Delivered" in the logical_test argument - "delivered", "Delivered", or
"DELIVERED". Nor does it matter whether the word "Delivered" is in lowercase or uppercase in
the source table, as illustrated in the screenshot below.

Another way to achieve exactly the same result is to use the "not equal to" operator and swap
the value_if_true and value_if_false arguments:
=IF(C2<>"delivered", "Yes", "No")
Example 2. Case-sensitive IF formula for text values
If you want a case-sensitive logical test, use the IF function in combination with EXACT that
compares two text strings and returns TRUE if the strings are exactly the same, otherwise it
returns FALSE. The EXACT functions is case-sensitive, though it ignores formatting differences.

You use IF with EXACT in this way:


=IF(EXACT(C2,"DELIVERED"), "No", "Yes")
Where C is the column to which your logical test applies and "DELIVERED" is the casesensitive text value that needs to be matched exactly.

Naturally, you can also use a cell reference rather than a text value in the 2nd argument of the
EXACT function, if you want to.
Note. When using text values as parameters for your IF formulas, remember to always enclose
them in "double quotes".
Example 3. IF formula for text values with partial match
If you want to base your condition on a partial match rather than exact match, an immediate
solution that comes to mind is using wildcard characters (* or ?) in the logical_test argument.
However, this simple and obvious approach won't work. Many Excel functions accept wildcards,
but regrettably IF is not one of them.
A solution is to use IF in combination with ISNUMBER and SEARCH (case-insensitive) or FIND
(case-sensitive) functions.
For example, if No action is required both for "Delivered" and "Out for delivery" items, the
following formula will work a treat:

=IF(ISNUMBER(SEARCH("deliv",C2)), "No", "Yes")

We've used the SEARCH function in the above formula since a case-insensitive match suits
better for our data. If you want a case-sensitive match, simply replace SEARCH with FIND in
this way:
=IF(ISNUMBER(FIND("text", where to search)), value_if_true, value_if_false)
Excel IF formula examples for dates
At first sight, it may seem that IF formulas for dates are identical to IF functions for numeric and
text values that we've just discussed. Regrettably, it is not so.
Unlike many other Excel functions, IF cannot recognize dates and interprets them as mere text
strings, which is why you cannot express your logical test simply as >"11/19/2014" or
>11/19/2014. Neither of the above arguments is correct, alas.
Example 1. IF formulas for dates with DATEVALUE function
To make the Excel IF function to recognize a date in your logical test as a date, you have to
wrap it in the DATEVALUE function, like this DATEVALUE("11/19/2014"). The complete IF
formula may take the following shape:
=IF(C2<DATEVALUE("11/19/2014"), "Completed", "Coming soon")
As illustrated in the screenshot below, this IF formula evaluates the dates in column C and
returns "Completed" if a game was played before Nov-11. Otherwise, the formula returns

"Coming soon".

Example 2. IF formulas with TODAY() function


In case you base your condition on the current date, you can use the TODAY() function in the
logical_test argument of your IF formula. For example:
=IF(C2<DATEVALUE("11/19/2014"), "Completed", "Coming soon")
Naturally, the Excel IF function can understand more complex logical tests, as demonstrated in
the next example.
Example 3. Advanced IF formulas for future and past dates
Suppose, you want to mark only the dates that occur in more than 30 days from now. In this
case, you can express the logical_test argument as A2-TODAY()>30. The complete IF formula
may be as follows:
=IF(A2-TODAY()>30, "Future date", "")
To point out past dates that occurred more than 30 days ago, you can use the following IF
formula:

=IF(TODAY()-A2>30, "Past date", "")

If you want to have both indications in one column, you will need to use a nested IF function like
this:
=IF(A2-TODAY()>30, "Future date", IF(TODAY()-A2>30, "Past date", ""))

Excel IF examples for blank, non-blank cells


If you want to somehow mark your data based on a certain cell(s) being empty or not empty,
you can either:

Use the Excel IF function in conjunction with ISBLANK, or


Use the logical expressions ="" (equal to blank) or <>"" (not equal to blank).
The table below explains the difference between these two approaches and provides formula
example.

Logical test

=""

Blank
cells

ISBLANK()

Description

Formula Example

Evaluates to TRUE if a
specified cell is visually
empty, including cells
withzero length strings.

=IF(A1="", 0, 1)

Otherwise, evaluates to
FALSE.

If A1 contains an empty string,


the formula returns 0.

Evaluates to TRUE is a
specified cell
containsabsolutely
nothing - no formula, no
empty string returned by
some other formula.

=IF(ISBLANK(A1), 0, 1)

Otherwise, evaluates to
FALSE.

That is, if A1 contains an empty


string, the formula returns 1.

Evaluates to TRUE if a
specified cell contains
some data. Otherwise,
evaluates to FALSE.

=IF(A1<>"", 1, 0)

Cells with zero length


strings are
consideredblank.

If A1 contains an empty string,


the formula returns 0.

Evaluates to TRUE if a
specified cell is not empty.
Otherwise, evaluates to
FALSE.

=IF(ISBLANK(A1)=FALSE, 0, 1)

Returns 0 if A1 is visually blank.


Otherwise returns 1.

Returns the results identical to


the above formula but treats
cells with zero length strings as
non-blank cells.

Returns 1 if A1 is non-blank;
otherwise returns 0.

<>""

Nonblank
cells

ISBLANK()=FALSE

Works the same as the above


formula, but returns 1 if A1
contains an empty string.

Cells with zero length


strings are
considerednon-blank.

The following example demonstrates blank / non-blank logical test in action.


Suppose, you have a date in column C only if a corresponding game (column B) was played.
Then, you can use either of the following IF formulas to mark completed games:
=IF($C2<>"", "Completed", "")

=IF(ISBLANK($C2)=FALSE, "Completed", "")


Since there are no zero-length strings in our table, both formulas will return identical results:

Hopefully, the above examples have helped you understand the general logic of the IF function.
In practice, however, you would often want a single IF formula to check multiple conditions, and
our next article will show you how to tackle this task. In addition, we will also explore nested IF
functions, array IF formulas, IFEFFOR and IFNA functions and more. Please stay tuned and
thank you for reading!

How to use pivot tables in Excel - tutorial for beginners

In this Excel pivot table tutorial you fill learn what a PivotTable is, find a number of pivot table
examples that will help you to get started quickly and see how to create and use pivot tables in
Excel 2013, 2010 and 2007.
If you are working with large data sets in Excel, pivot tables come in really handy as a quick way
to make an interactive summary from many records. Among other features, an Excel pivot table
can automatically sort and filter different subsets of data, count totals, calculate average as well
as create cross tabulations.
Another benefit of using pivot tables is that you can set up and change the structure of your
summary table simply by dragging and dropping the source table's columns. This rotation or
pivoting gave the feature its name.

What is an Excel PivotTable?


Creating a pivot table in Excel: quick start
Using Excel pivot tables
Pivot table examples
What is a pivot table in Excel?
An Excel pivot table, aka PivotTable, is a tool to explore and summarize large amounts of data,
analyze related totals and present summary reports. Pivot table reports are essentially designed
to:

Present large amounts of data in a user-friendly way.


Summarize data by categories and subcategories.
Filter, group, sort and conditionally format different subsets of data so that you can focus
on the most relevant information.
Rotate rows to columns or columns to rows (which is called "pivoting") to view different
summaries of the source data.
Subtotal and aggregate numeric data in the spreadsheet.
Expand or collapse the levels of data and drill down to see the details behind any total.
Present concise and attractive online of your Excel data or printed reports.

For example, you may have hundreds of entries in your Excel worksheet with sales figures of
local resellers:

One possible way to sum this long list of numbers by one or several conditions is to use Excel
formulas as demonstrated in SUMIF and SUMIFS tutorials. However, if you want to compare
several facts about each figure, using a pivot table is a far more efficient way. In just a few
mouse clicks, you can get a resilient and easily customizable summary table that totals the

numbers by any field you want.

The screenshots above demonstrate just a few of many possible pivot table layouts. And the
steps below show how you can quickly create your own pivot table in Excel 2013, 2010 and
2007.
How to make a pivot table in Excel: quick start
Many people think that creating an Excel pivot table is burdensome and time-consuming. But
this is not true! Microsoft has been refining the PivotTable technology for many years, and in the
modern versions of Excel, pivot tables are user-friendly are incredibly fast. In fact, you can build
your own summary table in just a couple of minutes. And here's how:
1. Organize your source data in an Excel Table
Before creating a pivot table, organize your data into rows and columns, and then convert your
data range in to an Excel Table. To do this, select all of the data, go to the Inset tab and
click Table.

Using an Excel Table for the source data gives you a very nice benefit - your data range
becomes "dynamic". In this context, a dynamic range means that your table will automatically
expand and shrink as you add or remove entries, so won't have to worry that your pivot table is
missing the latest data.

Useful tips:
Add unique, meaningful headings to your columns, they will turn into the pivot table's
field names later.
Make sure your source table contains no blank rows or columns, and no subtotals.
To make it easier to maintain your pivot table, you can name your source table by
switching to the Design tab and typing the name in the Table Name box the upper right corner
of your worksheet.
2. Create a pivot table
Select any cell in the source data table (if you are building a pivot table based on a range of
cells, select all cells with the data that you want to include), and then go to the Insert tab
> Tables group > PivotTable.

This will open the Create PivotTable window. Make sure the correct table or range of cells is
highlighted in the Table/Range field. Then choose the target location for your Excel pivot table:

Selecting New Worksheet will place a pivot table in a new worksheet starting at cell A1.
Selecting Existing Worksheet will place your pivot table at the specified location in an
existing worksheet. In the Location box, click the range selection icon
to choose the first cell
where you want to position your pivot table.

Clicking OK creates a blank pivot table in the target location, which will look similar to this:

Useful tips:

In most cases, it's convenient to have a pivot table in a separate worksheet, this is
especially recommended for beginners.
If you are creating a pivot table from the data in another worksheet or workbook,
include the workbook and worksheet names using the following syntax
[workbook_name]sheet_name!range, for example, [Book1.xlsx]Sheet1!$A$1:$E$20.
Alternatively, you can click the range selection icon
and select a table or range of cells in
another workbook using the mouse.
It might be useful to create a pivot table and pivot chart at the same time. To do this, in
Excel 2013, go to the Insert tab > Charts group, click the arrow below the PivotChart button, and
then click PivotChart & PivotTable. In Excel 2010 and 2007, click the arrow belowPivotTable,
and then click PivotChart.
3. Arranging the layout of your pivot table report
The Excel Pivot Table user interface is very intuitive and easy-to-use. The area where you work
with the fields of your pivot tables is called PivotTable Field List. Itis located in the right-hand
part of the worksheet and divided into the header and body sections:

The Field Section contains the names of the fields that you can add to your pivot table.
The filed names correspond to the column names of your source table.
The Layout Section contains the Report Filter area, Column Labels, Row Labels area,
and theValues area. Here you can arrange and re-arrange the fields of your pivot table.

The changes that you make in the PivotTable Field List are immediately reflected to your pivot
table.
How to add a field to the pivot table
To add a field to the Layout section, select the check box next to the field name in
the Fieldsection.

By default, Microsoft Excel adds the fields to the Layout section in the following way:

Non-numeric fields are added to the Row Labels area;


Numeric fields are added to the Values area;
Online Analytical Processing (OLAP) date and time hierarchies are added to the Column
Labelsarea.
How to remove a field from the pivot table
To delete a certain field from your Excel pivot table, you can either:

Uncheck the box nest to the field's name in the Field section of the PivotTable pane.
Right-click on the field in your pivot table, and then click "Remove Field_Name".

How to arrange pivot table fields


You can arrange the fields in the Layout section in three ways:
1. Drag and drop fields between the 4 areas of the Layout section using the mouse.
Alternatively, click and hold the field name in the Field section, and then drag it to an area in
the Layout section - this will remove the field from the current area in the Layout section and
place it in the new area.

2. Right-click the field name in the Field section, and then select the area where you want to
add it:

3. Click on the filed in the Layout section to select it. This will also display the options available
for that particular field.

4. Choose the function for the Values field (optional)


By default, Microsoft Excel uses the Sum function for numeric value fields that you place in
theValues area of the PivotTable Field List. When you place non-numeric data (text, date, or
Boolean) or blank values in the Values area, the Count function is applied.
But of course, you can choose a different summary function if you want to. In Excel 2013, rightclick the value field you want to change in the pivot table, click Summarize Values By, and
choose the summary function you want.
In Excel 2010 and lower, the Summarize Values By option is also available on the ribbon - on
theOptions tab, in the Calculations group.
The screenshot below demonstrates an example of the pivot table with the Average function:

The functions' names are mostly self-explanatory:

Sum - calculates the sum of the values.


Count - counts the number of non-empty values (works as the COUNTA function).
Average - calculates the average of the values.
Max - finds the largest value.
Min - finds the smallest value.
Product - calculates the product of the values.
To get more specific functions, click Summarize Values By > More Options You can find the
full list of available summary functions and their detailed descriptions here.
5. Show different calculations in Pivot Table value fields (optional)
Excel pivot tables provide one more useful feature that enables you to present values in
different ways, for example show totals as percentage or rank values from smallest to largest
and vice versa. The full list of calculation options is available here.
This feature is called Show Values As and it's accessible by right-clicking the field in the table
in Excel 2013. In Excel 2010 and lower, you can also find this option on theOptions tab, in

theCalculations group.

Tip. The Show Values As feature may prove especially useful if you add the same field to a
pivot table more than once and show, for example, total sales and sales as a percent of total at
the same time. See an example of such a table.
This is how you create pivot tables in Excel. And now it's time for you to experiment with your
pivot table fields a bit to choose the layout best suited for your data set.
Working with PivotTable Field List
The pivot table pane, which is formally called PivotTable Field List, is the main tool that you
use to arrange your summary table exactly the way you want. To make your work with the fields
more comfortable, you may want to customize the pane to your liking.
Changing the Field List view
If you want to change how the sections are displayed in the Field List, click the Tools button,
and choose your preferred layout.

You can also resize the pane horizontally by dragging the bar (splitter) that separates the
PivotTable pane from the worksheet.
Closing and opening the PivotTable pane
Closing thePivotTableField List is as easy as clicking the Close button (X) in the top right corner
of the pane.Making it to show up again is not so obvious :)
To display the Field List again, right-click anywhere in the pivot table, and then select Show
Field List from the context menu.

You can also click the Field List button on the Ribbon, which resides on the Analyze /
Options tab, in the Show group.

Using Recommended PivotTables in Excel 2013


As you have just seen, creating a pivot table in Excel is easy. However, Microsoft Excel 2013
takes even a step further and proposes to automatically make a pivot table most suited for your
source data. All you have to do is 4 mouse clicks:
1. Click any cell in your source range of cells or table.
2. On the Insert tab, click Recommended PivotTables. Microsoft Excel will immediately display
a few layouts, based on your data.
3. In the Recommended PivotTables dialog box, click a pivot table layout to see its preview.

4. If you are happy with the preview, click the OK button, and get a pivot table added to a new
worksheet.

As you see in the screenshot above, Excel 2013 was able to suggest just a couple of basic
layouts for my source data, which are far inferior to the pivot tables we created manually a
moment ago. Of course, this is only my opinion and I am biased, you know : )
Overall, using the Recommended PivotTable in Excel 2013 is a quick way to get started,
especially when you have a lot of data and are not sure where to start.
How to use pivot table in Excel
Now that you know the pivot table basics, you can navigate to the Analyze and Design tabs of
thePivotTable Tools in Excel 2013 (Options and Design tabs in Excel 2010 and 2007) to
explore the groups and options provided there. These tabs become available as soon as you
click anywhere within your pivot table.

You can also access options and features that are available for a specific pivot table element by
right-clicking that element.
How to design and improve an Excel pivot table
Once you have created a pivot table based on your source data, you may want to refine it
further to make powerful data analysis.
To improve the pivot table's design, head over to the Design tab where you will find plenty of
pre-defined pivot table styles. To create your own style, click the More button in the PivotTable
Stylesgallery, and then click "New PivotTable Style".
To customize the layout of a certain field, click on that field, then click the Field Settings button
on the Analyze tab in Excel 2013 (Options tab in Excel 2010 and 2007). Alternatively, you can
right click the field and choose Field Settings from the context menu.

The screenshot below demonstrate a new design and layout for our pivot table in Excel 2013.

How to get rid of "Row Labels" and "Column Labels" headings


When you are creating a pivot table, Excel applies the Compact layout by default. This layout
displays "Row Labels" and "Column Labels" as headings in the pivot table. Agree, these aren't
very meaningful headings, especially for novices.
An easy way to get rid of these ridiculous headings is to switch the pivot table layout from
Compact to Outline or Tabular. To do this, go to the Design ribbon tab, click the Report

Layoutdropdown, and choose Show in Outline Form or Show in Tabular Form.

This will cause your Excel pivot table to display the actual field names, as you see in the pivot
table on the right, which makes much more sense.

Another solution is to go to the Analyze (Options) tab, click the Options button, switch to
the Displaytab and uncheck the "Display Field Captions and Filter Dropdowns" box. However,
this will remove all field captions as well as filter dropdowns in your pivot table.
How to refresh a pivot table in Excel
Although a pivot table report is connected to your source data, you might be surprised to know
that Excel does not refresh it automatically. You can get any data updates by performing a
refresh operation manually, or have it refresh automatically when you open the workbook.
Refresh the pivot table data manually
1. Click anywhere in your pivot table.
2. On the Analyze tab in Excel 2013 (Options tab in earlier versions), in the Data group, click
theRefresh button, or press ALT+F5.

Alternatively, you can right-click the pivot table, and choose Refresh from the context menu.

To refresh all pivot tables in your Excel workbook, click the Refresh button arrow, and then
clickRefresh All.
Note. If the format of your pivot table gets changed after refreshing, make sure the "Autofit
column width on update" and "Preserve cell formatting on update" options are selected. To
check this, click the Analyze (Options) tab > PivotTable group > Options button. In
the PivotTable Optionsdialog box, switch to the Layout & Format tab and you will find these
check boxes there.
After starting a refresh, you can review the status or cancel it if you've changed your mind.
Just click on the Refresh button arrow, and then click either Refresh Status or Cancel Refresh.
Refreshing a pivot table automatically when opening the workbook
1. On the Analyze / Options tab, in the PivotTable group, click Options > Options.

2. In the PivotTable Options dialog box, go to the Data tab, and select the Refresh data when
opening the file check box.

How to move a pivot table to a new location


If you want to move your pivot table to a new workbook, worksheet are some other area in the
current sheet, head over to the Analyze tab in Excel 2013 (Options tab in Excel 2010 and
earlier) and click the Move PivotTable button in the Actions group. Select a new destination

and click OK.

How to delete an Excel pivot table


If you no longer need a certain pivot table, you can delete it in a number of ways.

If your pivot table resides in a separate worksheet, simply delete that sheet.
If your pivot table is located along with some other data on a sheet, select the entire
pivot table using the mouse and press the Delete key.
Click anywhere in the pivot table that you want to delete, go to the Analyze tab in Excel
2013 (Options tab in Excel 2010 and earlier) > Actions group, click the little arrow below
the Selectbutton, choose Entire PivotTable, and then press Delete.

Note. If any PivotTable chart is associated with your pivot table, deleting the pivot table will turn
it into a standard chart can no longer be pivoted or updated.

Pivot table examples


The screenshots below demonstrate a few possible pivot table layouts for the same source data
that might help you to get started on the right path. Feel free to download them get a hands-on
experience.

Pivot table example 1: Two-dimensional table


No Filter
Rows: Product, Reseller
Columns: Months
Values: Sales

Pivot table example 2: Three-dimensional table


Filter: Month
Rows: Reseller
Columns: Product
Values: Sales
This pivot table lets you filter the report by month.

Pivot table example 3: One field is displayed twice - as total and % of total
No Filter
Rows: Product, Reseller
Values: SUM of Sales, % of Sales

This pivot table shows total sales and sales as a percent of total at the same time.

Hopefully, this pivot table tutorial has been a good starting point for you. If you want to learn
advanced features and capabilities of Excel pivot tables, check out the links below. And thank
you for reading!

How to use Excel SUMIFS and SUMIF with multiple criteria - formula examples
This tutorial explains the difference between the SUMIF and SUMIFS functions in terms of their
syntax and usage, and provides a number of formula examples to sum values with multiple
AND / OR criteria in Excel 2013, 2010, 2007, 2003 and lower.
As everyone knows, Microsoft Excel provides an array of functions to perform various
calculations with data. A few articles ago, we explored COUNTIF and COUNTIFS, which are
designed for counting cells based on a single condition and several conditions, respectively.
Last week we covered Excel SUMIF that adds values meeting the specified criteria. Now it's
time to go over the plural version of SUMIF - Excel SUMIFS that allows summing values by
multiple criteria.
Those who are familiar with the SUMIF function might think that converting it to SUMIFS takes
just an extra "S" and a few additional criteria. This would seem quite logical... but "logical" it's
not always the case when dealing with Microsoft : )

SUMIF function - syntax & usage


SUMIFS function - syntax & usage
How to use SUMIFS in Excel (AND logic)
Excel SUMIF with multiple criteria (OR logic)
Excel SUMIFS with multiple OR conditions
Using Excel SUM in array formulas
Excel SUMIF function - syntax & usage
The SUMIF function is used to conditionally sum values based on a single criteria. We
discussed its syntax in detail in the previous article, so let me give you just a quick summary
now.

SUMIF(range, criteria, [sum_range])


range - the range of cells to be evaluated by your criteria, required.
criteria - the condition that must be met, required.
sum_range - the cells to sum if the condition is met, optional.
As you see, the syntax of the Excel SUMIF function allows for one condition only. And still, we
say that Excel SUMIF can be used to sum values with multiple criteria. How can that be? By
adding the results of several SUMIF functions and by using SUMIF formulas with array criteria,
as demonstrated in the examples that follow.
Excel SUMIFS function - syntax & usage
You use SUMIFS in Excel to find a conditional sum of values based on multiple criteria. The
SUMIFS function was introduced in Excel 2007, so you can use it in all modern versions of
Excel 2013, 2010 and 2007.
Compared to SUMIF, the SUMIFS syntax is a little bit more complex:

SUMIFS(sum_range, criteria_range1, criteria1,[criteria_range2, criteria2],...)


The first 3 arguments are mandatory, additional ranges and their associated criteria are
optional.

sum_range - one or more cells to sum, required. This can be a single cell, a range of
cells or a named range. Only cells with numbers are summed; blank and text values are
ignored.
criteria_range1 - the first range to be evaluated by the associated criteria, required.
criteria1 - the first condition that must be met, required. You can supply the criteria in the
form of a number, logical expression, cell reference, text or another Excel function. For example
you can use criteria such as 10, ">=10", A1, "cherries" or TODAY().
criteria_range2, criteria2, ... - these are additional ranges and criteria associated with
them, optional. You can use up to 127 range/criteria pairs in SUMIFS formulas.
Important! The SUMIFS function works with AND logic, meaning that each cell in
the sum_range argument is summed only if all of the specified criteria are true for that cell.
And now, let's have a look at the Excel SUMIFS formula with two conditions. Suppose, you have
a table listing the consignments of fruit from different suppliers. You have the fruit names in
column A, suppliers' names in column B, and quantity in column C. What you want is to find out
a sum of amounts relating to a given fruit and supplier, e.g. all apples supplied by Pete.

When you're learning something new, it's always a good idea to start with simple things. So, to
begin with, let's define all the arguments for our SUMIFS formula:

sum_range - C2:C9
criteria_range1 - A2:A9
criteria1 - "apples"
criteria_range2 - B2:B9
criteria2 - "Pete"
Now assemble the above parameters, and you will get the following SUMIFS formula:

=SUMIFS(C2:C9, A2:A9, "apples", B2:B9, "Pete")

To refine the formula further, you can replace the text criteria "apples" and "Pete" with cell
references. In this case, you won't have to change the formula to calculate the quantity of other
fruit from a different supplier:
=SUMIFS(C2:C9, A2:A9, F1, B2:B9, F2)
Using SUMIFS and SUMIF in Excel - things to remember
Since the aim of this tutorial is to cover all possible ways to sum values by several conditions,
we will discuss formula examples with both functions - Excel SUMIFS and SUMIF with multiple
criteria. To use them correctly, you need to clearly understand what these two functions have in
common and in what way they are different.
While the common part is clear - similar destination and parameters - the differences are not so
obvious, though very essential.
1. The order of arguments
In Excel SUMIF and SUMIFS functions, the order of arguments is different. In particular,
sum_range is the 1st parameter in SUMIFS, but it is 3rd in SUMIF.
At first sight, it may seem that Microsoft deliberately complicates the learning curve for its users.
However, upon a closer look, you will see the reasoning behind it. The point is that sum_range
is optional in SUMIF. If you omit it, no problem, your SUMIF formula will sum values in the range
(first parameter).

In SUMIFS, the sum_range is very important and obligatory, and that is why it comes first.
Probably Microsoft guys thought that after adding the 10th or 100th range / criteria pair, someone
might forget to specify the range to sum : )
Wrapping up, if you are copying and editing these functions, make sure you put the parameters
in the right order.
2. The size of sum_range and criteria_range arguments
In the SUMIF function, the sum_range argument does not necessarily have to be of the same
size as the range argument, as long as you have the top left cell right. In Excel SUMIFS, each
criteria_range must contain the same number of rows and columns as the sum_range
parameter.
For example, =SUMIF(A2:A9,F1,C2:C18) will return the correct result because Excel considers
only the upper leftmost cell in the sum_range argument (C2 in this example, which is correct),
and then includes as many columns and rows as contained in the range argument.
The SUMIFS formula =SUMIFS(C2:C9, A2:A9, "apples", B2:B10, "Pete") will return the
#VALUE! error because criteria_range2 (B2:B10) does not match in size criteria_range1 (A2:A9)
and sum_range (C2:C9).
Alright, enough strategy (i.e. theory), let's get into the tactics (i.e. formula examples : )
How to use SUMIFS in Excel - formula examples
A moment ago, we discussed a simple SUMIFS formula with two text criteria. In the same
manner, you can use Excel SUMIFS with multiple criteria expressed by numbers, dates, logical
expressions, and other Excel functions.
Example 1. Excel SUMIFS with comparison operators
In our fruit suppliers table, suppose, you want to sum all deliveries by Mike with Qty. 200 or
more. To do this, you use the comparison operator "greater than or equal to" (>=) in criteria2
and get the following SUMIFS formula:

=SUMIFS(C2:C9,B2:B9,"Mike",C2:C9,">=200")

Note. Please pay attention that in Excel SUMIFS formulas, logical expressions with comparison
operators should always be enclosed in double quotes ("").
We covered all possible comparison operators in detail when discussing Excel SUMIF function,
the same operators can be used in SUMIFS criteria. For example, the following formula with
return the sum of all values in cells C2:C9 that are greater than or equal to 200 and less than or
equal to 300.
=SUMIFS(C2:C9, C2:C9,">=200", C2:C9,"<=300")
Example 2. Using Excel SUMIFS with dates
In case you want to sum values with multiple criteria based on the current date, use the
TODAY() function in your SUMIFS criteria, as demonstrated below. The following formula sums
values in column D if a corresponding date in column C falls within the last 7 days, including
today:

=SUMIFS(D2:D10, C2:C10,">="&TODAY()-7, C2:C10,"<="&TODAY())

Note. When you use another Excel function together with a logical operator in the criteria, you
have to use the ampersand (&) to concatenate a string, for example "<="&TODAY().
In a similar fashion, you can use the Excel SUMIF function to sum values in a given date range.
For example, the following SUMIFS formula adds the values in cells C2:C9 if a date in column B
falls between 1-Oct-2014 and 31-Oct-2014, inclusive.
=SUMIFS(C2:C9, B2:B9, ">=10/1/2014", B2:B9, "<=10/31/2014")
The same result can be achieved by calculating the difference of two SUMIF functions, as
demonstrated in this example - How to use SUMIF to sum values in a given date range.
However, Excel SUMIFS is much easier and more understandable, isn't it?
Example 3. Excel SUMIFS with blank and non-blank cells
When analyzing reports and other data, you may often need to sum values corresponding either
to empty or non-empty cells.
Criteria

Description

"="

Sum values
corresponding to blank
cells that contain
absolutely nothing - no
formula, no zero length
string.

""

Sum values

Blank
cells

Formula Example
=SUMIFS(C2:C10, A2:A10, "=", B2:B10,
"=")
Sum values in cells C2:C10 if the
corresponding cells in columns A and B are
absolutely empty.
=SUMIFS(C2:C10, A2:A10, "", B2:B10, "")

corresponding to "visually"
blank cells including those
that contain empty strings
returned by some other
Excel function (for
example, cells with a
formula like ="").

Sum values in cells C2:C10 with the same


conditions as the above formula, but
includes empty strings.

=SUMIFS(C2:C10, A2:A10, "<>", B2:B10,


"<>")
"<>"

Sum values
corresponding to nonempty cells, including zero
length strings.

Nonblank
cells

Sum values in cells C2:C10 if the


corresponding cells in columns A and B are
not empty, including cells with empty
strings.
=SUM(C2:C10) - SUMIFS(C2:C10,
A2:A10, "", B2:B10, "")

SUMSUMIF
or
SUM /
LEN

Sum values
corresponding to nonempty cells, not including
zero length strings.

=SUM((C2:C10) *
(LEN(A2:A10)>0)*(LEN(B2:B10)>0))
Sum values in cells C2:C10 if the
corresponding cells in columns A and B are
not empty, cells with zero length strings are
not included.

And now, let's see how you can use a SUMIFS formula with "blank" and "non-blank" criteria on
real data.
Suppose, you have an order date in column B, delivery date in column C and Qty. in column D.
How do you find the total of products that have not been delivered yet? That is, you want to
know the sum of values corresponding to non-empty cells in column B and empty cells in
column C.
The solution is to use the SUMIFS formula with 2 criteria:

=SUMIFS(D2:D10, B2:B10,"<>", C2:C10,"=")

Using Excel SUMIF with multiple OR criteria


As noted in the beginning of this tutorial, the SUMIFS function is designed with AND logic. But
what if you need to sum values with multiple OR criteria, i.e. when at least one of the conditions
is met?
Example 1. SUMIF + SUMIF
The simplest solution is to sum the results returned by several SUMIF functions. For example,
the following formula demonstrates how to find the total of products delivered by Mike and John:
=SUMIF(C2:C9,"Mike",D2:D9) + SUMIF(C2:C9,"John",D2:D9)

As you see, the first SUMIF function adds the quantities corresponding to "Mike", the other
SUMIF function returns the amounts relating to "John" and then you add these 2 numbers.

Example 2. SUM & SUMIF with an array argument


The above solution is very simple and may get the job done quickly when there are only a
couple of criteria. But a SUMIF + SUMIF formula may grow up enormously if you want to sum
values with multiple OR conditions. In this case, a better approach is using an array
criteria argument in the SUMIF function. Let's examine this approach now.
You can start by listing all of your conditions separated by commas and then enclose the
resulting comma-separated list in {curly brackets}, which is technically called an array.
In the previous example, if you want to sum the products delivered by John, Mike and Pete,
your array criteria will look like {"John","Mike","Pete"}. And the complete SUMIF function
is SUMIF(C2:C9, {"John","Mike","Pete"} ,D2:D9).
The array argument consisting of 3 values forces your SUMIF formula to return three separate
results, but since we write the formula in a single cell, it would return the first result only - i.e. the
total of products delivered by John. To get this array-criteria approach to work, you have to use
one more little trick - enclose your SUMIF formula in a SUM function, like this:
=SUM(SUMIF(C2:C9, {"John","Mike","Pete"} , D2:D9))

As you see, an array criteria makes the formula much more compact compared to SUMIF +
SUMIF, and lets you add as many values as you like in the array.
This approach works with numbers as well as with text values. For instance, if instead of the
suppliers' names in column C, you had supplier IDs like 1, 2, 3 etc., then your SUMIF formula
would look similar to this:
=SUM(SUMIF(C2:C9, {1,2,3} , D2:D9))
Unlike text values, numbers needn't be enclosed in double quotes in array arguments.

Example 3. SUMPRODUCT & SUMIF


In case, your preferred way is to list the criteria in some cells rather that specify them directly in
the formula, you can use SUMIF in conjunction with the SUMPRODUCT function that multiplies
components in the given arrays, and returns the sum of those products.
=SUMPRODUCT(SUMIF(C2:C9, G2:G4, D2:D9))
Where G2:G4 are the cells containing your criteria, the suppliers' names in our case, as
illustrated in the screenshot below.
But of course, nothing prevents you from listing the values in an array criteria of your SUMIF
function if you want to:
=SUMPRODUCT(SUMIF(C2:C9, {"Mike","John","Pete"}, D2:D9))
The result returned by both formulas will be identical to what you see in the screenshot:

Excel SUMIFS with multiple OR criteria


If you want to conditionally sum values in Excel not simply with multiple OR conditions, but with
several sets of conditions, you will have to use SUMIFS instead of SUMIF. The formulas will be
very similar to what we've just discussed.
As usual, an example might help to illustrate the point better. In our table of fruit suppliers, let's
add the Delivery Date (column E) and find the total quantity delivered by Mike, John and Pete in
October.
Example 1. SUMIFS + SUMIFS
The formula produced by this approach includes a lot of repetition and looks cumbersome, but it
is easy to understand and, most importantly, it works : )

=SUMIFS(D2:D9,C2:C9, "Mike", E2:E9,">=10/1/2014", E2:E9, "<=10/31/2014") +


SUMIFS(D2:D9, C2:C9, "John", E2:E9, ">=10/1/2014", E2:E9, "<=10/31/2014") +
SUMIFS(D2:D9, C2:C9, "Pete", E2:E9, ">=10/1/2014" ,E2:E9, "<=10/31/2014")
As you see, you write a separate SUMIFS function for each of the suppliers and include two
conditions - equal to or greater than Oct-1 (">=10/1/2014",) and less than or equal to Oct 31
("<=10/31/2014"), and then you sum the results.

Example 2. SUM & SUMIFS with an array argument


I've tried to explain the essence of this approach in the SUMIF example, so now we can simply
copy that formula, change the order of arguments (as you remember it is different in SUMIF and
SUMIFS) and add additional criteria. The resulting formula is more compact than SUMIFS +
SUMIFS:
=SUM(SUMIFS(D2:D9,C2:C9, {"Mike", "John", "Pete"}, E2:E9,">=10/1/2014", E2:E9,
"<=10/31/2014"))
The result returned by this formula is exactly the same as you see in the screenshot above.
Example 3. SUMPRODUCT & SUMIFS
As you remember, the SUMPRODUCT approach differs from the previous two in the way that
you enter each of your criteria in a separate cell rather that specify them directly in the formula.
In case of several criteria sets, the SUMPRODUCT function won't suffice and you will have to
employ ISNUMBER and MATCH as well.
So, assuming that the Supplies Names are in cells H1:H3, Start Date is in cell H4 and End Date
in cell H5, our SUMPRODUCT formula takes the following shape:

=SUMPRODUCT(--(E2:E9>=H4), --(E2:E9<=H5), --(ISNUMBER(MATCH(C2:C9, H1:H3,0))),


D2:D9)

Many people wonder why use double dash (--) in SUMPRODUCT formulas. The point is that
Excel SUMPRODUCT ignores all but numeric values, while the comparison operators in our
formula return Boolean values (TRUE / FALSE), which are non-numeric. To convert these
Boolean values to 1's and 0's, you use the double minus sign, which is technically called the
double unary operator. The first unary coerces TRUE/FALSE to -1/0, respectively. The second
unary negates the values, i.e. reverses the sign, turning them into +1 and 0, which the
SUMPRODUCT function can understand.
I hope the above explanation makes sense. And even if it doesn't, just remember this rule of the
thumb - use the double unary operator (--) when you are using comparison operators in your
SUMPRODUCT formulas.
Using Excel SUM in array formulas
As you remember, Microsoft implemented the SUMIFS function in Excel 2007. If someone still
uses Excel 2003, 2000 or earlier, you will have to use a SUM array formula to add values with
multiple AND criteria. Naturally, this approach works in modern versions of Excel 2013 - 2007
too, and can be deemed an old-fashioned counterpart of the SUMIFS function.
In the SUMIF formulas discussed above, you have already used array arguments, but an array
formula is something different.

Example 1. Sum with multiple AND criteria in Excel 2003 and earlier
Let's get back to the very first example where we found out a sum of amounts relating to a given
fruit and supplier:

As you already know, this task is easily accomplished using an ordinary SUMIFS formula:
=SUMIFS(C2:C9, A2:A9, "apples", B2:B9, "Pete")
And now, let's see how the same task can be fulfilled in early "SUMIFS-free" versions of Excel.
First off, you write down all the conditions that should be met in the form of range="condition". In
this example, we have two range/condition pairs:
Condition 1: A2:A9="apples"
Condition 2: B2:B9="Pete"
Then, you write a SUM formulas that "multiplies" all of your range/condition pairs, each
enclosed in brackets. The last multiplier is the sum range, C2:C9 in our case:
=SUM((A2:A9="apples") * ( B2:B9="Pete") * ( C2:C9))

As illustrated in the screenshot below, the formula perfectly works in the latest Excel 2013
version.

Note. When entering any array formula, you must press Ctrl + Shift + Enter. Once you do this,
your formula gets enclosed in {curly braces}, which is a visual indication that an array formula is
entered correctly. If you try typing the braces manually, your formula will be converted to a text
string, and it won't work.
Example 2. SUM array formulas in modern Excel versions
Even in modern versions of Excel 2013, 2010 or 2007, the power of the SUM function should
not be underestimated. The SUM array formula is not simply gymnastics of the mind, but has a
practical value, as demonstrated in the following example.
Suppose, you have two columns, B and C, and you need to count how many times column C is
greater than column B, when a value in column C is greater or equal to 10. An immediate
solution that comes to mind is using the SUM array formula:

=SUM((C1:C10>=10) * (C1:C10>B1:B10))

Don't see any practical application to the above formula? Think about it in another way : )
Suppose, you have the orders list like shown in the screenshot below and you want to know
how many products have not been delivered in full by a given date. Translated into Excel's
language, we have the following conditions:
Condition 1: A value in column B (Ordered items) is greater than 0
Condition 2: A value in column C (Delivered) in less than in column B
Condition 3: A date in column D (Due date) is less than 11/1/2014.
Putting the three range/condition pairs together, you get the following formula:

=SUM((B2:B10>=0)*(B2:B10>C2:C10)*(D2:D10<G2))

Well, the formula examples discussed in this tutorial have only scratched the surface of what
Excel SUMIFS and SUMIF functions can really do. But hopefully, they have helped pointing you
in the right direction and now you can sum values in your Excel workbooks no matter how many
intricate conditions you have to consider.

How to use SUMIF in Excel - formula examples to conditionally sum cells


This tutorial explains the Excel SUMIF function in plain English and provides a numbers of
SUMIF formula examples for numbers, text, dates and wildcards.
If you are faced with the task that requires conditional sum in Excel, the SUMIF function is what
you need. This tutorial will briefly explain the function's syntax and general usage, and then you
will extend the new knowledge in practice with a number of SUMIF formula examples.
A good thing is that the SUMIF function is identical in all Excel versions, from 2013 to 2003.
Another great news is that once you've invested some time in learning SUMIF, it will take you
very little effort to get the insight of other "IF" functions such as SUMIFS, COUNTIF, COUNTIFS,
AVERAGEIF etc.

o
o
o
o
o
o
o
o
o

SUMIF in Excel - syntax and usage


Excel SUMIF formula examples
Sum if greater than, less than or equal to
Excel SUMIF formulas with text criteria
Using comparison operators with cell references
SUMIF examples with wildcard characters
Sum the largest or smallest numbers in a range
Sum cells that correspond to empty cells
Sum cells that correspond to non-empty cells
Using Excel SUMIF with dates
Summing values in several columns
Why isn't my SUMIF formula working correctly?
SUMIF in Excel - syntax and usage
The SUMIF function, also known as Excel conditional sum, is used to add cells based on a
certain condition, or criteria.
If you've happened to read the COUNTIF tutorial on this blog, you won't have any difficulties
with understanding Excel SUMIF because its syntax and usage is analogous. So, the syntax of
the SUMIF function is as follows:
SUMIF(range, criteria, [sum_range])
As you see, the SUMIF function has 3 arguments - first 2 are required and the 3rd one is
optional.
1. range - the range of cells to be evaluated by your criteria, for example A1:A10.
2. criteria - the condition that must be met. The criteria may be supplied in the form of a
number, text, date, logical expression, a cell reference, or another Excel function. For example,
you can enter the criteria such as "5", "cherries", "10/25/2014", "<5", "A1", etc.

Note. Please pay attention that any text criteria or criteria containing mathematical symbols
must be enclosed in double quotation marks ("). For numerical criteria, double quotation marks
are not required.
3. sum_range - the cells to sum if the condition is met. This argument is optional, and you need
to use it only if you want to sum cells other than defined in the range argument. If the
sum_range argument is omitted, Excel will sum the same cells to which the criteria is applied
(i.e. specified in the range argument).
To illustrate the Excel SUMIF syntax better, let's consider the following example. Suppose you
have a list of products in column A and corresponding amounts in column C. You want to know
the sum of all amounts relating to a given product, e.g. bananas.

Now, let's define the arguments for our SUMIF formula:

range - A2:A8
criteria - "bananas"
sum_range - C2:C8
Putting this together, you get: =SUMIF(A2:A8, "bananas", C2:C8)

This formula example demonstrates the simplest usage of the SUMIF function with the text
criteria. Instead of text, you can include a number, date or a cell references in your criteria. For
instance, you can re-write the above formula so that it references the cell containing the name
of the product to be summed:
=SUMIF(A2:A8,F1,C2:C8)
Note. The sum_range parameter actually specifies only the upper leftmost cell of the range to
be summed. The remaining area is defined by the dimensions of the range argument.
In practice, this means that the sum_range argument does not necessarily have to be of the
same size as the range argument, i. e. it may have a different number of rows and columns.
However, the first cell (i.e. the top left cell) of the sum range must always be the right one. For
example, in the above SUMIF formula, you can supply C2, or C2:C4, or even C2:C100 as the
sum_range argument, and the result will still be the same. However, the best practice is to
provide equally sized range and sum_range.
The point is that Microsoft Excel cannot rely on the user's ability to provide matching range and
sum_range parameters, so to avoid possible inconsistency issues and prevent errors, Microsoft
Excel determines the sum range on its own in the following way. It takes the top left cell in the
sum_range argument as the beginning cell (C2 in our Excel SUMIF example), and then includes
as many columns and rows as contained in the range argument (in our case, it's 1 column x 7
rows, i.e. C2:C8).
How to use SUMIF in Excel - formula examples
Hopefully, the above example has helped you to gain some basic understanding of how the
SUMIF function works. Below you will find a few more formulas that demonstrate how to use
SUMIF in Excel with various criteria and on different data sets.
SUMIF greater than, less than or equal to
Let's have a look at a few SUMIF formulas that you can use to add up values greater than, less
than or equal to a given value.
Note. Please pay attention that in Excel SUMIF formulas, a comparison operator followed by a
number or text should always be enclosed in double quotes ("").
Criteria

Operator

Formula Example

Description

Sum if
greater than

>

=SUMIF(A2:A10, ">5")

Sum the values over 5 in cells


A2:A10.

Sum if less
than

<

=SUMIF(A2:A10, "<10",
B2:B10)

Sum the values in cells B2:B10 if a


corresponding value in column A is
less than 10.

Sum if equal

=SUMIF(A2:A10,

Sum the values in cells A2:A10 that

to

(can be
omitted)

"="&D1)
or
=SUMIF(A2:A10,D1)

are equal to the value in cell D1.

Sum if not
equal to

<>

=SUMIF(A2:A10,
"<>"&D1, B2:B10)

Sum the values in cells B2:B10 if a


corresponding cell in column A is
not equal to the value in cell D1.

Sum if
greater than
or equal to

>=

=SUMIF(A2:A10, ">=5")

Sum the values greater than or


equal to 5 in the range A2:A10.

Sum if less
than or equal
to

<=

=SUMIF(A2:A10,
"<=10", B2:B10)

Sum the values in cells B2:B10 if a


corresponding value in column A is
less than or equal to 10.

How to use Excel SUMIF with text criteria


Apart from numbers, the SUMIF function enables you to add values depending on whether a
corresponding cell in another column contains a given text or not.
Please pay attention that you will need different SUMIF formulas for exact and partial match, as
demonstrated in the table below.
Criteria

Sum if
equal to

Sum if
not equal
to

Formula Example

Description

Exact match:
=SUMIF(A2:A8,
"bananas", C2:C8)

Sum values in cells C2:C8 if a corresponding cell in


column A contains exactly the word "bananas" and no
other words or characters. Cells containing "green
bananas", "bananas green" or "bananas!" will not be
included.

Partial match:
=SUMIF(A2:A8,
"*bananas*",
C2:C8)

Sum values in cells C2:C8 if a corresponding cell in


column A contains the word "bananas", alone or in
combination with any other words. Cells containing
"green bananas" or "bananas green" will be summed.

Exact match:
=SUMIF(A2:A8,
"<>bananas",
C2:C8)

Sum values in cells C2:C8 if a corresponding cell in


column A contains any value other than "bananas". If a
cell contains "bananas" together with some other words
or characters like "yellow bananas" or "bananas yellow",
such cells will be summed.

Partial match:
=SUMIF(A2:A8,
"<>*bananas*",
C2:C8)

Sum values in cells C2:C8 if a corresponding cell in


column A does not contain the word "bananas", alone or
in combination with any other words. Cells containing
"yellow bananas" or "bananas yellow" will not be
summed.

For more information about partial match, please see SUMIF examples with wildcard
characters.
And now, let's see the exact "Sum if not equal to" formula in action. As illustrated in the
screenshot below, it adds in-stock amounts of all products other than "goldfinger bananas":
=SUMIF(A2:A7,"<> goldfinger bananas", C2:C7)

Note. Like most of other Excel functions, SUMIF is case-insensitive, meaning that "<>bananas",
"<>Bananas" and "<>BANANAS" will produce exactly the same result.
Using comparison operators with cell references
If you want to take a step further and get a more universal Excel SUMIF formula, you can
replace a numerical or text value in the criteria with a cell reference, like this:
=SUMIF(A2:A8,"<>"&F1, C2:C8)
In this case, you won't have to change the formula to conditionally sum values based on another
criteria - you will simply type a new value in a referenced cell.

Note. When you use a logical expression with a cell reference, you must use the double quotes
("") to start a text string and ampersand (&) to concatenate and finish the string off, for example
"<>"&F1.
The "equal to" operator (=) can be omitted before a cell reference, therefore both of the below
formulas are equivalent and correct:
Formula 1: =SUMIF(A2:A8, "="&F1, C2:C8)
Formula 2: =SUMIF(A2:A8, F1, C2:C8)
SUMIF formulas with wildcard characters
If you aim to conditionally sum cells based on a "text" criteria and you want to sum by partial
match, then you need to use wildcard characters in your SUMIF formula.
The following wildcards are available to us:

Asterisk (*) - represents any number of characters


Question mark (?) - represents a single character in a specific position
Example 1. Sum values based on partial match
Suppose, you want to sum amounts relating to all sorts of bananas. The following SUMIF
formulas will work a treat:
=SUMIF(A2:A8, "*bananas*", C2:C8) - the criteria includes text enclosed in asterisks (*).
=SUMIF(A2:A8, "*"&F1&"*", C2:C8) - the criteria includes a cell reference enclosed in
asterisks, please notice the use of ampersand (&) before and after a cell reference to
concatenate a string.

If you want to count only those cells that start or end with certain text, add just one * either
before or after the text:

=SUMIF(A2:A8, "bananas*", C2:C8) - sum values in C2:C8 if a corresponding cell in column A


begins with the word "bananas".
=SUMIF(A2:A8, "*bananas", C2:C8) - sum values in C2:C8 if a corresponding cell in column A
ends with the word "bananas".
Example 2. Sum values with a given number of characters
In case you want to sum some values that are exactly 6 letters long, you would use the following
formula:
=SUMIF(A2:A8, "??????", C2:C8)
Example 3. Sum cells corresponding to text values
If your worksheet contains different data types and you only want to sum cells corresponding to
text values, the following SUMIF formulas will come in handy:
=SUMIF(A2:A8,"?*", C2:C8) - adds up values in cells C2:C8 if a corresponding cell in column A
contains at least 1 symbol.
=SUMIF(A2:A8,"*",C2:C8) - includes seemingly empty cells that contain zero length strings
returned by some other formulas, e.g. ="".
Both of the above formulas ignore non-text values such as errors, booleans, numbers and
dates.
Example 4. Treat * or ? as usual characters
If you want either * or ? to be treated as a literal rather than a wildcard, then use the preceding
tilde (~). For example, the following SUMIF formula will add values in cells C2:C8 if a cell in
column A in the same row contains a question mark:

=SUMIF(A2:A8, "~?", C2:C8)

Sum the largest or smallest numbers in a range


To add the largest or smallest numbers in the range, use the SUM function together with the
LARGE or SMALL function, respectively.
Example 1. Add a few largest / smallest numbers
If you want to sum just a few numbers, say 5, you can type them directly in the formula, like this:
=SUM(LARGE(B1:B10,{1,2,3,4,5})) - sum the largest 5 numbers
=SUM(SMALL(B1:B10,{1,2,3,4,5})) - sum the smallest 5 numbers

Note. If there are 2 or more numbers that are tied for last place, only the first will be included. As
you see, the second 9 is not added up in the above example.

Example 2. Add many top / bottom numbers


If you want to add up many numbers, instead of enumerating them all in the formula, you can
nest the ROW and INDIRECT functions in your SUM formula. In the INDIRECT function, use
row numbers that represent the number of values you want to add up. For example, the
following formulas sum the top and bottom 15 numbers, respectively:
=SUM(LARGE(B1:B50,ROW(INDIRECT("1:15"))))
=SUM(SMALL(B1:B50,ROW(INDIRECT("1:15"))))
Since these are array formulas, remember to enter them in the array-way by pressing Ctrl +
Shift + Enter.

Example 3. Sum a variable number of largest / smallest values


If you'd rather not change the formula every time you want to sum a different number of cells,
you can put that number in some cell instead of entering it directly in the formula. And then, you
can use the ROW and INDIRECT functions as demonstrated above and refer to a cell
containing the variable, cell E1 in our case:
=SUM(LARGE(B1:B50,ROW(INDIRECT("1:"&E1)))) - sums a variable number of top values
=SUM(SMALL(B1:B50,ROW(INDIRECT("1:"&E1)))) - sums a variable number of bottom
values

Remember, these are array formulas, so you have to press Ctrl + Shift + Enter to complete
them.
How to sum cells that correspond to blank cells
If "blank" means cells that contain absolutely nothing - no formula, no zero length string returned
by some other Excel function, then use "=" as the criteria, like in the following SUMIF formula:
=SUMIF(A2:A10,"=",C2:C10)
If "blank" includes zero length strings (for example, cells with a formula like =""), then use "" as
the criteria:
=SUMIF(A2:A10,"",C2:C10)
Both of the above formulas evaluate cells in column A and if any empty cells are found, the
corresponding values from column C are added.

How to sum cells corresponding to non-blank cells


If you want to sum cells' values in column C when a corresponding cell in column A is not empty,
use "<>" as the criteria in your SUMIF formula:
=SUMIF(A2:A10,"<>",C2:C10)
The above formula counts values corresponding to all non-empty cells, including zero length
strings.
How to use Excel SUMIF with dates
Generally, you use the SUMIF function to conditionally sum values based on dates in the same
way as you use text and numeric criteria.
If you want to sum values corresponding to the dates that are greater than, less than or equal to
the date you specify, then use the comparison operators that we've discussed a moment ago. A
few Excel SUMIF formula examples follow below:
Criteria
Sum values based on
a certain date.

Sum values if a
corresponding date is
greater than or equal
to a given date.
Sum values if a
corresponding date is
greater than a date in
another cell.

Formula Example

Description

=SUMIF(B2:B9,"10/29/2014",C2:C9)

Sum values in cells


C2:C9 if a corresponding
date in column B is 29Oct-2014.

=SUMIF(B2:B9,">=10/29/2014",C2:C9)

Sum values in cells


C2:C9 if a corresponding
date in column B is
greater than or equal to
29-Oct-2014.

=SUMIF(B2:B9,">"&F1,C2:C9)

Sum values in cells


C2:C9 if a corresponding
date in column B is
greater than the date in
F1.

In case you want to sum values based on a current date, then you have to use Excel SUMIF in
combination with the TODAY() function as demonstrated below:
Criteria

Formula Example

Sum values based on the current date.

=SUMIF(B2:B9, TODAY(), C2:C9)

Sum values corresponding to a prior date, i.e.


before today.

=SUMIF(B2:B9, "<"&TODAY(),
C2:C9)

Sum values corresponding to a future date, i.e. after


today.

=SUMIF(B2:B9, ">"&TODAY(),
C2:C9)

Sum values if a date occurs in a week (i.e. today +


7 days).

=SUMIF(B2:B9, "="&TODAY()+7,
C2:C9)

The screenshot below illustrates how you can use the last formula to find the total amount of all
products that ship in a week.

How to sum values in a given date range


The following question is frequently asked on Excel forums and blogs - "How do I sum between
two dates?"
The answer is to use a combination, or more precisely, the difference of 2 SUMIF functions. In
Excel 2007 and higher, you can also use the SUMIFS function that allows multiple criteria,
which is even a better option. While the latter is the subject of our next article, an example of the
SUMIF formula follows below:
=SUMIF(B2:B9, ">=10/1/2014", C2:C9) - SUMIF(B2:B9, ">=11/1/2014", C2:C9)

This formula sums up the values in cells C2:C9 if a date in column B is between 1-Oct-2014 and
31-Oct-2014, inclusive.

This formula might seem a bit tricky at first sight, but upon a closer look, it appears quite simple.
The first SUMIF function adds up all the cells in C2:C9 where the corresponding cell in column
B is greater than or equal to the start date (Oct-1 in this example). Then you just have to
subtract any values that fall after the end date (Oct-31), which are returned by the second
SUMIF function.
How to sum values in several columns
To understand the problem better, let's consider the following example. Suppose, you have a
summary table of monthly sales. Since it was consolidated from a numbers of regional reposts,
there are a few records for the same product:

So, how do you find the total of apples sold in all the states in the past three months?
As you remember, the dimensions of sum_range are determined by the dimensions of the range
parameter. That is why you cannot use the formula like =SUMIF(A2:A9,"apples",C2:E9)

because it will add up the values corresponding to "Apples" in column C only. This is not what
we are looking for, right?
The most logical and simplest solution that suggests itself is to create a helper column that
calculates individual sub-totals for each row and then reference that column in the sum_range
criteria.
Go ahead and place a simple SUM formula in cell F2, then fill down column F: =SUM(C2:E2)
After that, you can write a usual SUMIF formula like this:
=SUMIF(A2:A9, "apples", F2:F9)
or
=SUMIF(A2:A9, H1, F2:F9)
In the above formulas, sum_range is exactly of the same size as range, i.e. 1 column and 8
rows, and therefore they return the correct result:

If you'd rather do without a helper column, then you can write a separate SUMIF formula for
each of the columns you want to sum, and then add the returned numbers using the SUM
function:
=SUM(SUMIF(A2:A9,I1,C2:C9), SUMIF(A2:A9,I1,D2:D9), SUMIF(A2:A9,I1,E2:E9))
Another way is using a more complex array formula (don't forget to press Ctrl + Shift + Enter):
{=SUM((C2:C9+D2:D9+E2:E9)*(--(A2:A9=I1)))}
Both of the above formulas will return 2070 in our case.

FAQ or "Why my SUMIF formula is not working?"


There could be several reasons why Excel SUMIF is not working for you. Sometimes, your
formula does not return what you expect only because the data type in a cell or in some
argument isn't suited for the SUMIF function. So, here is a list of things to check.
1. The range and sum_range parameters should be ranges, not arrays.
The first (range) and third (sum_range) parameters of your SUMIF formula must always be a
range reference like A1:A10. If you try to pass in anything else, for example an array like {1,2,3},
Excel with throw an error message.
Correct formula: =SUMIF(A1:A3, "flower", C1:C3)
Wrong formula: =SUMIF({1,2,3}, "flower", C1:C3)
2. How to sum values from other sheets or workbooks.
As almost any other Excel function, SUMIF can reference other sheets and workbooks,
provided they are currently open.
For example, the following formula will sum the values in cells F2:F9 in Sheet 1 of Book 1 if a
corresponding cell in column A if the same sheet contains "apples":
=SUMIF([Book1.xlsx]Sheet1!$A$2:$A$9,"apples",[Book1.xlsx]Sheet1!$F$2:$F$9)
However, this formula won't work as soon as Book 1 is closed. This happens because the
ranges referenced by SUMIF formulas in closed workbooks get de-referenced into arrays, and
since no arrays are allowed in the range and sum_range arguments, a SUMIF formula will throw
a #VALUE! error.
3. To avoid problems, make sure range and sum_range are of the same size.
As noted in the beginning of this tutorial, in modern versions of Microsoft Excel, the range and
sum_range parameters does not have to be equally sized. In Excel 2000 and older, unequally
sized range and sum_range can cause problems. However, even in the most recent versions of
Excel 2010 and 2013, complex SUMIF formulas where sum_range has less rows and/or
columns than range are capricious. That is why it's considered a good practice to always have
the range and sum_range arguments of the same size and shape.
4. How to make your SUMIF formulas work faster.
If you've populated your workbook with complex SUMIF formulas that slow down your Excel,
check out this article and learn how to make them work faster. The article was written quite long
ago, so don't be surprised by the calculation time. Their recommended approaches and formula
examples are still actual and brilliant!

The Excel SUMIF examples described in this tutorial only touch on some of the basic usages of
this function. In the next article, we'll investigate advanced formulas that harness the real power
of SUMIF and SUMIFS and let you sum by multiple criteria. Please stay tuned and thank you for
reading!

Convert text-formatted digits to number using Excel VALUE function and other options
In this article, I'll show you how to convert text digits to number using several options in Excel
2010-2013. You'll see how to make Excel treat digits as numbers with the help of the VALUE
function, error checking, Paste Special and applying the number format. Those who want to
automate the task will find a helpful VBA macro and a special add-in.
In my previous article, I described how to convert number to text. Today I'll show you this
process reversed. You may have at least three reasons to convert text-formatted numbers in
Excel.

To make such functions as LOOKUP, VLOOKUP and MATCH work correctly.


To perform math operations like counting, summing, etc.
Apply a custom number format.
Unwanted formatting of numbers may occur if you imported data into Excel from an external
source, or if you created a file in a different program (dBASE or Lotus 1-2-3). Most of the time
Excel would recognize numbers in such cases as text.
If text-formatted numbers prevent from the further work with your data, you can convert them
back to number format using the Excel VALUE function, the standard Format Numbers option,
Paste Special window or Numbers Stored as Text error indicator. If you need to convert string to
number in Excel on a regular basis, have a look at the parts where I write about a special VBA
macro and the Cell Cleaner add-in.

Tip. In case you want to translate words to digits, like "seven" to 7, please see English words
into numbers on our Blogs.
Use Error Checking to convert text-formatted numbers
Apply a number format to digits stored as text
Use the Paste special functionality to convert text to number in Excel
Turn text to number using the Excel VALUE function
Grab a VBA macro to convert text to numbers
Cell Cleaner - turn numbers stored as text to numbers
Use Error Checking to convert text-formatted numbers
Have you ever noticed small green triangles in the upper-left corner of cells containing
numbers? These error indicators may appear if you import numeric data into Excel from an
external source, or if you enter numbers into cells formatted as text. These green triangles tell

you that the number is stored as text.

Below you'll find the steps helping to get rid of these Number Formatted as Text errors.
1. Select any cell in your table that contains a green error indicator in the upper-left corner.

Tip. You can use one of the following keyboard shortcuts to select a range.
Ctrl + A - selects the entire contiguous range.
Ctrl + A Twice - picks the entire sheet.
Ctrl + Space Bar - highlights the entire column.
Shift + Left/Right Arrow - selects multiple columns.
Shift + Space Bar - picks the entire row.
Shift + Up/Down Arrow - selects multiple rows.
2. Click on the error button with the Exclamation mark next to the selected cell or range.

3. You will see a drop-down menu. Just select the option Convert to Number.

Tip. If you just want to get rid of the green triangle in the upper-left corner of cells without
turning text to number, select the Ignore Error option.

All the digits stored as text will convert back to number format and the content will be aligned to
the right. As soon as they become regular numbers, you can choose to apply or customize
number format.
Apply a number format to digits that are stored as text
Before selecting the correct number format, please make sure the cells with the values you want
to convert don't contain any leading or trailing spaces. You can use the Trim function to remove
them.
1. Select the text-formatted numbers you want to convert to number format in your table.
2. Navigate to the Home tab -> Number group.

3. Select the necessary format from the Number Format drop-down list.

4. To get the extended set of the number formatting options, click on the Dialog Box
Launcher next to Number.

5. You will see the Format Cells window. Select the necessary category in the list under
the Numbertab to see all possible customizations.

Use the Paste special functionality to convert text to number in Excel


This option is rather for the numbers formatted General. As with the previous option, please
make sure the cells to process don't have any extra spaces. In this part you will find out how to
convert numbers to the number format using the Excel Paste Special dialog.
1. Select the range with the cells you want to convert to number format and make sure their
format is General.
2. Press Ctrl + C shortcut.
3. Press Ctrl + Alt + V on your keyboard to display the Paste Special dialog box.

4. Click on the Add radio button in the Operation section and press Ok.

You will see the cells alignment change to the right, which means now your numerical values
are treated as numbers.
Turn text to number using the Excel VALUE function
Using the VALUE function in Excel is the best option to convert text to number if you need to
process the data further or if there are excess leading and trailing spaces that need to be
removed. For a better result, you can process the cell contents using the clean and text function
that will delete non-printing characters and extra spaces correspondingly. Here is the function
you can copy across: =value(trim(clean(A2)))
The Excel VALUE Function converts a text string into number. The syntax is: VALUE( text ).
Here text is a text string that can be translated into a number.
Note. If text is not formatted as constant number, date, or time the function returns
the #VALUE! error.
1. Create a helper column and click on its first cell.

2. In the Formula bar enter =value(range address). In my example the range address is
A1:A10.

3. Copy the formula across the helper column using the fill handle to see the alignment
automatically change to the right and the green error indicators disappear.

Grab a VBA macro to convert text to numbers


If you need to convert text to number really often, it's better to automate this task. In the
articleDo you hate the numbers stored as text error?, you will find a beautiful piece of code that
will help you convert text to number format in a flash. This VBA macro will trim the string; handle
dates well and change case if necessary.

Cell Cleaner - turn numbers stored as text to numbers


In this part I'd like to introduce you the quickest and the easiest solution. Cell Cleaner add-in for
Excel 2003-2013 will convert text to number is a flash. All you need is to install it and click its
icon every time you need to translate text to numbers.
1. Download and install the fully functional trial version of Cell Cleaner.
2. Select the necessary range and click on the Convert Text icon under the Ablebits Data tab.

3. Press the Convert numbers stored as text to numbers radio button and click Convert.
Using this feature will not only format your numbers correctly, but it will remove spaces and
apostrophes.

Besides converting text to numbers this helpful tool can trim extra spaces, change case in
Excel, replace or remove unwanted characters and much more. You can visit the Cell Cleaner
webpage to explore all its possibilities.
Hope this article helped you choose the best solution for converting text to number format in
Excel. Stay tuned for more helpful articles about Excel and feel free to leave your questions in
the comments below. Be happy and excel in Excel!

How to convert numbers to text using Excel TEXT function and other options
This tutorial shows how to convert number to text in Excel 2010-2013. See how to accomplish
the task with the Excel TEXT function and use number to string to specify the formatting. Learn
how to change number format to text with the Format Cells and Text to Columns options.
If you use Excel spreadsheets to store long and not so long numbers, one day you may need to
convert them to text. There may be different reasons to change digits stored as numbers to text.
Below you'll find why you may need to make Excel see the entered digits as text, not as
number.

Search by part not by the entire number. For example, you may need to find all numbers
that contain 50, like in 501, 1500, 1950, etc.)
It may be necessary to match two cells using the VLOOKUP or MATCH function.
However, if these cells are formatted differently, Excel will not see identical values as matching.
For instance, A1 is formatted as text and B1 is number with format 0. The leading zero in B2 is a
custom format. When matching these 2 cells Excel will ignore the leading 0 and will not show
the two cells as identical. That's why their format should be unified.

The same issue can occur if the cells are formatted as ZIP code, SSN, telephone number,
currency, etc.
Note. If you want to convert numbers to words like amount to text, it's a different task. Please
check the article about spelling numbers named Two best ways to convert numbers to words in
Excel.
In this article I'll show you how to convert numbers to text with the help of the Excel TEXT
function. If you are not so formula-oriented, have a look at the part where I explain how to
change digits to text format with the help of the standard Excel Format Cells window, by adding
an apostrophe and employing the Text to Columns wizard.

Convert number to text using the Excel TEXT function


Use the Format Cells option to convert number to text in Excel
Add an apostrophe to change number to text format
Convert numbers to text in Excel with Text to Columns wizard
Convert number to text using the Excel TEXT function
The most powerful and flexible way to convert numbers to text is using the TEXT function. It
turns a numeric value into text and allows to specify the way this value will be displayed. It's
helpful when you need to show numbers in a more readable format, or if you want to join digits

with text or symbols. The TEXT function converts a numeric value to formatted text, thus the
result cannot be calculated.
If you are familiar with using formulas in Excel, it will not be a problem for you to employ the
TEXT function.
1. Add a helper column next to the column with the numbers to format. In my example, it's
column D.
2. Enter the formula =TEXT(C2,"0") to the cell D2. In the formula, C2 is the address of the first
cell with the numbers to convert.
3. Copy the formula across the column using the fill handle.

4. You will see the alignment change to left in the helper column after applying the formula.

5. Now you need to convert formulas to values in the helper column. Start with selecting the
column.
6. Use Ctrl+C to copy. Then press the Ctrl+Alt+V shortcut to display the Paste Special dialog
box.

7. On the Paste Special dialog, select the Values radio button in the Paste group.

You will see a tiny triangle appear in the top-left corner of each cell in your helper column, which
means the entries are now text versions of the numbers in your main column.

Now you can either rename the helper column and delete the original one, or copy the results to
your main and remove the temporary column.
Note. The second parameter in the Excel TEXT function shows how the number will be
formatted before being converted. You may need to adjust this based on your numbers:
The result of =TEXT(123.25,"0") will be 123.
The result of =TEXT(123.25,"0.0") will be 123.3.
The result of =TEXT(123.25,"0.00") will be 123.25.

To keep the decimals only, use =TEXT(A2,"General").


Tip. Say you need to format a cash amount, but the format isn't available. For instance, you
cannot display a number as British Pounds () as you use the built-in formatting in the English
U.S. version of Excel. The TEXT function will help you convert this number to Pounds if you
enter it like this: =TEXT(A12,"#,###,###.##"). Just type the format to use in quotes -> insert
the symbol by holding down Alt and pressing 0163 on the numeric keypad -> type #,###.##
after the symbol to get commas to separate groups, and to use a period for the decimal point.
The result is text!
Use the Format Cells option to convert number to text in Excel
If you need to quickly change the number to string, do it with the Format Cells option.
1. Select the range with the numeric values you want to format as text.
2. Right click on them and pick the Format Cells option from the menu list.

Tip. You can display the Format Cells window by pressing the Ctrl+1 shortcut.

3. On the Format Cells window select Text under the Number tab and click OK.

You'll see the alignment change to left, so the format will change to text. This option is good if
you don't need to adjust the way your numbers will be formatted.
Add an apostrophe to change number to text format
If these are just 2 or 3 cells in Excel where you want to convert numbers to string, benefit from
adding an apostrophe before the number. This will instantly change the number format to text.

Just double-click in a cell and enter the apostrophe before the numeric value.

You will see a small triangle added in the corner of this cell. This is not the best way to convert
numbers to text in bulk, but it's the fastest one if you need to change just 2 or 3 cells.
Convert numbers to text in Excel with Text to Columns wizard
You may be surprised but the Excel Text to Columns option is quite good at converting numbers
to text. Just follow the steps below to see how it works.
1. Select the column where you want to convert numbers to string in Excel.
2. Navigate to the Data tab in and click on the Text to Columns icon.

3. Just click through steps 1 and 2. On the third step of the wizard, make sure you select
the Textradio button.

4. Press Finish to see your numbers immediately turn into text.


I hope the tips and tricks from this article will help you in your work with numeric values in Excel.
Convert number to string using the Excel TEXT function to adjust the way your numbers will be
displayed, or use Format Cells and Text to Columns for quick conversions in bulk. If these are
just several cells, add an apostrophe. Feel free to leave your comments if you have anything to
add or ask. Be happy and excel in Excel!

Making a cascading (dependent) Excel drop down list


Last week we started to explore the capabilities of Excel Data Validation and learned how
tocreate a simple drop-down list in Excel based on a comma-separated list, range of cells or a
named range.
Today, we are going to investigate this feature in-depth and learn how to create cascading drop
down lists that display choices depending on the value selected in a previous dropdown.

Creating a simple Excel dependent dropdown list


Cascading drop-down lists with multi-word entries
Block changes in the primary drop-down list
Make a dynamic depending drop-down list
How to create a simple cascading dropdown in Excel
Making simple dependent drop-down lists in Excel is easy. All you need is a few named ranges
and the INDIRECT formula. This method works with all versions of Excel 2007, 2010 and 2013.
1. Type the entries for the drop-down lists.
First off, type the entries you want to appear in the drop-down lists, each list in a separate
column. For example, I'm creating a cascading dropdown of fruit exporters and column A of my
source sheet (Fruit) includes the items of the first dropdown and 3 other columns list the items
for the dependent dropdowns.

2. Create named ranges.


Now you need to create names for your main list and for each of the dependent lists. You can
do this either by adding a new name in the Name Manager window (Formulas tab > Name

Manager > New) or typing the name directly in the Name Box.

Note. Please pay attention that if your first row is sort of column header like you see in the
screenshot above, you shall not include it in the named range.
For the detailed step-by-step instructions please see Creating a named range.
Things to remember:
1.

The items to appear in the first drop-down list must be one-word entries,
e.g. Apricot, Mango,Oranges. If you have items consisting of two, three or more words,
please see How to create a cascading dropdown with multi-word entries.
2.
The names of the dependent lists must be exactly the same as the matching entry in
main list. For example, the dependent list to be displayed when "Mango" is selected from the
first drop-down list should be named Mango.

When done, you may want to press Ctrl+F3 to open the Name Manager window and check if all
of the lists have correct names and references.

3. Make the first (main) drop-down list.


1. In the same or in another spreadsheet, select a cell or several cells in which you want your
primary drop-down list to appear.
2. Go to the Data tab, click Data Validation and set up a drop-down list based on a named
range in the usual way by selecting List under Allow and entering the range name in

the Source box.

For the detailed steps, please see Making a drop down list based on a named range.
As the result, you will have a drop-down menu in your worksheet similar to this:

4. Create the dependent drop-down list.


Select a cell(s) for your dependent drop-down menu and apply Excel Data Validation again as
described in the previous step. But this time, instead of the range's name, you enter the
following formula in the Source field:
=INDIRECT(A2)

Where A2 is the cell with your first (primary) drop-down list.

If cell A2 is currently empty, you will get the error message "The Source currently evaluates to
an error. Do you want to continue?"
Safely click Yes, and as soon as you select an item from the first drop-down menu, you will see
the entries corresponding to it in the second, dependent, drop-down list.

5. Add a third dependent drop-down list (optional)


If needed, you could add a 3rd cascading drop-down list that depends either on the selection in
the 2nd drop-down menu or on the selections in the first two dropdowns.

Set up a 3rd dropdown that depends on the 2nd list


You can make the drop-down list of this type in the same fashion as we've just made a second
dependent drop-down menu. Just remember the 2 important things discussed above, which are
essential for the correct work of your cascading drop-down lists.
For instance, if you want to display a list of regions in column C depending on which country is
selected in column B, you create a list of regions for each country and name it after the
country's name, exactly as the country appears in second dropdown lists. For instance, a list of
Indian regions should be named "India", a list of Chines regions - "China", and so on.
After that, you select a cell for the 3rd dropdown (C2 in our case) and apply Excel Data
Validation with the following formula (B2 is the cell with the second drop-down menu that
contains a list of countries):
=INDIRECT(B2)

Now, each time you select India under the list of countries in column B, you will have the
following choices in the third drop-down:

Note. The displayed list of regions is unique for each country but it does not depend on the
selection in the first drop-down list.
Create a third dropdown dependent on the first two lists
If you need to create a cascading drop down menu that depends on the selections both in the
first and second drop-down lists, then proceed in this way:
1. Create additional sets of named ranges, and name them for the word combinations in your
first two dropdowns. For example, you have Mango, Oranges, etc. in the 1st list and India,
Brazil, etc. in the 2nd. Then you create named
ranges MangoIndia, MangoBrazil, OrangesIndia, OrangesBrazil, etc. These names should not

contain underscores or any other additional characters.

2. Apply Excel Data Validation with the INDIRECT / SUBSTITUTE formula that concatenates the
names of the entries in the first two columns, and removes the spaces from the names. For
example, in cell C2, the data validation formula would be:
=INDIRECT(SUBSTITUTE(A2&B2," ",""))
Where A2 and B2 contain the first and second dropdowns, respectively.

As the result, your 3rd drop-down list will display the regions corresponding to
the Fruit andCountry selected in the first 2 drop-down lists.

This is the easiest way to create cascading drop-down boxes in Excel. However, this method
has a number of limitations.
Limitations of this approach:
1. The items in your primary drop-down list must be one-word entries. See how to
createcascading drop-down lists with multi-word entries.
2. This method won't work if the entries in your main drop-down list contain characters not
allowed in range names, such as the hyphen (-), ampersand (&), etc. The solution is to create
adynamic cascading dropdown that does not have this restriction.
3. Drop-down menus created in this way are not updated automatically i.e. you will have to
change the named ranges' references every time you add or remove items in the source lists.
To get over this limitation, try making a dynamic cascading drop down list.
How to create cascading drop-down lists with multi-word entries
The INDIRECT formulas like we used in the example above can handle one-word items only.
For example, the formula =INDIRECT(A2) indirectly references cell A2 and displays the named
range exactly with the same name as is in the referenced cell. However, spaces are not allowed
in Excel names, which is why this formula won't work with multi-word names.
The solution is to use the INDIRECT function in combination with SUBSTITUTE like we did
when creating a 3rd dropdown.
Suppose you have Water melon among the products. In this case, you name a list of water
melon exporters with one word without spaces - Watermelon.
Then, for the second dropdown, apply Excel Data Validation with the following formula that
removes the spaces from the name in cell A2:

=INDIRECT(SUBSTITUTE(A2," ",""))

How to prevent changes in the primary drop down list


Imagine the following scenario. Your user has made the selections in all of the drop-down lists,
then they changed their mind, went back to the first list, and chose another item. As the result,
the 1st and 2nd selections are mismatched. To prevent this from happening, you may want to
block any changes in the first drop-down list as soon as a selection is made in the second list.
To do this, when creating the first dropdown, use a special formula that will check whether any
entry is selected in the second drop down menu:
=IF(B2="", Fruit, INDIRECT("FakeList"))

Where B2 contains the second dropdown, "Fruit" is the name of the list that appears in the first
drop-down menu, and "FakeList" is any fake name that does not exist.

Now, if any item is selected in the 2nd drop-down list, no choices will be available when the user
clicks on the arrow next to the first list.
Creating dynamic cascading drop-down lists in Excel
The main advantage of a dynamic Excel dependent drop-down list is that you are free to edit the
source lists and your drop-down boxes will get updated on the fly. Of course, creating dynamic
dropdowns requires a bit more time and more complex formulas, but I believe this is a worthy
investment because once set up, such drop-down menus are real pleasure to work with.
As with almost anything in Excel, you can achieve the same result in several ways. In particular,
you can create a dynamic dropdown using a combination of OFFSET, INDIRECT and COUNTA
functions or a more resilient INDEX / MATCH. The latter is my preferred way because it
provides numerous advantages, the most essential of which are:
1.
2.
3.
4.
5.

You have to create 3 named ranges only, no matter how many items there are in the
main and dependent lists.
Your lists may contain multi-word items and any special chars.
The number of entries can vary in each column.
The entries' sort order does not matter.
Finally, it's very easy to maintain and modify the source lists.

Okay, enough theory, let's get into practice.

1. Organize your source data in a table.


As usual, the first thing for you to do is to write down all the choices for your drop-down lists in a
worksheet. This time, you will have to employ Excel tables to store the source data.
Let me remind you that tables were introduced in Excel 2007, so you can use this method in all
modern versions of Excel 2013, 2010 and 2007.
Once you have entered the data, select all of the entries and click Insert tab > Table. Then
switch to the Design tab and type a name of your table in the Table Name box.
The most convenient and visual approach is to store the items for the first drop-down as table
headers, and the items for the dependent dropdown as table data. The screenshot below
illustrates the structure of my table, named exporters_tbl - the fruit names are table headers and
a list of exporting countries is added under the corresponding fruit name.

2. Create Excel names.


Now that your source data is ready, it's time to set up named references that will dynamically
retrieve the correct list from your table.
2.1. Add a name for the table's header row (main dropdown)
To create a new name that references the table header, select it and then either
click Formulas >Name Manager > New or press Ctrl + F3.

Microsoft Excel will use the built-in table reference system to create the name of
thetable_name[#Headers] pattern.

Give it some meaningful and easy to remember name, e.g. fruit_list, and click OK.
2.2. Create a name for the cell containing the first drop-down list.
I know that you don't have any dropdown yet :) But you have to choose the cell to host your first
dropdown and create a name for that cell now because you will need to include this name in the
third name's reference.
For example, my first drop-down box is reside in cell B1 on Sheet 2, so I create a name for it,
something simple and self-explanatory like fruit:

2.3. Create a name to retrieve the dependent menu's entries.


Instead of setting up unique names for each of the dependent lists like we did in the previous
example, we are going to create one named formula that is not assigned to any particular cell
or a range of cells. It will retrieve the correct list of entries for the second dropdown depending
on which selection is made in the first drop-down list. The main benefit of using this formula is
that you won't have to create new names as you add new entries to the first drop-down list - one
named formula covers them all.
You create a new Excel name in the usual way (Formulas > Name Manager > New) with this
formula:
=INDEX(exporters_tbl,,MATCH(fruit,fruit_list,0))
Where:

exporters_tbl - the name of the table (created in step 1);


fruit - the name of the cell containing the first drop-down list (created in step 2.2);
fruit_list - the name referencing the table's header row (created in step 2.1).
I gave it a name exporters_list, as you see in the screenshot below.

If you are curious to learn the Index and Match functions in-depth, check out this tutorial: INDEX
& MATCH - a better alternative to VLOOKUP.

Well, you have already done the major part of the work! Before getting to the final step, it may
be a good idea to open the Name Manager (Ctrl + F3) and verify the names and references:

3. Set up Excel Data Validation


This is actually the easiest part. With the two named formulas in place, you set up Data
Validation in the usual way (Data tab > Data validation).

For the first drop-down list, in the Source box, enter =fruit_list (the name created in step
2.1).

For the dependent drop-down list, enter =exporters_list (the name created in step 2.3).

Done! Your dynamic cascading drop-down menu is accomplished and will update automatically
reflecting the changes you've made to the source table.

This dynamic Excel dropdown, perfect in all other respects, has one shortcoming - if the
columns of your source table contain a different number of items, the blank rows will appear in

your menu like this:

Exclude blank rows from the dynamic cascading dropdown


If you want to clean any blank lines in your drop-down boxes, you will have to take a step further
and improve the INDEX / MATCH formula used to create the dependent dynamic drop-down list.
The idea is to use 2 INDEX functions, where the first gets the upper-left cell and the second
returns the lower-right cell of the range, or the OFFSET function with nested INDEX and
COUNTA. The detailed steps follow below:
1. Create two additional names.
Not to make the formula too bulky, create a couple of helper names with the following simple
formulas first:

A name called col_num to reference the selected column


number: =MATCH(fruit,fruit_list,0)
A name called entire_col to reference the selected column (not the column's number,
but the entire column): =INDEX(exporters_tbl,,col_num)
In the above formulas, exporters_tbl is your source table's name, fruit is the name of the
cell containing the first dropdown, and fruit_list is the name referencing the table's header
row.
2. Create the named reference for the dependent dropdown.
Next, utilize either of the below formulas to create a new name (let's call it exporters_list2) to be
used with the dependent drop-down list:
=INDEX(exporters_tbl,1,col_num) : INDEX(exporters_tbl,
COUNTA(entire_col), col_num)
=OFFSET(INDEX(exporters_tbl,1,col_num),0,0,COUNTA(entire_col))

3. Apply Data Validation.


Finally, select the cell containing the dependent dropdown and apply Data Validation by entering
=exporters_list2 (the name created in the previous step)in the Source box.
The screenshot below shows the resulting dynamic drop-down menu in Excel where all blank
lines are gone!

Note. When working with dynamic cascading drop down lists created with the above formulas,
nothing prevents the user from changing the value in the first dropdown after making the
selection in the second menu, as a result, the choices in the primary and secondary dropdowns
may mismatch. You can block changes in the first box after a selection is made in the second
one by using either VBA or complex formulas suggested in this tutorial.
This is how you create dynamic cascading drop-down lists in Excel. Feel free to download the
sample workbooks and see it in action:

Download Cascading Dropdown Sample 1 - easy version


Download Cascading Dropdown Sample 2 - advanced version without blanks
If you have any questions, you are most welcome to post a comment. Thank you for reading!

Creating a drop down list in Excel: static, dynamic, from another workbook
The tutorial demonstrates 4 quick ways to create an Excel drop down list - based on a list of
values, range of cells, named range and a dynamic dropdown. It also shows how to create a
dropdown from another workbook, edit and delete Data Validation lists.
Excel drop-down list, aka drop down box or combo box, is used to enter data in a spreadsheet
from a pre-defined items list. The main purpose of using drop down lists in Excel is to limit the
number of choices available for the user. Apart from that, a dropdown prevents spelling
mistakes and makes data input faster.

o
o

How to create a drop-down list in Excel


Make a drop-down list from another workbook
How to fix Excel Data Validation not working
Additional options for the Excel drop-down box
Display a message when a cell with the dropdown is clicked
Allow entering other data in a combo box
How to edit an Excel drop down list
How to delete a drop-down box
How to create an Excel drop-down list
On the whole, there are 4 ways to make a drop down menu in Excel, and all of them have their
own strong and weak points. Below you will find a quick outline of the main advantages and
drawbacks as well as the detailed step-by-step instructions for each method:

Drop-down box based on a list of values


Drop down box based on a named range
Drop down list based on a range of cells
Create a dynamic dropdown in Excel
Creating drop down lists with comma-separated values
This is the fastest 3-step way to create a drop-down box in all versions of Excel 2013, 2010,
2007 and 2003.

1. Select a cell or range for your drop-down list.


You start by selecting a cell or cells where you want a drop-down box to appear. This can be a
single cell, a range of cells or the entire column. If you select the whole column, a drop down
menu will be created in each cell of that column, which is a real time-saver, for example, when
you are creating a questionnaire.

You can even select non-contiguous cells by pressing and holding the Ctrl key while selecting
the cells with the mouse.

2. Use Excel Data Validation to create a drop-down list.


On the Excel ribbon, go to the Data tab > Data Tools group and click Data Validation.

3. Enter the list items and choose the options.


In the Data Validation window, on the Settings tab, do the following:

In the Allow box, select List.


In the Source box, type the items you want to appear in your drop-down menu separated
by a comma (with or without spaces).
Make sure the In-cell dropdown box is checked.
Optionally, select Ignore blanks if you want to allow your users to leave the cell empty.
Click OK and you are done!

Now, Excel users simply click an arrow next to a cell containing a dropdown box, and then
select the entry they want from the drop down menu.

Well, your drop-down box is ready in under a minute. However, this is not the best way to create
an Excel drop-down list, especially if you want the same list to appear in multiple cells, and
here's why...
If you want to edit your Excel drop down list at some point in the future, you would have
tochange every cell that references the Data Validation list. This may not be a big deal if you
have just a few such cells residing on the same sheet, but if you have dozens or hundreds
scattered across different worksheets, it may take quite a while to locate and edit them all.
Anyway, if you decide to stick with this easiest approach, see the detailed guidance on how
to edit a comma-separated drop-down list.

Creating an Excel drop-down list based on a named range


This method of creating a drop down list in Excel takes a bit more time, but it may save even
more time in the long run.
1. Type the entries for your drop-down list.
Select the entries you want to appear in your drop-down menu in an existing worksheet or type
the entries in a new sheet. These values should be entered in a single column or row without
any blank cells.
For example, let's create a drop-down list of ingredients for your favorite recipes:

Tip. It's a good idea to sort your entries in the order you want them to appear in the drop-down
menu.
2. Create a named range.
You can actually skip this step and create your drop-down list based on a range of cells, but
named ranges really make managing Excel drop-down lists easier.

Select all the entries you want to include in the drop down list, right-click them, and
chooseDefine Name from the context menu. Alternatively, you can click Name Manager on
theFormulas tab or press Ctrl + F3.
In the Name Manager dialog, click New.
In the Name field, type a name for your entries, make sure the correct range is displayed
in theRefers to box, and then click OK. Be sure your range name doesn't have any spaces or
hyphens, use underscores (_) instead.

Tip. A faster way to create a named range in Excel is to select the cells and type the range
name directly in the Name Box. When finished, click Enter to save the newly created named
range.

Drop-down lists based on a table


Instead of a usual named range, you can consider converting your list to a fully functional Excel
table (Insert > Table) first, and then create a list name.
To do this, you either enter =your_table_name[column_name] in the Refers to field, or select all
of the cells without a column header before opening the Name Manager and have the Refers to

box filled automatically.

Why you may want to use a table? First and foremost, because it lets you create a dynamic
drop-down list and sets you free from the necessity toupdate the named range reference when
you remove or add new items to the source list.
3. Select the location for your drop-down list.
Simply click in the cell where you want to have the drop-down list. This can be in the same
sheet where your list of entries is located or in a different worksheet. You can also select a
range of cells, or the entire column.

Note. Excel 2003 and older require the dropdown list to be on the same worksheet.

4. Apply Excel Data Validation.


On the Excel ribbon, navigate to the Data tab and click Data Validation.

5. Configure your drop-down list.


In the Data Validation window, go to the Settings tab, and choose the following options:

In the Allow box, select List.


In the Source box, type the name you gave to your range preceded by an equal sign, for
example =Ingredients.
Make sure the In-cell dropdown box is checked.
Put a tick in the Ignore blanks box if your users are allowed to leave the cell empty.
And finally, click the OK button to finish creating your drop-down list.

If the source list contains more than 8 items, your drop-down box will have a scroll bar like this:

Making a drop down box based on a range of cells


Creation of an Excel drop-down box based on a range of cells is very similar to creating a dropdown list based on a named range with only 2 differences:
1. You skip Step 2 - creating a named range.
2. In step 5, when configuring your drop-down list, instead of typing the range's name, click on
the range selection icon
next to the Source box, and select all cells with the entries you
want to include in your drop-down list. They may be in the same or in a different worksheet. If

the latter, you simply go to the other sheet and select a range using a mouse.

Create a dynamic (automatically updated) Excel dropdown


If you often edit the items in the drop-down menu, you may want to create a dynamic drop down
list in Excel. In this case, your list will get updated automatically in all the cells that contain it,
once you remove or add new entries to the source list.
The easiest way to create such a dynamically updated drop-down list in Excel is by creating
anamed list based on a table. If for some reason you prefer a usual named range, then
reference it using the OFFSET formula, as explained below.
1. You start by creating a usual dropdown based on a named range as described above.
2. In step 2, when creating a name, you put the following formula in the Refers to box.
=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1)
Where:

Sheet1 - the sheet's name


A - the column where the items of your drop-down list are located
$A$1 - the cell containing the first item of the list
As you see, the formula is comprised of 2 Excel functions - OFFSET and COUNTA. The
COUNTA function counts all non-blanks in the specified column. OFFSET takes that number
and returns a reference to a range that includes only non-empty cells, starting from the first cell

you specify in the formula.

The main advantage of dynamic drop-down lists is that you won't have to change the reference
to the named range every time after editing the source list. You simply delete or type new
entries in the source list and all of the cells containing this Data Validation list will get updated
automatically!
The OFFSET function in detail
If you are curious to get the logic of the above formula, here you go.
In Microsoft Excel, the OFFSET function returns a reference to a range consisting of a specified
number of rows and columns. You can use it in various scenarios when you need to get a
dynamic, i.e. continuously changing, range.
The syntax of the OFFSET function is as follows:
OFFSET(reference, rows, cols, [height], [width])

reference - the first cell or a range of adjacent cells from which you want to base the
offset.

rows - the number of rows, up or down, that you want the upper-left cell of the returned
range to refer to.
cols - similar to rows, i.e. the number of columns, to the left or right, for the upper-left
cell of the returned range to refer to.
height, optional - the number of rows in the returned range.
width, optional - the number of columns in the returned range.

So, in our OFFSET formula =OFFSET(Sheet1!$A$1, 0, 0, COUNTA(Sheet1!$A:$A), 1), we


specify the following arguments:

reference - cell $A$1 in Sheet1, which is the first item of your drop-down list;
rows & cols are 0 because you don't want to shift the returned range either vertically or
horizontally;
height - the number of non-empty cells in column A, returned by the COUNTA function;
width - 1, i.e. one column.
Creating a drop-down list from another workbook
You can make a drop-down menu in Excel using a list from another workbook as the source. To
do this, you will have to create 2 named ranges - one in the source book and another in the
book where you wish to use the Data Validation list.
Note. For the drop-down list from another workbook to work, the workbook with the source list
must be open.
A static dropdown list from another workbook
The dropdown list created in this way won't update automatically when you add or remove
entries in the source list and you will have to modify the source list reference manually.
1. Create a named range for the source list.
Open the workbook that contains the source list, SourceBook.xlsx in this example, and create a
named range for the entries you want to include in your drop-down list, e.g. Source_list.

2. Create a named reference in the main workbook.


Open the workbook in which you want the drop down list to appear and create a name that
references your source list. In this example, the completed reference is=SourceBook.xlsx!

Source_list

Note. You have to enclose the workbook's name in apostrophes (') if it contains any spaces. For
example: ='Source Book.xlsx'!Source_list
3. Apply Data Validation
In the main workbook, select the cell(s) for your drop-down list, click Data > Data Validation and
enter the name you created in step 2 in the Source box.

A dynamic dropdown list from another workbook


A dropdown list created in this way will get updated on the fly once you've made any changes to
the source list.

1. Create a range name in the Source workbook with the OFFSET formula, as explained
in Creating a dynamic drop-down.
2. In the main workbook, apply Data Validation in the usual way.
Data Validation does not work
The Data Validation option is greyed out or disabled? There are a few reasons why that might
happen:

Drop-down lists can't be added to protected or shared worksheets. Remove the


protection or stop sharing the worksheet, and then try to click Data Validation again.
You are creating a drop down list from an Excel table that is linked to a SharePoint site.
Unlink the table or remove the table formatting, and try again.
Additional options for the Excel drop-down box
In most cases, the Settings tab's options we've discussed above absolutely suffice. If they don't,
two more options are available on the other tabs of the Data Validation dialog window.
Display a message when a cell with the dropdown is clicked
If you want to show your users a pop up message when they click any cell containing your dropdown list, proceed in this way:

In the Data Validation dialog (Data tab > Data Validation), switch to the Input
Message tab.
Make sure the option Show input message when cell is selected is checked.
Type a title and message in the corresponding fields (up to 225 characters).
Click the OK button to save the message and close the dialog.

The result in Excel will look similar to this:

Allow users to enter their own data in a combo box


By default, the drop-down list you create in Excel is non-editable, i.e. restricted to the values in
the list. However, you can allow your users to enter their own values in the box.
Technically, this turns a drop-down list into an Excel combo box. The term "combo box" means
an editable dropdown that allows users to either select a value from the list or type a value
directly in the box.
1. In the Data Validation dialog (Data tab > Data Validation), go to the Error Alert tab.
2. Select the "Show error alert after invalid data is entered" box if you want to show an alert
when a user attempts to enter some data in the combo box other than is in your drop-down
menu (this won't stop people from entering their own data). If you don't want a message to show
up, clear the check box.
3. If you've opted to display a warning message, pick one of the options from the Style box, and
type the title and message. Either Information or Warning will let the users enter their own text

in the combo box. The options differ only in the icon displayed along with the message and the
button selected by default.

An Information message is displayed with the "i" icon


and the selected OK button.
This option is recommended if your users will have to input their own choices quite often.
A Warning message is shown with the "!" icon
and the "No" button pre-selected. It is
considered a good practice to display a warning if you do prefer your users to select an item
from the drop-down box rather than enter their own data.
Stop will prevent people from entering any data that isn't in your Excel drop-down list.

And this is how your customized warning message may look like in Excel:

Tip. If you are not sure what title or message text to type, you can leave the fields empty. In this
case, Microsoft Excel will display the default alert "The value you entered is not valid. A user
has restricted values that can be entered into this cell."

How to edit an Excel drop down list


After you've created a drop-down list in Excel, you might want to add more entries to it or delete
some of the existing items. How you do this depends on how your drop down box was created.

Editing a comma separated drop-down list


Editing a drop-down menu based on a range of cells
Editing an Excel drop-down list based on a named range
Editing a comma separated drop-down list
If you've created a comma separated drop down box, proceed with the following steps:
1. Select a cell or cells that reference your Excel Data Validation list, i.e. cells containing a dropdown box that you want to edit.
2. Click Data Validation (Excel ribbon > Data tab).
3. Delete or type new items in the Source box.

4. Click OK to save the changes and close the Excel Data Validation window.

Editing a drop-down menu based on a range of cells


If you have created a drop-down box by specifying a range of cells rather than referencing a
named range, then proceed in the following way.
1. Head over to spreadsheet containing the items that appear in your drop-down box, and edit
the list in the way you want.
2. Select the cell or cells containing your drop-down list.
3. Click Data Validation on the Data tab.
4. In the Excel Data Validation window, on the Settings tab, change the cell references in the
Source box. You can either edit them manually or click the range selection icon.

5. Click the OK button to save the changes and close the window.

Tip. If you want to apply the changes to all the cells containing this drop-down list, select the
"Apply these changes to all other cells with the same settings" option.
Editing an Excel drop-down list based on a named range
If you have created a named range based drop-down box, then you can just edit your range's
items and then change the reference to the Named Range. All drop-down boxes based on this
named range will get updated automatically.

1. Add or delete items in the named range.


Open the worksheet containing your named range, delete or type new entries. Remember to
arrange the items in the order you want them to appear in your Excel drop-down list.
2. Change the reference to the Named Range.

On the Excel ribbon, go to the Formulas tab > Name Manager. Alternatively, press Ctrl +
F3 to open the Name Manager window.
In the Name Manager window, select the named range you want to update.
Change the reference in the Refers to box by clicking the range selection icon
and
selecting all the entries for your drop-down list.
Click the Close button, and then in the confirmation message that appears, click Yes to
save your changes.

Tip. To avoid the necessity to update the named range's references after each change of the
source list, you can create a dynamic Excel drop-down menu. In this case, your dropdown list
will get updated automatically in all associated cells as soon as you remove or add new entries
to the list.
How to delete a drop-down list
If you no longer want to have drop-down boxes in your Excel worksheet, you can remove them
from some or all cells.

Removing a drop-down menu from selected cell(s)


Deleting a drop-down list from all cells in the current sheet
Removing a drop-down menu from selected cell(s)
1. Select a cell or several cell from which you want to remove drop down boxes.
2. Go to the Data tab and click Data Validation.
3. On the Settings tab, select the Clear All button.

This method removes the drop-down menus from the selected cells, but keeps the currently
selected values.
If you want to delete both a dropdown and the cells' values, you can select the cells and click
theClear all button on the Home tab > Editing group > Clear.

Deleting an Excel drop-down list from all cells in the current sheet
In this way, you can remove a drop-down list from all associated cells in the current worksheet.
This won't delete the same drop-down box from cells in other worksheets, if any.
1. Select any cell containing your drop-down list.
2. Click Data Validation on the Data tab.
3. In the Data Validation window, on the Settings tab, select the "Apply these changes to all
other cells with the same settings" check box.
Once you check it, all of the cells referencing this Excel Data Validation list will get selected, as
you can see in the screenshot below.
4. Click the Clear All button to delete the drop-down list.
5. Click OK to save the changes and close the Data Validation window.

This method deletes a drop-down list from all the cells containing it, retaining the currently
selected values. If you created a dropdown based on a range of cells or based on a named
range, the source list will also remain intact. To remove it, open the worksheet containing the
drop-down list's items, and delete them.
Now you know the basics of Excel drop-down lists. In the next article, we will explorer this topic
further and I will show you how to create dependent drop down lists with conditional Data
Validation and how to create a drop-down box from another workbook. Please stay tuned and
thank you for reading!

Excel VLOOKUP not working - solutions for N/A, NAME and VALUE errors
The tutorial explains how you can quickly cope with VLOOKUP not working problems in Excel
2013, 2010, 2007 and 2003, troubleshoot and fix common errors and overcome VLOOKUP's
limitations.
In the last few articles, we have explored different aspects of the Excel VLOOKUP function. If
you have been following us closely, by now you should be an expert in this area : )
However, it's not without a reason that many Excel specialists consider VLOOKUP to be one of
the most intricate Excel functions. It has a ton of limitations and specificities, which are the
source of various problems and errors.

In this article, you will find simple explanations of


VLOOKUP's #N/A, #NAME and #VALUE error messages as well as solutions and fixes. We will
start with the most frequent cases and most obvious reasons why vlookup is not working, so it
might be a good idea to check out the below troubleshooting steps in order.

Troubleshooting VLOOKUP #N/A error


Fixing #VALUE error in VLOOKUP formulas
VLOOKUP #NAME error
VLOOKUP not working (problems, limitations and solutions)
Using Excel VLOOKUP with IFERROR / ISERROR
Fixing VLOOKUP N/A error in Excel
In Vlookup formulas, the #N/A error message (meaning "not available") is displayed when Excel
cannot find a lookup value. There can be several reasons why that may happen.

1. A typo or misprint in the lookup value


It's always a good idea to check the most obvious thing first : ) Misprints frequently occur when
you are working with really large data sets consisting of thousands of rows, or when a lookup
value is typed directly in the formula.
2. #N/A in approximate match VLOOKUP
If you are using a formula with approximate match (range_lookup argument set to TRUE or
omitted), your Vlookup formula might return the #N/A error in two cases:

If the lookup value is smaller than the smallest value in the lookup array.
If the lookup column is not sorted in ascending order.
3. #N/A in exact match VLOOKUP
If you are searching with exact match (range_lookup argument set to FALSE) and the exact
value is not found, the #N/A error is also returned. See more details on how to properly
use exact and approximate match VLOOKUP formulas.
4. The lookup column is not the leftmost column of the table array
As you probably know, one of the most significant limitations of Excel VLOOKUP is that it
cannot look to its left, consequently your lookup column should always be the left-most column
in the table array. In practice, we often forget about this and end up with VLOOKUP not
working because of the N/A error.

Solution: If it is not possible to restructure your data so that the lookup column is the left-most
column, you can use a combination of Excel's INDEX and MATCH functions, as a more versatile
alternative to VLOOKUP. You will find the detailed info and a formula example in this tutorial
-INDEX / MATCH formula to lookup values to left.
5. Numbers are formatted as text
Another source N/A errors in VLOOKUP formulas is numbers being formatted as text, either in
the main or lookup table.
This usually occurs when you import data from some external database or if you've typed an
apostrophe before a number to indicate a leading zero.
The most obvious indications of numbers being formatted as text are shown in the screenshot
below.

The numbers can also be stored in the General format. In this case, there's only one noticeable
sign - numbers get aligned to the left side of a cell, while numbers stored as numbers are
aligned to the right by default.

Solution: If this is just a single number, simply click on the error icon and choose "Convert To
Number" from the context menu.

If multiple numbers are affected, select them all, right-click the selection, then choose Format
Cells> Number tab > Number and click OK.
6. Excess leading or trailing spaces
This is the least obvious cause of the Vlookup N/A error because a human eye can hardly spot
those extra spaces, especially when working with big tables where most of the entries are below
the scroll.
Solution 1: Extra spaces are in the main table (with VLOOKUP formulas)
If excess spaces occur in your main table, you can ensure the correct work of your Vlookup
formulas by wrapping the lookup_value argument with the TRIM function:
=VLOOKUP(TRIM($F2),$A$2:$C$10,3,FALSE)

Solution 2: Extra spaces are in the lookup table (lookup column)

If extra spaces occur in the lookup column, there is no easy way to avoid VLOOKUP #N/A
errors. Instead of VLOOKUP, you can use an array formula with a combination of INDEX /
MATCH and TRIM functions:
=INDEX($C$2:$C$10,MATCH(TRUE,TRIM($A$2:$A$10)=TRIM($F$2),0))
Since this is an array formula, don't forget to press Ctrl + Shift + Enter rather than a usual Enter
keystroke to properly complete it:

For more information about using INDEX / MATCH in Excel, please check out this
tutorial: INDEX & MATCH in Excel - a better alternative to VLOOKUP.
Tip. A quick alternative to complex INDEX / MATCH formulas is running the Trim Spaces for
Excel add-in that will eliminate excess spaces both in the lookup and main tables in seconds,
making your VLOOKUP formulas error-free. This is a free tool and you can find the download
link on the above page.
#VALUE error in VLOOKUP formulas
In general, Microsoft Excel displays the #VALUE! error if a value used in the formula is of a
wrong data type. In respect to VLOOKUP, there are two common sources of the VALUE! error.
1. Lookup value exceeds 255 characters
Please be aware that the VLOOKUP function cannot look up values containing 256 characters
or more. If your lookup values exceed this limit, you will end up having the VALUE error:

Solution: Use an analogous INDEX /MATCH formula instead. In the above example, the
following INDEX / MATCH function works perfectly:
=INDEX(C2:C7,MATCH(TRUE,INDEX(B2:B7= F$2,0),0))

You can learn more about using INDEX / MATCH in Excel in this tutorial.
2. Full path to the lookup workbook is not supplied
If you are pulling data from another workbook, you have to include the full path to that file. More
precisely, you have to enclose the workbook's name (including the extension) in square
brackets [], and then specify the sheet's name followed by the exclamation mark. Also, you
should have apostrophes around all this in case either a workbook or spreadsheet name
contains spaces.
Here's the structure of the complete formula to do a vlookup from another workbook:
=VLOOKUP(lookup_value, '[workbook name]sheet name'!table_array,
col_index_num, FALSE)
A real formula might look similar to this:

=VLOOKUP($A$2,'[New Prices.xls]Sheet1'!$B:$D,3,FALSE)
The above formula will search for the value of cell A2 in column B of Sheet1 in the "New Prices"
workbook, and return a matching value from column D.
If any element of the path is missing, your VLOOKUP formula won't work and return the
#VALUE error (unless the lookup workbook is currently open).
For more info about VLOOKUP formulas referencing another Excel file, please check out this
tutorial: How to do vlookup from a different workbook.
3. The col_index_num argument is less than 1
It's hard to imagine a situation when someone would want to enter a number less than "1" to
specify the column to return values from. Though, it may happen if this argument is returned by
some other Excel function nested in your Vlookup formula.
So, if the col_index_num argument happens to be less than 1, your Vlookup formula will return
the #VALUE! error too.
If the col_index_num argument is greater than the number of the columns in the specified table
array, Vlookup formulas return the #REF! error.
VLOOKUP #NAME error
This is the easiest case - the NAME error appears if you've accidentally misspelled the
function's name.
The solution is obvious - check the spelling : )
Excel VLOOKUP not working (limitations, issues and solutions)
Apart from having a fairly complicated syntax, VLOOKUP has arguably more limitations than
any other Excel function. Because of these limitations, seemingly correct Vlookup formulas
might often deliver results different from what you expect. Below you will find solutions for a few
common scenarios when VLOOKUP fails.
1. VLOOKUP is case-insensitive
The VLOOKUP function does not distinguish case and teats lowercase and UPPERCASE
characters as identical. So, if your table includes several similar entries that differ in the
uppercase or lowercase chars only, the Vlookup formula will return the first found value
regardless of the case.
Solution: Use another Excel function that can do a vertical lookup (LOOKUP, SUMPRODUCT,
INDEX / MATCH) in combination with the EXACT function that can match case. You can find the

detailed explanations and formula examples in this tutorial - 4 ways to do a case-sensitive


vlookup in Excel.
2. VLOOKUP returns the first found value
As you already know, Excel VLOOKUP returns the first value it finds in the return column that
matches the lookup value. However, you can force it to bring the 2nd, 3rd, 4th or any other
occurrence you want. If you need to get all duplicate occurrences, you will have to use a
combination of the INDEX, SMALL and ROW functions.
Solutions: Formula examples are available for download here:

Get 2nd, 3rd , 4th, etc. occurrence


Get all duplicate occurrences of the lookup value
3. A new column was inserted or removed from the table
Regrettably, VLOOKUP formulas stop working every time when a new column is deleted from or
added to a lookup table. This happens because the syntax of the VLOOKUP function requires
that you supply the entire table array as well as a certain number indicating which column you
want to return the data from. Naturally, both the table array and the return column's number
change when you remove an existing column or insert a new one.
Solution: INDEX / MATCH comes to the rescue again : ) In INDEX & MATCH formulas, you
specify the lookup and return columns separately, and as a result you can delete or insert as
many columns as you want without worrying about updating every associated vlookup formula.
4. Cell references got mangled when copying the formula
The heading above gives an exhaustive explanation of the root of the problem, right?
Solution: Always use absolute cell references (with the $ sign) in table arrays, e.g.
$A$2:$C$100 or $A:$C. In the formula bar, you can quickly switch between different reference
types by pressing F4.
VLOOKUP with IFERROR / ISERROR
If you do not want to intimidate your users with all those N/A, VALUE or NAME error messages,
you can return a blank cell instead, or display your own message. You can do this by wrapping
your VLOOKUP formula in the IFERROR function in Excel 2013, 2010 and 2007 or with IF /
ISERROR in earlier Excel versions.
Using VLOOKUP with IFERROR
The syntax of the IFERROR function is simple and self-explanatory : )
IFERROR(value,value_if_error)

Meaning, you enter the value to check for an error in the 1st argument, and in the 2nd argument
you specify what to return if an error occurs.
For example, the following IFERROR / VLOOKUP formula returns a blank cell when the lookup
value is not found:
=IFERROR(VLOOKUP($F$2,$B$2:$C$10,2,FALSE),"")

If you'd rather display your own message instead of a standard Vlookup error, type it between
the quotation marks, like this:
=IFERROR(VLOOKUP($F$2,$B$2:$C$10,2,FALSE),"Oops, no match is found.
Please try again!")

Using VLOOKUP with ISERROR


Since the IFERROR function was introduced in Excel 2007 only, in lower Excel versions you will
have to use the combination of IF and ISERROR functions in this way:

=IF(ISERROR(VLOOKUP formula), "Your message if any", VLOOKUP formula)


For example, here's the IF / ISERROR / VLOOKUP formula analogous to the IFERROR /
VLOOKUP formula above:
=IF(ISERROR(VLOOKUP($F$2,$B$2:$C$10,2,FALSE)), "",
VLOOKUP($F$2,$B$2:$C$10,2,FALSE))
That's all for today. Hopefully, this short tutorial will help you cope with all possible VLOOKUP
errors and get your formulas to work in the way you want.

How to remove rows based on a cell value: shortcuts, VBA macros, delete every other
row
This article lists several ways to delete rows in Excel 2010-2013 based on a cell value. In this
post you'll find hotkeys as well as Excel VBA. Delete rows automatically or use the standard
Find option in combination with helpful shortcuts.
Excel is a perfect tool to store data that change every now and then. However, updating your
table after some changes may need really much time. The task can be as simple as removing
all blank rows in Excel. Or you may need to find and delete the duplicated data. One thing we
know for sure is that whenever details come or go, you search for the best solution to help you
save time on the current work.
For example, you have a marketplace where different vendors sell their products. For some
reason one of the vendors closed their business and now you need to delete all rows that
contain the vendor's name, even if they are in different columns.
In this post you'll find Excel VBA and shortcuts to delete rows based on certain text or value.
You'll see how to easily find and select the necessary information before removing. If your task
is not about deleting but adding rows, you can find how to do it in Fastest ways to insert multiple
rows in Excel 2010-2013.

o
o

The fastest Excel shortcut to delete rows in your table


Remove rows from the entire table.
Delete rows if there is data to the right of your table
Delete rows that contain certain text in a single column
How to remove rows in Excel by cell color
Delete rows that contain certain text in different columns
Excel VBA macro to delete rows or remove every other row
The fastest Excel shortcut to delete rows in your table
If you want to use the fastest method of deleting multiple rows according to the cell value they
contain, you need to correctly select these rows first.
To select the rows, you can either highlight the adjacent cells with the needed values and
click Shift + Space or pick the needed non-adjacent cells keeping the Ctrl key pressed.

You can also select entire lines using the row number buttons. You'll see the number of the
highlighted rows next to the last button.

After you select the necessary rows, you can quickly remove them using an Excel "delete row"
shortcut. Below you'll find how to get rid of the selected lines whether you have a standard data
table, or a table that has data to the right.
Remove rows from the entire table
If you have a simple Excel list that has no additional information to the right, you can use the
delete row shortcut to remove rows in 2 easy steps:
1. Select the rows you want to delete.
2. Press the Ctrl + - (minus on the main keyboard) hotkey.
You'll see the unused rows disappear in a snap.
Tip. You can highlight only the range that contains the values you want to remove. Then use the
shortcut Ctrl + - (minus on the main keyboard) to get the standard Excel Delete dialog box
allowing you to select the Entire row radio button, or any other deleting option you may need.

Delete rows if there is data to the right of your table


Ctrl + - (minus on the main keyboard) Excel shortcut is the fastest means to delete rows.
However, if there is any data to the right of your main table like on the screenshot below, it may
remove rows along with the details you need to keep.

If that's your case, you need to format your data as Excel Table first.
1. Press Ctrl + T, or go to the Home tab -> Format as Table and pick the style that suites you
best.

You will see the Create Table dialog box that you can use to highlight the necessary range.

2. Now that your list is formatted, select the range with the values or rows you want to delete
within your table.

Note. Please make sure you don't use the row buttons to select the entire rows.
3. Press Ctrl + - (minus on main keyboard) to see the unwanted data removed only from your
table. The additional information to the right will be left intact.
Hope you've found this "remove row" shortcut helpful. Continue reading to find Excel VBA for
deleting rows and learn how to eliminate data based on certain cell text.
Delete rows that contain certain text in a single column
If the items in the rows you want to remove appear only in one column, the following steps will
guide you through the process of deleting the rows with such values.

1. First you need to apply Filter to your table. To do this, navigate to the Data tab in Excel and
click on the Filter icon.

2. Filter the column that contains the values for deleting by the needed text. Click on the arrow
icon next to the column that contains the needed items. Then uncheck the Select All option and
tick the checkboxes next to the correct values. If the list is long, just enter the necessary text in
theSearch field. Then click OK to confirm.

3. Select the filtered cells in the rows you want to delete. It's not necessary to select entire rows.

4. Right-click on the highlighted range and and pick the Delete row option from the menu list.

Finally click on the Filter icon again to clear it and see that the rows with the values disappeared
from your table.
How to remove rows in Excel by cell color
The filter option allows sorting your data based on the color of cells. You can use it to delete all
rows that contain certain background color.
1. Apply Filter to your table. Go to the Data tab in Excel and click on the Filter icon.

2. Click on the small arrow next to the needed column name, go to Filter by Color and pick the
correct cell color. Click OK and see all highlighted cells on top.

3. Select the filtered colored cells, right-click on them and pick the Delete Row option from the
menu.

That's it! The rows with identically colored cells are removed in an instant.
Delete rows that contain certain text in different columns
If the values you want to remove are scattered around different columns, sorting may
complicate the task. Below you'll find a helpful tip to remove rows based on the cells that
contain certain values or text. From my table below, I want to remove all rows that contain
January which appears in 2 columns.
1. Start by searching and selecting the cells with the needed value using the Find and
Replacedialog. Click Ctrl + F to run it.
Tip. You can find the same dialog box if you go to the Home tab -> Find & Select and pick
theFind option from the drop-down list.

2. Enter the needed value in the Find what field and select any additional options if necessary.
Then press Find All to see the result.

3. The results will appear in the Find and Replace window.

Select the found values in the window keeping the Ctrl key pressed. You will get the found
values automatically highlighted in your table.

4. Now navigate to the Home tab -> Delete -> Delete Sheet Rows.

Tip. You can delete the rows with the selected values if you press Ctrl + - (minus on the main
board) and select the radio button Entire rows.
Voila! The unwanted rows are deleted.

Excel VBA macro to delete rows or remove every other row


If you always search for a solution to automate this or that Excel routine, grab the macros below
to streamline your delete-rows task. In this part you'll find 2 VBA macros that will help you
remove rows with the selected cells or delete every other row in Excel.
The macro RemoveRowsWithSelectedCells will eliminate all lines that contain at least one
highlighted cell.
The macro RemoveEveryOtherRow as its name suggests, will help you get rid of every
second/third, etc., row according to your settings. It will remove rows beginning with the current
mouse cursor location and till the end of your table.
If you don't know how to insert macros, feel free to look at How to insert and run VBA code in
Excel 2010, 2013 - tutorial for beginners.
?
Sub RemoveRowsWithSelectedCells()
Dim rngCurCell, rng2Delete As Range
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For Each rngCurCell In Selection
If Not rng2Delete Is Nothing Then
Set rng2Delete = Application.Union(rng2Delete, _
ActiveSheet.Cells(rngCurCell.Row, 1))
Else
Set rng2Delete = rngCurCell
End If
Next rngCurCell
If Not rng2Delete Is Nothing Then
rng2Delete.EntireRow.Delete
End If
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

Sub RemoveEveryOtherRow()
Dim rowNo, rowStart, rowFinish, rowStep As Long
Dim rng2Delete As Range
rowStep = 2
rowStart = Application.Selection.Cells(1, 1).Row

rowFinish = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For rowNo = rowStart To rowFinish Step rowStep
If Not rng2Delete Is Nothing Then
Set rng2Delete = Application.Union(rng2Delete, _
ActiveSheet.Cells(rowNo, 1))
Else
Set rng2Delete = ActiveSheet.Cells(rowNo, 1)
End If
Next
If Not rng2Delete Is Nothing Then
rng2Delete.EntireRow.Delete
' Hide every other row
'rng2Delete.EntireRow.Hidden = True
End If
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Tip. If your task is to color every second/third, etc., row with a different color, you will find the
steps in Alternating row color and column shading in Excel (banded rows and columns).
In this article I described how to delete rows in Excel. Now you have several useful VBA macros
to delete the selected rows, you know how to remove every other row and how to use Find &
Replace to help you search and select all the lines with the same values before eliminating
them. Hope the tips above will simplify your work in Excel and let you get more free time for
enjoying these last summer days. Be happy and excel in Excel!

4 ways to do a case-sensitive vlookup in Excel


The tutorial explains how to make Excel VLOOKUP case-sensitive, demonstrates a few other
formulas that can look up case in Excel and points out strengths and limitations of each
function.
I guess every Excel user knows what function performs a vertical lookup in Excel. Right,
VLOOKUP. However, very few people are aware that Excel's VLOOKUP is case-insensitive,
meaning it teats lowercase and UPPERCASE characters as identical.
Here's a quick example that demonstrates VLOOKUP's inability to distinguish case. Suppose, if
you have "bill" in cell A1 and "Bill" in cell A2, the formula =VLOOKUP("Bill", A1:A10, 2) will catch
"bill" because it comes first in the lookup array, and return a value from cell B1.
Further on in this article, I will show you a way to make VLOOKUP case-sensitive. We will also
explore several other functions that can do a case-sensitive match in Excel.
We will start with fairly simple LOOKUP and SUMPRODUCT, which however have a few
significant limitations. And then, we will have an in-depth look at a bit more complex INDEX /
MATCH formula that works impeccably in all scenarios and on all data sets.

VLOOKUP case-sensitive formula - requires a helper column.


LOOKUP formula for case-sensitive match - requires sorting the lookup column in
ascending order.
SUMPRODUCT to look up case of text values - returns numeric values only.
MATCH / INDEX - case-sensitive vlookup for all data types - a bit more complex formula
that works with all data types.
A case-sensitive VLOOKUP formula
As you already know, a usual Vlookup formula is case-insensitive. However, there is a way to
make Excel VLOOKUP case-sensitive. You can force it to match case by adding a helper
column to your worksheet, as demonstrated in the following example.
Suppose you have "Item IDs" in column B and you want to pull the item's price and associated
comment from columns C and D. The problem is that items IDs include both lowercase and
uppercase chars. For example, the values in B4 (001Tvci3u) and B5 (001Tvci3U) differ in the
last letter only, "u" and "U", respectively:

As you can guess, a usual Vlookup formula =VLOOKUP("001Tvci3U",$A$2:$C$7,2,FALSE) will


fetch $90 that is associated with "001Tvci3u" because it comes before "001Tvci3U" in the
lookup array. But this not what you want, right?

To be able to perform a case-sensitive vlookup in Excel, you need to add a helper column and
populate it with the below formula (where B is your lookup column):
=CODE(MID(B2,1,1)) & CODE(MID(B2,2,1)) & CODE(MID(B2,3,1)) &
CODE(MID(B2,4,1)) & CODE(MID(B2,5,1)) & CODE(MID(B2,6,1)) &
CODE(MID(B2,7,1)) & CODE(MID(B2,8,1)) & IFERROR(CODE(MID(B2,9,1)),"")
The formula parses the lookup value into individual characters, converts each char to its code
(e.g. "A" is 65 and "a" is 97), and then concatenates these codes into a unique number string.
After that, you use a simple Vlookup formula that matches case:
=VLOOKUP($G$3,$A$2:$C$8,3,FALSE)

The following two things are essential for the correct work of your Vlookup case-sensitive
formula:
1. The helper column should be the left-most column in the lookup range (table_array
argument).

2. The lookup value (lookup_value argument) shall be a "character code" rather than a real
value.
How to use the CODE formula correctly
The CODE formula that is copied across the helper column implies that all of your lookup values
have the same number of characters. If not, you need to know the min and max numbers and
add as many IFERROR functions as many chars make the difference between the smallest and
largest lookup values.
For example, if the smallest lookup value has 3 chars and largest - 5 chars, you use this
formula:
=CODE(MID(B2,1,1)) & CODE(MID(B2,2,1)) & CODE(MID(B2,3,1)) &
IFERROR(CODE(MID(B2,3,1)),"") & IFERROR(CODE(MID(B2,4,1)),"")
In the MID function, you specify the following arguments:

1st parameter (text) - this is text or a cell reference containing the characters you want to
extract (B2 in our case).
2nd parameter (start_num) - the position of the first character you want to extract. You
enter 1 in the first MID function, 2 in the second and so on.
3rd parameter (num_chars) - specifies the number of characters you want to return from
text. Since you always want just 1, you enter "1" in all the functions.
VLOOKUP limitations: The VLOOKUP function is not the best way to do a case-sensitive
lookup in Excel because, firstly, it requires adding a helper column, and secondly, it works better
on homogeneous data sets, or at least when you know the exact number of symbols in your
lookup values. If this is not your case, please try out other solutions that follow below.
LOOKUP formula for case-sensitive match
Excel's LOOKUP function is very akin to VLOOKUP, however its syntax lets you match a case
without adding a helper column. To do this, you have to use LOOKUP together with the EXACT
function.
If we take the data from the previous example (without the helper column A with codes), the
following Lookup / Exact formula will work a treat:
=LOOKUP(TRUE,EXACT($A$2:$A$7,$F$2),$B$2:$B$7)
The formula searches through cells A2:A7 for the exact case-sensitive value in cell F2 and
returns a value from column B in the same row.

As well as VLOOKUP, the LOOKUP functions works for numerical and text values equally well,
and the below screenshot is a good evidence:

Important! For the LOOKUP formula to work correctly, the values in your lookup column must
be sorted in ascending order, i.e. from smallest to largest.
Let me briefly explain the use of the EXACT function in the above formula because this is the
key point.
Excel's EXACT function compares two text values in the 1st and 2nd arguments and returns
TRUE if they are exactly the same, FALSE otherwise. What is really important for us is that
EXACT is case-sensitive.
Now, let's analyze how our LOOKUP / EXACT formula
works: =LOOKUP(TRUE,EXACT($A$2:$A$7,$F$2),$B$2:$B$7)

The EXACT function checks the value of cell F2 against all the items in column A
(A2:A7) and if an exact case-sensitive match is found, returns TRUE, otherwise - FALSE.
Since you've entered TRUE in the first parameter (lookup_value) of the LOOKUP
function, it pulls a corresponding value from the return column (column B in this example), only
when the exactcase-sensitive match is found.
Hopefully, the above explanation makes sense and you understand the general idea now. If you
do, you won't have any difficulties with other functions that we are going to explore next, since
all of them are based on the same principle.
LOOKUP limitations: requires sorting the lookup column in ascending order.
SUMPRODUCT - look up case of text values and return matching numbers
As you've already understood from the heading, SUMPRODUCT is yet another Excel function
can do a case-sensitive lookup, but can return numeric values only. If this is not your case,
you can skip directly to INDEX MATCH that provides a general solution and works on all data
types.

First off, let me briefly explain the syntax of this function, it will help you better understand the
case-sensitive SUMPRODUCT formula that follows below.
Excel's SUMPRODUCT multiplies components in the specified arrays, and returns the sum of
the products. Its syntax is as follows:
SUMPRODUCT(array1,array2,array3, ...)
Since we want a case sensitive lookup, we use the EXACT function from the previous
example as one of the multipliers:
=SUMPRODUCT((EXACT($A$2:$A$7,$F$2)*($B$2:$B$7)))
As you remember, the EXACT function compares the value in cell F2 against all the items in
column A and if an exact case-sensitive match is found, returns TRUE, otherwise FALSE . In
mathematical operations, Excel treats TRUE as "1" and FALSE as "0", so the SUMPRODUCT
function multiplies the returned numbers and sums the products.
Zeros do not count, because a zero always produces "0" whatever number it is multiplied by.
So, let's have a closer look at what happens when an exact match is found in column A and "1"
is returned. The SUMPRODUCT function multiplies 1 by a number in column B in the same row
and returns exactly this number! This is because the products of other multiplications are zeros,
which do not impact the returned value in any way.
Regrettably, the SUMPRODUCT function cannot cope with text values and dates since they
cannot be multiplied. In this case, you will get the #VALUE! error message like in cell F4 in the
screenshot below:

SUMPRODUCT limitations: returns numeric values only.


MATCH / INDEX - case-sensitive lookup for all data types
Finally, you are close to getting a limitation-free case-sensitive lookup formula that works on all
data sets.

This example comes last of all not only because the best is saved for the last, but also because
the knowledge you've gained from the previous examples may help you understand the casesensitive MATCH / INDEX formula better.
As you probably know, the combination of INDEX and MATCH functions is used in Excel as a
more flexible and powerful alternative to VLOOKUP. The following article does a good job
(hopefully : ) explaining how these two functions work together - Using INDEX / MATCH instead
of VLOOKUP.
I will just remind you the key points:

The MATCH function searches for a lookup value in a specified range and returns the
relative position of the value, i.e. row or/and column numbers.
From there, the INDEX function take those numbers and returns a value from the
specified column or row, or at the intersection of the column and row if both are supplied.
For INDEX / MATCH to be able to look up a case, you just need to add one more function to the
liaison. As you can easily guess, you need the EXACT function again:
=INDEX($B$2:$B$7,MATCH(TRUE,EXACT($A$2:$A$7,$F$2),0))
In the above formula, the EXACT function works in the same manner as in the LOOKUP
formulaand produces the same result:

Note. Please pay attention that the INDEX / MATCH formula is enclosed in curly braces,
meaning this is an array formula and you have to press Ctrl + Shift + Enter to complete it.
Why INDEX / MATCH is the best solution for case-sensitive vlookup
The main advantages of using INDEX / MATCH are:
1.
2.
3.

It does not require adding a helper column like the VLOOKUP function does.
It does not require sorting a lookup column like the LOOKUP function does.
It works with all data types - numbers, text and dates.

The above mentioned case-sensitive INDEX / MATCH formula seems perfect, right? But, in fact,
it is not. Let me show you why.
Suppose, a cell in the return column corresponding to a lookup value is blank. What shall the
formula return? Nothing. And now, let's see what it actually returns:

Oops, the formula returns a zero! Maybe, this is no big deal if you are working solely with text
values. However, if your worksheet contains numbers and some of them are real zeros, this is a
problem.
In truth, all other lookup formulas (VLOOKUP, LOOKUP and SUMPRODUCT) we have
discussed earlier behave in the same way. But now you want an impeccable formula, don't you?
To make the case-sensitive INDEX / MATCH formula absolutely perfect, you need to wrap it in
the IF function that will check whether a return cell is blank and return nothing in this case:
=IF(INDIRECT("B"&(1+MATCH(TRUE,EXACT($A$2:$A$7,$G$2),0)))<>"",INDEX($B
$2:$B$7,MATCH(TRUE,EXACT($A$2:$A$7,$G$2),0)),"")
In the above formula:

"B" is the return column


"1+" is the number that turns a relative position of a cell returned by the MATCH
function into a real cell address. For example, the lookup array in our MATCH function is
A2:A7, meaning the relative position of cell A2 is "1", because this is the first cell in the array. But
the real position of cell A2 in the column is "2", so we add 1 to compensate the difference, for the
INDIRECT to return a value from the right cell.
The below screenshots demonstrate the improved case-sensitive INDEX / MATCH formula in
action. I've re-written the formula for columns B:D so that the formula bar can fit within the
screenshots.

The INDEX / MATCH formula returns nothing if the return cell in empty:

The formula returns "0" if the return cell contains a zero:

If you want the INDEX / MATCH formula to display some message when a return value is blank,
you can write something between the last quotes ("") in the formula, like this:
=IF(INDIRECT("D"&(1+MATCH(TRUE,EXACT($B$2:$B$7,$G$2),0)))<>"",INDEX($D
$2:$D$7,MATCH(TRUE,EXACT($B$2:$B$7,$G$2),0))," There is nothing to

return, sorry.")

If you want to try out any of the above formulas on your data, feel free to download our casesensitive vlookup examples.

INDEX & MATCH functions in Excel - a better alternative to VLOOKUP


This tutorial demonstrates the key strengths of Excel's INDEX / MATCH function that make it
superior to VLOOKUP. You will find a number of formula examples that will help you easily cope
with many complex tasks when VLOOKUP fails.
In a couple of recent articles I made a good effort to explain the basics of Excel VLOOKUP
functionto beginners and provide more complex VLOOKUP formula examples to power users.
And now, I will try if not to talk you out of using VLOOKUP, then at least show you an alternative
way to do a vertical lookup in Excel.
"What do I need that for?" you can ask me. Because VLOOKUP is not the only lookup formula
available in Excel, and its numerous limitations might prevent you from getting the desired result
in many situations. On the other hand, Excel's INDEX MATCH is more flexible and has certain
features that make it superior to VLOOKUP in many respects.

o
o
o
o
o

The basics of Excel INDEX and MATCH functions


Using INDEX / MATCH in Excel
Advantages of INDEX / MATCH compared to VLOOKUP
INDEX & MATCH - formula examples
How to lookup values to left
Calculations with INDEX MATCH
Search by row and column values
Look up with multiple criteria
Excel INDEX MATCH with IFERROR
Excel's INDEX and MATCH functions - the basics
Since the aim of this tutorial is to demonstrate an alternative way to do a vlookup in Excel by
using a combination of INDEX and MATCH functions, we won't dwell much on their syntax and
uses. We will cover only the minimum necessary for understanding the general idea and then
take an in-depth look at formula examples that reveal all the advantages of using Index / Match
instead of Vlookup.

The INDEX function's syntax and usage


The Excel INDEX function returns a value in an array based on the row and column numbers
you specify. The syntax of the INDEX function is straightforward:
INDEX(array, row_num, [column_num])
Here is a very simple explanation of each parameter:

array - this is a range of cells that you want to return a value from.
row_num - the row number in array from which you want to return a value. If omitted,
the column_num is required.
column_num - the column number in array from which you want to return a value. If
omitted, row_num is required.
If both row_num and column_num parameters are used, the INDEX function returns the value in
the cell at the intersection of the specified row and column.
And here is the simplest example of the INDEX formula:
=INDEX(A1:C10,2,3)
The formula searches in cells A1 through C10 and returns a value of the cell in the 2nd row and
the 3rd column, i.e. cell C2.
Very easy, right? However, when working with real data you would hardly ever know which row
and column you want, that is why you need the help of the MATCH function.
The MATCH function's syntax and usage
The Excel MATCH function searches for a lookup value in a range of cells, and returns
the relative position of that value in the range.
For example, if the range B1:B3 contains the values "New-York", "Paris", "London", then the
formula =MATCH("London",B1:B3,0) returns the number 3, because "London" is the third entry
in the range.
The syntax of the MATCH function is as follows:

MATCH(lookup_value, lookup_array, [match_type])


lookup_value - this is the number or text you are looking for. This can be a value, a cell
reference or logical value.
lookup_array -a range of cells being searched.
match_type - this parameter tells the MATCH function whether you want to return an
exact match or the nearest match:
1 or omitted - finds the largest value that is less than or equal to the lookup value.
The values in the lookup array must be sorted in ascending order, i.e. from smallest to largest.

0 - finds the first value that is exactly equal to the lookup value. In the INDEX /
MATCH combination, you almost always need the exact match, so the third argument of your
MATCH function is "0".
-1 - finds the smallest value that is greater than or equal to lookup_value. The
values in the lookup array must be sorted in descending order, i.e. from largest to smallest.
At first sight, the usefulness of the MATCH function may seem questionable. Who cares about
the position of a value in a range? What we do want to know is the value itself.
Let me remind you that the relative position of the lookup value (i.e. a row or/and column
number) is exactly what you need to supply to the row_num or/and column_num argument of
the INDEX function. As you remember, the INDEX function can return the value at the juncture
of a given row and column, but it cannot determine which exactly row and column you want.
How to use INDEX MATCH function in Excel
Now that you know the basics of these two functions, I believe it has already started making
sense how Excel's MATCH and INDEX work together.
The MATCH function determines the relative position of the lookup value in the specified range
of cells. From there, the INDEX function takes that number, or numbers, and returns a value in
the corresponding cell.
Still having difficulties to figure it out? Think about Excel INDEX / MATCH in this way:
=INDEX (column to return a value from, (MATCH (lookup value, column to
lookup against, 0))
I believe it's even easier to understand from an example. Suppose you have a list of national
capitals like this:

Let's find the population of some capital, say the capital of Japan, using the following Index
Match formula:

=INDEX($D$2:$D$10,MATCH("Japan",$B$2:$B$10,0))
Now, let's analyze what each component of this formula actually does:

The MATCH function searches for the lookup value "Japan" in column B, more precisely
cells B2:B10, and returns the number 3, because "Japan" is the third in the list.
The INDEX functions takes "3" in the second parameter (row_num), which indicates
which row you want to return a value from, and turns into a simple =INDEX($D$2:$D$10,3).
Translated into plain English, the formula reads: search in cells D2 through D10 and return a
value of the cell in the 3rd row, i.e. cell D4, because we start counting from the second row.
And here's the result you get in Excel:

Important! The number of rows and columns in the INDEX array should match those in the
row_num or/and column_num parameters of the MATCH functions, respectively. Otherwise, the
formula will return incorrect result.
Wait, wait... why don't we simply use the following Vlookup formula? What's the point in wasting
time trying to figure out the arcane twists of Excel's MATCH / INDEX?
=VLOOKUP("Japan",$B$2:$D$2,3)
In this case, no point at all : ) This simple example is for demonstration purposes only, so that
you get a feel of how the Index and Match functions work together. Other examples that follow
below will show you the real power of the INDEX MATCH liaison that easily copes with many
complex scenarios when VLOOKUP stumbles.
Why Excel's INDEX MATCH is better than VLOOKUP
When deciding which formula to use for vertical lookups, the majority of Excel gurus agree that
INDEX / MATCH is far better than VLOOKUP. However, many Excel users still resort to utilizing
VLOOKUP because it's a simpler function. This happens because very few people fully

understand all the benefits of switching from Vlookup to Index Match, and without such
understanding no one is willing to invest their time to learn a more complex formula.
Below, I will try to point out the key advantages of using MATCH / INDEX in Excel, and then you
decide whether you'd rather stick with Vlookup or switch to Index Match.
4 top benefits of using MATCH INDEX in Excel
1. Right to left lookup. As any educated user knows, Excel VLOOKUP cannot look to its left,
meaning that your lookup value should always reside in the left-most column of the lookup
range. With INDEX MATCH, your lookup column can be on the right side of your table as well.
The following example demonstrates this feature in action - How to lookup values to left.
2. Insert or delete columns safely. VLOOKUP formulas get broken or return incorrect results
when a new column is deleted from or added to a lookup table. With VLOOKUP, any inserted or
deleted column changes the results returned by your formulas because the VLOOKUP
function's syntax requires specifying the entire table array and a certain number indicating which
column you want to pull the data from.
For example, if you have a table A1:C10 and want to return a value from column B, you will put
"2" in the third parameter (col_index_num) of a VLOOKUP formula, say = VLOOKUP("lookup
value", A1:C10, 2). If at a later point, you insert a new column between A and B, you will have to
change "2" to "3" in your formula, otherwise it would return a value from the newly inserted
column.
With INDEX MATCH, you can delete or insert new columns in your lookup table without
distorting the results since you specify directly the column containing the value you want to get.
And this is a really great benefit, especially when working with large datasets, since you are
able to insert and remove columns without worrying about updating every associated vlookup
formula.
3. No limit for a lookup value's size. When using the VLOOKUP function, remember that the
total length of your lookup criteria should not exceed 255 characters, otherwise you will end up
having the #VALUE! error. So, if your dataset contains long strings, INDEX MATCH is the only
working solution.
Suppose, you are using the following VLOOKUP formula that searches through cells B5 to D10
for the value in cell A2:
=VLOOKUP(A2,B5:D10,3,FALSE)
The formula won't work if the lookup value in cell A2 exceeds 255 symbols. Instead, you shall
use the analogous INDEX / MATCH function:
=INDEX(D5:D10, MATCH(TRUE, INDEX(B5:B10=A2, 0), 0))

4. Higher processing speed. If you are working with relatively small tables, the difference in
Excel's performance will most likely be unnoticeable, especially in recent versions. But if you
use large worksheets with thousands of rows and thousands of lookup formulas, Excel will work
much faster if you use MATCH INDEX rather than VLOOKUP. Generally, the use of Index /
Match formulas increases Excel's performance by 13% compared to equivalent Vlookup
formulas.
VLOOKUP's impact on Excel's performance may be especially evident if your workbook
contains hundreds of complex array formulas like VLOOKUP and SUM. The point is that
checking each value in the array requires a separate call of the VLOOKUP function. So, the
more values your array contains and the more array formulas you have in a workbook, the
slower Excel performs.
On the other hand, with INDEX MATCH, Excel has to consider only the lookup and return
columns, as the result it processes such formulas much faster.
Excel INDEX & MATCH - formula examples
Now that you know the reasons to learn the MATCH INDEX function, let's get to the most
interesting part and see how you can apply the theoretical knowledge in practice.
How to lookup values to left with INDEX & MATCH
As stated in any VLOOKUP tutorial, this Excel function cannot look at its left. So, unless your
lookup column is the left-most column in the lookup range, there's no chance that a vlookup
formula will return the result you want.
Excel's INDEX MATCH function is more flexible and does not really care where the return
column resides. As an example, we will use the table listing national capitals by population
again. This time, let's write an INDEX MATCH formula that finds how the Russian capital,
Moscow, ranks in terms of population.
As you can see in the screenshot below, the following formula works perfectly:

=INDEX($A$2:$A$10,MATCH("Russia",$B$2:$B$10,0))

By now, you should not have any difficulties to understand how the formula works:

First, you write a simple MATCH formula that finds the position of Russia:
=MATCH("Russia",$B$2:$B$10,0))
Then, you determine the array parameter for your Index function, which is column A in
our case (A2:A10).
Finally, you assemble the two parts together and get this formula:
=INDEX($A$2:$A$10,MATCH("Russia",$B$2:$B$10,0))
Tip. It's a good idea to always use absolute cell references in INDEX and MATCH formulas so
that your lookup ranges won't get distorted when you copy the formula to other cells.
Download Lookup to left example.
Calculations with INDEX MATCH in Excel (AVERAGE, MAX, MIN)
You can nest other Excel functions within the MATCH INDEX formula, say, to find the minimum
or maximum value, or the value closest to the average in the range. Here are a few formula
examples for the table used in the previous sample:
Function

Formula example

Description

Returned
result

Min

=INDEX($C$2:$C$10,
MATCH(MIN($D$2:I$10),
$D$2:D$10, 0))

Finds the min value in


column D and returns a
value from column C in the
same row.

Beijing

=INDEX($C$2:$C$10,
MATCH(MAX($D$2:I$10),
$D$2:D$10, 0))

Finds the max value in


column D and returns a
value from column C in the

Max

Lima

same row.

Average

=INDEX($C$2:$C$10,
MATCH(AVERAGE($D$2:D$10),
$D$2:D$10, 1))

Calculates the average in


range D2:D10, finds the
value closest to the
average, and returns a
corresponding value from
column C.

Moscow

Download Calculations with Excel INDEX /MATCH example.


Things to keep in mind when using AVERAGE with INDEX / MATCH
When using the AVERAGE function in combination with INDEX MATCH, most often you would
enter either "1" or "-1" in the third argument (match_type) of the MATCH function, unless you
are certain that your lookup array contains a value exactly equal to the average. If latter, you
can enter "0" for exact match.
If you set 1, the values in the lookup column must be sorted in ascending order, and the formula
will return the largest value that is less than or equal to the average value.
If you set -1, the values in the lookup column must be sorted in descending order, and the
smallest value that is greater than or equal to the average value will be returned.
In our example, values in column D are sorted in ascending order, so we use "1" as the match
type, and our Average + Index Match formula returns "Moscow" since its population
(11,5410,00) is the closest "less than" match to the average number (12,269,006).

If you are curious to know analogues VLOOKUP formulas, here you go: Calculations with
VLOOKUP (AVERAGE, MAX, MIN).

How to use INDEX MATCH to search by row and column values


This formula is an equivalent of the two-dimensional VLOOKUP that lets you find the value at
the intersection of a certain row and column.
In this example, your Excel INDEX MATCH function is going to be very similar to other formulas
we've already discussed in this tutorial, with the only difference. Guess what?
As you remember, the syntax of the INDEX function allows for both: INDEX(array,
row_num, [column_num]). And I congratulate those of you who have guessed right : )
To begin with, let's create the general formula pattern. We just take the INDEX / MATCH formula
you already know and add one more MATCH function to it, which will return the column number:
=INDEX (your table, (MATCH (vertical lookup value, column to lookup
against, 0)), (MATCH (horizontal lookup value, row to lookup against,
0))
Please pay attention that you have to specify the entire table in the array argument of the
INDEX function in case of two-way lookup.
And now, let us apply this formula template in practice. Below, you see a list of the most
populated counties in the world. Suppose, you want to know the number of population in the
USA in the year 2015:

Okay, let's start on the formula. Whenever I need to create a complex Excel formula with one or
several nested functions, I always write each individual function first.
So, you start by writing two MATCH functions that will return the row and column numbers for
your INDEX function.

Vertical match - you search through column B, more precisely in cells B2 to B11, for the
value in cell H2 ("USA"), and the corresponding MATCH function is

this:=MATCH($H$2,$B$1:$B$11,0)This MATCH formula returns 4 because "USA" is the


4th item in column B (including the column header).
Horizontal match - you search for the value in cell H3 ("2015") in row 1, i.e. in cells A1
to E1:=MATCH($H$3,$A$1:$E$1,0)This MATCH formula returns "5" because "2015" is the
5th column.
Now, put the above formulas inside the INDEX function, and voila:
=INDEX($A$1:$E$11, MATCH($H$2,$B$1:$B$11,0), MATCH($H$3,$A$1:$E$1,0))
If you replace the MATCH functions with the returned numbers, the formula is much easier to
understand: =INDEX($A$1:$E$11, 4, 5, 0))
Meaning, it returns a value at the intersection of the 4th row and 5th column in range A1:E11,
which is the value in cell E4. Easy? Yep! : )

Download 2-way INDEX /MATCH example.


Look up with multiple criteria using INDEX MATCH
In the Excel VLOOKUP tutorial, I demonstrated a formula example to do a vlookup with multiple
criteria. However, a significant limitation of that approach was the necessity to add a helper
column. The good news is that Excel's INDEX MATCH function can also lookup by values in 2
columns, at that no helper column is requited!
Suppose, you have a list of orders and you want to find the sum based on 2 criteria, "Customer
Name" and "Product". A complicating factor is that one customer can buy multiple products and

customer names are listed in a random order in the Lookup table:

The following INDEX MATCH formula works a treat:


{=INDEX('Lookup table'!$A$2:$C$13, MATCH(1, (A2='Lookup table'!
$A$2:$A$13) * (B2='Lookup table'!$B$2:$B$13) ,0), 3)}
This formula is more complex than any other we've discussed today, but powered with the
knowledge of Excel MATCH INDEX you already have, you can cope with it.
The trickiest part is the MATCH function, and I think I shall explain it first:
MATCH(1, (A2='Lookup table'!$A$2:$A$13),0) * (B2='Lookup table'!$B$2:$B$13)
In the above formula, the lookup value is "1" and the lookup array is a product of multiplication.
Okay, what do we multiply and why? We take the first value in column A ("Customer name") in
the main table and check it against all customer names in the lookup table (A2:A13). If the
match is found, the equation returns "1", otherwise "0". Then we do the same for values in
columns B ("Products"). And then, we multiply the returned values. What it means is that only if
a match is found in both columns (i.e. both of your criteria are true), you get 1. If neither criterion
is true, or only one is true, you get 0.
Do you understand now why we use "1" as the lookup value? Right, for the MATCH function to
return the position only when both criteria are true.
Also, please pay attention that you have to use the optional third parameter (column_num) of
the INDEX function in this case. This is because you specify the entire table in the first
parameter (array ), and you need to let the function know which column you want to return a
value from. In our case this is column C ("Sum"), so we enter 3.

And finally, since we need to check each cell in the array until the formula finds a result, this
INDEX MATCH formula should be an array formula. You can determine this by curly braces in
which it is encapsulated. So, remember to press Ctrl + Shift + Enter to complete the formula
after you've finished typing.
If everything is done correctly, you will get a result similar to what you see in the screenshot
below:

Download INDEX /MATCH with multiple criteria example.


Using INDEX / MATCH with IFERROR in Excel
As you have probably noticed (more than once : ) if you enter an invalid value, i.e. a value that
does not exist in the lookup array, the INDEX / MATCH function produces #N/A or #VALUE error
message. If you'd rather replace it will something more meaningful, you can wrap your INDEX /
MATCH formula in the IFERROR function.
The syntax of the IFERROR function is very simple:
IFERROR(value, value_if_error)
Where the value argument is the value checked for an error (the result of the INDEX MATCH
formula in our case); and value_if_error is the value to return if the formula produces an error.
For example, you can enclose the formula from the previous example within the IFERROR
function in this way:

=IFERROR(INDEX($A$1:$E$11, MATCH($G$2,$B$1:$B$11,0),
MATCH($G$3,$A$1:$E$1,0)),
"No match is found. Please try again!")
And now, if someone inputs an invalid entry, the formula will produce the result you see in the
screenshot below:

If you prefer to have a blank cell when an error is returned, you can just use double quotes ("")
in IFERROR's second parameter, like this:
IFERROR(INDEX(array, MATCH(lookup_value, lookup_array, 0), "")
Download INDEX / MATCH with IFERROR example.
I hope at least one formula described in this tutorial proved to be helpful for you. If you are faced
with some other lookup task for which you have not found a solution here, don't hesitate to drop
me a comment and we will try to fathom it out.

Relative and absolute cell references in Excel conditional formatting rules


Recently we have published a few articles covering different aspects of Excel conditional
formatting. Unexpectedly, it's turned out that it's not creating a rule and even not making a
proper formula that represents the greatest challenge. Using proper cell references in Excel
formulas appear to be the most complex part and a common source of the problem.
"I had my conditional rule correct, except for the mixed references." This is what our blog
readers have often reported in comments. So, why don't we invest a few minutes to figure this
thing out? This will certainly save you far more time in the long run!

Relative and absolute cell references in conditional formatting rules


Example 1. Absolute column and relative row
Example 2. Relative column and absolute row
Example 3. Absolute column and absolute row
Example 4. Relative column and relative row
How relative and absolute cell references work in conditional formatting rules
In all Excel formulas, including conditional formatting rules, cell references can be of the
following types:

Absolute cell references (with the $ sign, e.g. $A$1) always remain constant, no matter
where they are copied.
Relative cells references (without the $ sign, e.g. A1) change based on the relative
position of rows and columns, when copied across multiple cells.
Mixed cells references (absolute column and relative row (e.g. $A1), or relative column
and absolute row (e.g. A$1). In Excel conditional formatting rules, mixed cell references are
used most often, indicating that a column letter or row number is to remain fixed when the rule is
applied to all other cells in the selected range.
In conditional formatting rules, cell references are relative to the top-left most cell in the
applied range. So, when making a new rule, you can simply pretend as if you are writing a
formula for the top-left cell only, and Excel will "copy" your formula to all other cells in the
selected range.
Now, let me show you a few examples that demonstrate how seemingly identical formulas
produce different results depending on what cell references types are used.
Example 1. Absolute column and relative row
This pattern is most typical for conditional formatting rules and in 90% of cases cell references
in your Excel conditional formatting rules will be of this type.
Let's make a very simple rule that compares values in columns A and B and highlights a value in
column A if it is greater than a value in column B in the same row.

If you need the detailed instructions on how to create conditional formatting rules with formulas,
here you go - Creating an Excel conditional formatting rule using a formula. In this case, the
formula is obvious:
=$A1>$B1
Because you always compare values in columns A and B, you "fix" these column by
usingabsolute column references, notice the $ sign before the column letters in the above
formula. And, since you are comparing the values in each row individually, you use relative row
references, without $.

Example 2. Relative column and absolute row


This cell reference type is the opposite of the previous one. In this case, the row number is
always constant while the column changes. You use such references when you want to check
values in a given row against a certain value or against values in another row.
For example, the below formula compares values in row 1 and 2 and the rule highlights a value
in row 1 if it is greater than a value in row 2 in the same column:
=A$1>A$2

Because you want the row numbers to be fixed, you use the absolute row references, with the
$ sign. And, because you want to compare values in each column individually, you create the
rule for the left-most column (A) and use relative column references, without the $ sign.
Example 3. Absolute column and absolute row
You use absolute row and absolute column references if you want to compare all values in the
selected range with some other value.
For example, let's create a rule that highlights all values in column A that are greater than a
value in cell B1. The formula is as follows:
=$A1>$B$1
Please pay attention to the use of the following references:

$A1 - you use an absolute column and relative row references because we want to
check values in all cells of column A against the value in cell B1.
$B$1 - you use absolute column & absolute row because cell B1 contains the value
you want to compare all other values against and you want this cell reference to be constant.

Example 4. Relative column and relative row


This reference type is used in Excel conditional formatting rules least of all. You use relative
column & relative row references when you want to check all cells of the selected range
against a certain value.
Suppose, you want to highlight all cells in columns A and B that are greater than a value in cell
B1. You can simply copy the formula from the previous example and replace $A1 with A1 since
you do not want to fix either row or column:
=$A1>$B$1
Remember, you write the formula for the top-left cell in your range, A1 in our case. When you
create a rule with the above formula and apply it to some range, say A1:B10, the result will look

similar to this:

Hopefully, these simples examples have helped you fathom out the essence of relative and
absolute cell references in Excel. Now that you know how to determine the appropriate
reference type for your rules, go ahead and harvest the power of Excel conditional formatting for
your projects. The following resources may prove helpful:

Excel formulas for conditional formatting based on another cell - the tutorial provides a
handful of examples that demonstrate how to format individual cells or entire rows based on
another cell's value in Excel 2013, 2010 and 2007.
How to conditionally format dates in Excel - the article explains how you can apply Excel
conditional formatting to dates using built-in rules and formulas.
How to change the row color based on a cell's value - this article will teach you how to
highlight entire rows based on a numeric or text value of a single cell.
Alternate row colors and column shading in Excel - the tutorial explains how to alternate
every other row or column in Excel. You will also find the formula to alternate row colors based
on a value change.
Change background color based on cell value - two quick ways to change the
background color of cells based on their values.
How to automatically highlight duplicates in Excel - see how you can use Excel
conditional formatting to highlight duplicates values.
Conditional formatting in Excel PivotTables - this tutorial covers some of the differences
in PivotTable formatting in Excel 2010.

How to hide and group columns in Excel


This tutorial shows how to hide columns in Excel 2010-2013. You will see the standard Excel
Hide columns functionality in action as well as learn to group and ungroup columns with Outline.
The possibility to hide columns in Excel is really helpful. There may be lots of reasons for
keeping certain details from showing:

You want to compare 2 or 3 columns but they are separated by several other columns.
For example, you need to see column A and column Y side-by-side. You may also find the
articleHow to freeze panes helpful.
You have several helper columns with calculations or formulas that may confuse other
users of the workbook.
You would like to keep some important formulas or personal details from being seen or
edited by your colleagues. You can learn how to protect your columns from being displayed if
you have a look at Disable the Unhide column option in Excel.
Read on to see how Excel enables you to hide columns in an instant. In this article you'll also
find an interesting way to hide columns via the Group option which adds special icons to quickly
conceal and display certain columns.

Excel - Hide columns you select


Use the Group option to hide and show columns in a click

Excel - Hide columns you select


If you want to hide one or several columns in your table, you can easily deal with this task
1. Open your worksheet and select one or several columns you want to hide.
Tip. You can pick several non-adjacent columns keeping the Ctrl key pressed.

2. Right-click above one of the selected columns and pick the Hide option from the menu list.

Tip. The shortcut-oriented users will appreciate this hotkey for hiding the selected
columns: Ctrl+0.
Voila! Now you can easily review your data skipping the extra details.

Use the Group option to hide and show columns in a click


Hiding columns is a popular task among spreadsheet users. Have you thought of the
Excel Groupfunction as of a way to deal with hiding and showing columns? Actually, it makes
the process much more straightforward. It's really helpful if you often need to see non-adjacent
columns side by side but these columns are always different.
When you group columns, you see small icons inserted around the Excel grid. They allow you to
hide and unhide data really quickly. These icons also show you which columns are hidden and
which can be concealed.
1. Select your table.
2. Press Shift + Alt + right arrow.

3. You will see the Group dialog box appear. Select the Columns radio button and click OK to
confirm.

Tip. You can get the same dialog if you go to Data -> Group -> Group.

Tip. You can select the range and press Shift + Alt + left arrow to remove grouping.
This will add special Outline symbols to your table.

4. Now select the columns you want to hide one by one and press Shift + Alt + right arrow for
each column.
Note. It's not possible to select several non-adjacent columns.

As soon as you press the hotkey, you will see the minus sign icon added to the outline above
your selected columns.

5. Clicking on the minus icon will hide the column and the icon will change to the plus sign
letting you to instantly unhide the data.

6. You can also use the small numbers in the top left corner. They let you hide and unhide all
groupings of the same level at once. For example, in my table on the screenshot, clicking on 1
will hide the entire table and clicking 2 will hide columns C and E. This is especially useful if you
created a hierarchy of grouping.

That's it. You learnt how to use the Excel Hide columns option. You also know how to group and
ungroup columns to show or hide them. Hope you found the tips helpful and they will simplify
your daily work with tables. Be happy and excel in Excel!

How to use VLOOKUP & SUM or SUMIF functions in Excel


In this tutorial, you will find a handful of advanced formula examples that demonstrate how to
use Excel's VLOOKUP and SUM or SUMIF functions to look up and sum values based on one
or several criteria.
Are you trying to create a summary file in Excel that will identify all instances of one particular
value, and then sum other values that are associated with those instances? Or, do you need to
find all values in an array that meet the condition you specify and then sum the related values
from another worksheet? Or maybe you are faced with a more concrete challenge, like looking
through a table of your company invoices, identifying all invoices of a particular vendor, and then
summing all the invoice values?
The tasks may vary, but the essence is the same - you want to look up and sum values with one
or several criteria in Excel. What kind of values? Any numeric values. What sort of criteria? Any :
) Starting from a number or reference to a cell containing the right value, and ending with logical
operators and results returned by Excel formulas.
So, does Microsoft Excel have any functionality that can help with the above tasks? Of course, it
does! You can work out a solution by combining Excel's VLOOKUP or LOOKUP with SUM or
SUMIF functions. The formula examples that follow below will help you understand how these
Excel functions work and how to apply them to real data.
Please note, these are advanced examples that imply you are familiar with the general
principles and syntax of the VLOOKUP function. If not, the first part of our VLOOKUP tutorial for
beginners is certainly worth your attention - Excel VLOOKUP syntax and general usages.

VLOOKUP and SUM - sum all matching values


Other calculations with VLOOKUP (AVERAGE, MAX, MIN)
LOOKUP AND SUM - look up in array and sum associated values
VLOOKUP and SUMIF - sum values that meet certain criteria
Excel VLOOKUP and SUM - find the sum of matching values
If you work with numerical data in Excel, quite often you have not just to extract associated
values from another table but also sum numbers in several columns or rows. To do this, you can
use a combination of the SUM and VLOOKUP functions as demonstrated below.
Suppose, you have a product list with sales figures for several months, a column per each
month.

Source data - Monthly Sales:

Now, you want to make a summary table with the total sales for each product.
The solution is to use an array in the 3rd parameter (col_index_num) of the Excel VLOOKUP
function. Here is a sample VLOOKUP formula:
=SUM(VLOOKUP(lookup value, lookup range, {2,3,4}, FALSE))
As you see, we use an array {2,3,4} in the third argument to perform several lookups within the
same VLOOKUP formula in order to get the sum of values in columns 2,3 and 4.
And now, let's adjust this combination of VLOOKUP and SUM functions for our data to find the
total of sales in columns B - M in the above table:
=SUM(VLOOKUP(B2, 'Monthly sales'! $A$2:$M$9,
{2,3,4,5,6,7,8,9,10,11,12,13}, FALSE))
Important! Since you are building an array formula, be sure to hit Ctrl + Shift + Enter instead of
a simple Enter keystroke when you finished typing. When you do this, Microsoft Excel encloses
your formula in curly braces like this:
{=SUM(VLOOKUP(B2, 'Monthly sales'!$A$2:$M$9,
{2,3,4,5,6,7,8,9,10,11,12,13}, FALSE))}

If you press the Enter key as usual, only the first value in the array will get processed, which will
produce incorrect results.

Tip. You may be curious why the formula displays [@Product] as the lookup value in the
screenshot above. This is because I converted my data to table (Insert tab > Table). I find it very
convenient to work with fully-functional Excel tables rather than mere ranges. For example,
when you type a formula into one cell, Excel automatically copies it across the entire column
and in this way saves you a few precious seconds :)
As you see, using the VLOOKUP and SUM functions in Excel is easy. However, this is not the
ideal solution, especially if you are working with big tables. The point is that using array formulas
may adversely affect the workbook's performance since each value in the array makes a
separate call of the VLOOKUP function. So, the more values you have in the array and the
more array formulas you have in your workbook, the slower Excel works.
You can bypass this problem by using a combination of the INDEX and MATCH functions
instead of SUM and VLOOKUP, and I will show you a few formula examples in the next article.
Download this VLOOKUP and SUM sample.
How to perform other calculations with Excel VLOOKUP function
A moment ago we discussed an example of how you can extract values from several columns in
the lookup table and calculate the sum of those values. In the same fashion, you can perform
other mathematical calculations with the results returned by the VLOOKUP function. Here are a
few formula examples:
Operatio
n

Formula example

Description

Calculate
average

{=AVERAGE(VLOOKUP(A2,
'Lookup Table'$A$2:$D$10,
{2,3,4}, FALSE))}

The formula searches for the value


of cell A2 in 'Lookup table' and
calculates the average of values in
columns B,C and D in the same row.

Find
maximum
value

{=MAX(VLOOKUP(A2, 'Lookup
Table'$A$2:$D$10, {2,3,4},
FALSE))}

The formula searches for the value


of cell A2 in 'Lookup table' and finds
the max value in columns B,C and D
in the same row.

Find
minimum
value

{=MIN(VLOOKUP(A2, 'Lookup
Table'$A$2:$D$10, {2,3,4},
FALSE))}

The formula searches for the value


of cell A2 in 'Lookup table' and finds
the min value in columns B,C and D
in the same row.

Calculate
% of sum

{=0.3*SUM(VLOOKUP(A2,
'Lookup Table'$A$2:$D$10,
{2,3,4}, FALSE))}

The formula searches for the value


of cell A2 in 'Lookup table', sums
values in columns B,C and D in the
same row, and then calculates 30%
of the sum.

Note. Since all of the above formulas are array formulas, remember to press Ctrl+Shift+Enter to
enter them correctly in a cell.
If we add the above formulas to the 'Summary Sales' table from the previous example, the result
will look similar to this:

Download this VLOOKUP calculations sample.


LOOKUP AND SUM - look up in array and sum matching values
In case your lookup parameter is an array rather than a single value, the VLOOKUP function is
of no avail because it cannot look up in data arrays. In this case, you can use Excel's LOOKUP
function that is analogues to VLOOKUP but works with arrays as well as with individual values.
Let's consider the following example, so that you can better understand what I'm talking about.
Suppose, you have a table that lists customer names, purchased products and quantity (Main
table). You also have a second table containing the product prices (Lookup table). Your task is

to make a formula that finds the total of all orders made by a given customer.

As you remember, you cannot utilize the Excel VLOOKUP function since you have multiple
instances of the lookup value (array of data). Instead, you use a combination of SUM and
LOOKUP functions like this:
=SUM(LOOKUP($C$2:$C$10,'Lookup table'!$A$2:$A$16,'Lookup table'!
$B$2:$B$16)*$D$2:$D$10*($B$2:$B$10=$G$1))
Since this is an array formula, remember to press Ctrl + Shift + Enter to complete it.

And now, let's analyses the formula's ingredients so that you understand how each of the
functions works and can to tweak it for your own data.
We'll put aside the SUM function for a while, because its purpose is obvious, and focus on the 3
components that are multiplied:
1. LOOKUP($C$2:$C$10,'Lookup table'!$A$2:$A$16,'Lookup table'!
$B$2:$B$16)

This LOOKUP function looks up the goods listed in column C in the main table, and returns the
corresponding price from column B in the lookup table.
2. $D$2:$D$10
This component returns quantity of each product purchased by each customer, which is listed in
column D in the main table. Multiplied by the price, which is returned by the LOOKUP function
above, it gives you the cost of each purchased product.
3. $B$2:$B$10=$G$1
This formula compares the customers' names in column B with the name in cell G1. If a match
is found, it returns "1", otherwise "0". You use it simply to "cut off" customers' names other than
the name in cell G1, since all of us know that any number multiplied by zero is zero.
Because our formula is an array formula it iterates the process described above for each value
in the lookup array. And finally, the SUM function sums the products of all multiplications.
Nothing difficult at all, it is?
Note. For the LOOKUP formula to work correctly you need to sort the lookup column in your
Lookup table in ascending order (from A to Z). If sorting is not acceptable on your data, check
out an awesome SUM / TRANSPOSE formula suggested by Leo.
Download this LOOKUP and SUM sample.
VLOOKUP and SUMIF - look up & sum values that meet certain criteria
Excel's SUMIF function is similar to SUM we've just discussed in the way that it also sums
values. The difference is that the SUMIF function sums only those values that meet the criteria
you specify. For example, the simplest SUMIF formula =SUMIF(A2:A10,">10") adds the
values in cells A2 to A10 that are larger than 10.
This is very easy, right? And now let's consider a bit more complex scenario. Suppose you have
a table that lists the sales persons' names and ID numbers (lookup table). You have another
table that contains the same IDs and associated sales figures (main table). Your task is to find
the total of sales made by a given person by their ID. At that, there are 2 complicating factors:

The mail table contains multiple entries for the same ID in a random order.
You cannot add the "Sales person names" column to the main table.

And now, let's make a formula that, firstly, finds all sales made by a given person, and secondly,
sums the found values.
Before we start on the formula, let me remind you the syntax of the SUMIF function:

SUMIF(range, criteria, [sum_range])


range - this parameter is self-explanatory, simply a range of cells that you want to
evaluate by the specified criteria.
criteria - the condition that tells the formula what values to sum. It can be supplied in
the form of a number, cell reference, expression, or another Excel function.
sum_range - this parameter is optional, but very important to us. It defines the range
where the corresponding cells' values shall be added. If omitted, Excel sums the values of cells
that are specified in the range argument (1st parameter).
Keeping the above info in mind, let's define the 3 parameters for our SUMIF function. As you
remember, we want to sum all the sales made by a given person whose name is entered in cell
F2 in the main table (please see the image above).
1. Range - since we are searching by sales person ID, the range parameter for our SUMIF
function is column B in the main table. So, you can enter the range B:B, or if you convert you
data to a table, you can use the column's name instead: Main_table[ID]
2. Criteria - because we have sales persons' names in another table (lookup table), we have to
use the VLOOKUP formula to find the ID corresponding to a given person. The person's name
is written in cell F2 in the main table, so we look it up using this
formula: VLOOKUP($F$2,Lookup_table,2,FALSE)
Of course, you could enter the name in the lookup criteria of your VLOOKUP function, but using
an absolute cell reference is a better approach because this creates a universal formula that
works for any name input in a given cell.

3. Sum range - this is the easiest part. Since our sales numbers are in column C named
"Sales", we simply put Main_table[Sales].
Now, all you need is to assemble the formula's parts and your SUMIF + VLOOKUP formula is
ready:
=SUMIF(Main_table[ID],VLOOKUP($F$2,Lookup_table,2,FALSE),Main_table[Sa
les])

Download this VLOOKUP and SUMIF sample.


Formula-free way to do vlookup in Excel
Finally, let me introduce you the tool that can look up, match and merge your tables without any
functions or formulas. The Merge Tables Wizard add-in was designed and develop as a timesaving and easy-to-use alternative to Excel's VLOOKUP and LOOKUP functions, and it can be
very helpful both to beginners and advanced users.

Instead of figuring out formulas, you simply specify your main and lookup tables, define a
common column or columns, and tell the wizard what data you want to fetch.

Then you allow the wizard a few seconds to look up, match and deliver you the results. If you
think this add-in may prove helpful in your work, you are most welcome to download a trial
version : )

Advanced VLOOKUP formula examples: nested vlookup with multiple criteria, two-way
lookup
In this second part of our Excel VLOOKUP tutorial, we will explore a few examples that will help
you harness the power of VLOOKUP to cope with the most challenging Excel tasks. The
samples imply that you know the basics of how this Excel function works. If not, you might want
to start with Part 1 that explains VLOOKUP syntax and general usages.
Well, let's have a closer look at the following VLOOKUP formula examples:

How to do a vlookup with multiple criteria in Excel


Get 2nd, 3rd occurrence of the lookup value
Get all duplicate occurrences of the lookup value
Two-dimensional lookup (based on row and column values)
Multiple vlookups in one formula (nested vlookup)
VLOOKUP and INDIRECT to dynamically pull data from different sheets
Excel vlookup with multiple criteria
The Excel VLOOKUP function is really great when it comes to searching across a database for
a certain value. However, it lacks an important feature - its syntax allows for one lookup value
only. But what if you want to look up by several conditions? The solution follows below : )
Example 1. Look up with 2 different criteria
Suppose you have a list of orders and you want to find the Qty. based on 2 criteria - "Customer
Name" and "Product". A complicating factor is that each customer ordered multiple products, as
you see in the table below:

A usual VLOOKUP formula won't do in this scenario, because it returns the first found value
matching the lookup value you specify. So, if you want to know the quantity of "Sweets" ordered

by "Jeremy Hill" and you write the formula =VLOOKUP(B1,$A$5:$C$14,3,FALSE), it will


bring you "15" corresponding to "Apples" since this is the first match.
An easy workaround is creating an additional column that concatenates all the criteria you want,
the Customer and Product columns in this sample. Remember, the concatenated column should
always be the left-most column in your lookup range because this is where Excel VLOOKUP
always searches for the lookup value.
So, you add a helper column to your table and copy a formula like this =B2&C2 across that
column (or =B2&" "&C2 if you want to separate the concatenated values with a space to make
the data more readable).
And then, you can use a simple VLOOKUP formula similar to this:
=VLOOKUP("Jeremy Hill Sweets",$A$5:$C$14,3,FALSE)
or
=VLOOKUP(B1,$A$5:$C$14,3,FALSE)
Where cell B1 contains your concatenated lookup value (lookup_value) and 3 is the number
of the column containing the data you want to find (col_index_num).

Example 2. Vlookup with 2 criteria from a different worksheet


If you need to update your main table by pulling data from another table (different worksheet or
workbook), then you can concatenate the lookup values directly in the formula that you enter in
your main table.
The same as in the example above, you will need to add a helper column to your lookup table
with concatenated lookup values and this should be the left-most column of the lookup range.

So, your VLOOKUP formula may look like this:


=VLOOKUP(B2&" "&C2,Orders!$A&$2:$B$2,4,FALSE).
Where columns B and C contain the customer names and product names, respectively, and
Orders!$A&$2:$B$2 is your lookup table in another worksheet.
Tip. To make the formula easier-to-read, you can create a named range for the lookup table,
and your formula will get simplified to this: =VLOOKUP(B2&" "&C2,Orders,4,FALSE)

Note. For the formula to work, the left-most column of your lookup table must contain the look
up values concatenated exactly as in your lookup criteria. As you see in the screenshot above,
we concatenated values with a space in the lookup table, so we do the same in the lookup
criteria of the VLOOKUP formula (B2&" "&C2).
Also, please remember about Excel VLOOKUP's limit of 255 characters. The VLOOKUP
function cannot search for a lookup value containing more than 255 chars. So, keep this number
in mind and make sure the total length of your lookup criteria does not exceed this limit.
I agree that adding an additional column is not a very elegant solution and is not always
acceptable. You can actually do without the "helper column", but in this case you would need a
far more complex formula with a combination of INDEX and MATCH functions.
Download this sample (VLOOKUP with multiple criteria).

How to use VLOOKUP to get 2nd, 3rd, 4th, etc. matching values
As you already know, Excel VLOOKUP can fetch only one matching value, more precisely, the
first found item. But what if there are several matches in your lookup array and you want to get
the 2nd or 3rd occurrence? Moreover, what if you want to pull all matching values? The task
sounds quite intricate, but the solution does exist!
Suppose, you have customer names in one column and the products they purchased in another.
And now, you want to find the 2nd, 3rd, or 4th product purchased by a given customer.
The simplest way is to add a helper column before the Customer Names column and populate it
with the customer's name and occurrence number, e.g. "John Doe1", "John Doe2" etc. The
following COUNTIF formula does the trick (assuming that the customer names are in column B):
=B2&COUNTIF($B$2:B2,B2)

After that, you can use a usual VLOOKUP formula to find the corresponding order. For example:

Find the 2nd product purchased by Dan Brown:


=VLOOKUP("Dan Brown2",$A$2:$C$16,3,FALSE)
Find the 3rd product purchased by Dan Brown:
=VLOOKUP("Dan Brown3",$A$2:$C$16,3,FALSE)

Naturally, you can enter a cell reference instead of text in the lookup value, as you see in the
screenshot below:

If you are looking for the 2nd occurrence only, you can do without the helper column by creating
a more complex VLOOKUP formula:
=IFERROR(VLOOKUP($F$2,INDIRECT("$B$"&(MATCH($F$2,Table4[Customer
Name],0)+2)&":$C16"),2,FALSE),"")
In the formula:

$F$2 - the cell with the customer name (it is constant, please notice the absolute cell
references);
$B$ - the "Customer Names" column;
Table4 - your table (this can also be a usual range);
$C16 - the last cell of your table or a range.

Note. This formula finds the second matching value only. If you have to get other occurrences,
please proceed with the previous solution.

Download this sample (VLOOKUP to get 2nd, 3rd, 4th, etc. matching values).
If you want to get the list of all matching values, the VLOOKUP function cannot help, because it
can return only one value at a time, alas. But Excel's INDEX function can handle this scenario
and I will show you the formula in the next example.
How to get all duplicate values in the lookup range
As mentioned above, the Excel VLOOKUP function cannot get duplicate instances of the lookup
value. To do this, you would need a far more complex array formula consisting of several Excel
functions such as INDEX, SMALL and ROW.
For instance, the below formula finds all instances of the value in cell F2 in the lookup range
B2:B16, and returns values from column C in the same rows:
{=IFERROR(INDEX($C$2:$C$16, SMALL(IF($F$2=B2:B16, ROW(C2:C16)-1,""),
ROW()-3)),"")}
Copy the below formula to several adjacent cells, e.g. cells F4:F8 as demonstrated in the
screenshot below. The number of cells where you copy the formula should be equal to or larger
than the maximum number of possible duplicate entries. Also, remember to press Ctrl + Shift +

Enter to enter an array formula correctly.

If you are curious to know the underlying logic, let's drill down into the formula a bit:
Part 1. IF($F$2=B2:B16,ROW(C2:C16)-1,"")
$F$2=B2:B16 - compares the value in cell F2 with each value in the range B2:B16. If a match
is found, ROW(C2:C16)-1 returns the number of the corresponding row (-1 is used to deduct
the header row). If the compared values do not match, the IF function returns an empty string.
The result of the IF function is the following array {1, "", 3, "", 5, "", "", "", "", "", "",12, "", "", ""}
Part 2. ROW()-3
In this case, the ROW function acts as an incremental counter. Since the formula is copied into
cells F4:F9, we add -3 for the function to return 1 for cell F4 (row 4 minus 3), 2 for cell F5 (row 5
minus 3), etc.
Part 3. SMALL(IF($F$2=$B$2:$B$16,ROW($C$2:$C$16)-1,""),ROW()-3))
The SMALL function returns the k-th smallest value in a data set. In our case, the position (from
the smallest) to return is defined by the ROW function (Part 2). So, for cell F4, the function
SMALL({array},1) returns the 1st (smallest) element of the array, i.e. 1. For cell F5, it returns the
2nd smallest element of the array, which is 3, and so on.

Part 4. INDEX($C$2:$C$16, SMALL(IF($F$2=$B$2:$B$16, ROW($C$2:$C$16)1,""), ROW()-3))


The INDEX function simply returns the value of a specified cell in the array C2:C16. For cell
F4, INDEX($C$2:$C$16,1) returns "Apples"; for cell F5, INDEX($C$2:$C$16,3) returns
"Sweets", etc.
Part 5. IFERROR()
Finally, we wrap the formula in the IFERROR function, because you would hardly want to see
N/A error messages in your worksheet when the number of cells where you've copied the
formula is fewer than the number of duplicate occurrences of the lookup value.
Download this sample (Get all duplicate values in the lookup range).
How to do two-way lookup in Excel
Performing 2-dimensional lookup in Excel means to search for a value based on a column and
row value. In other words, you look up a value at the intersection of a certain row and column.
So, let's use our 'Monthly Sales' table again and write a VLOOKUP formula that finds how many
lemons were sold in March.

You can do two-way lookup in a few different ways. So, look through the possible alternatives
below and choose your winner : )
VLOOKUP & MATCH functions
You can use a liaison of the VLOOKUP and MATCH functions to cross-reference two fields in a
database, Product (row) and Month (column) in this example:
=VLOOKUP("Lemons",$A$2:$I$9,MATCH("Mar",$A$1:$I$1,0),FALSE)
The formula above is a usual Excel VLOOKUP function that searches for the exact match of
"Lemons" in cells A2 through I9. But, since you do not know in which exactly column March's
sales are, you cannot supply the column number in the third argument of your VLOOKUP
formula. Instead, you use the MATCH function to find that column.

Translated into plain English, the function MATCH("Mar",$A$1:$I$1,0)means:

Look up "Mar" (lookup_value argument).


Search in cells A1 to I1 (lookup_array argument).
Return the exact match (match_type argument). By using "0" in the 3rd parameter, you
tell the MATCH function to find the first value that is exactly equal to the lookup value. You can
regard it as an equivalent of the False parameter in VLOOKUP.
This is how you create a lookup formula with two criteria in Excel, which is also known as a twoway, or two-dimensional lookup.
SUMPRODUCT function
The SUMPRODUCT function multiplies the components in the given arrays, and returns their
sum:
=SUMPRODUCT(($A$2:$A$9="Lemons")*($A$1:$I$1="Mar"),$A$2:$I$9)
INDEX & MATCH functions
In will explain these functions in full detail in the next article, so you can simply grab the formula
for now :
=INDEX($A$2:$I$9,MATCH("Lemons",$A$2:$A$9,0),MATCH("Mar",$A$1:$I$1,0))
Named Ranges & SPACE (intersection operator)
If you are not particularly fond of all those complex Excel formulas, you may like this visual and
easy-to-remember way:
1. Select you table, switch to the Formulas tab and click Create from Selection.
2. Select the "Top row" and "Left column options. Microsoft Excel will create names from the
values in the top row and left-most column of your selection, and you will be able to look up
those names directly instead of making up a formula.

3. In any empty cell, type =row_value column_value, e.g. =Lemons Mar, or vice versa =Mar
Lemons.
Please remember to separate your row value and column value with a space, which acts as
theintersection operator in this case.
As you type, Microsoft Excel will display a list of matching names, exactly as it does when you
start typing a formula.

4. Press the Enter key and verify the result.


All in all, whichever method you choose, the result of your two-dimensional lookup will be the
same:

Download this sample (2-way VLOOKUP).


How to do multiple vlookups in one formula (nested vlookup)
Sometimes it may happen that your main table and lookup table do not have a single column in
common, which prevents you from doing a normal vlookup. However, there exists another table,
which does not contain the information you are looking for, but has one common column with
your main table and another common column with your lookup table.
Let's consider the following example. You have the main table with a single column, New
SKU, and you need to pull the corresponding prices from another table. Also, you have 2 lookup
tables - the first contains the same New SKU numbers and product names, while the other lists

the product names, prices, but the Old SKU numbers.

To pull the prices from Lookup table 2 to the Main table, you have to perform what is known as
Excel's double vlookup, or nested vlookup.
1. Create a VLOOKUP formula that finds the product name in "Lookup table 1", using a new
SKU as the lookup value:
=VLOOKUP(A2,New_SKU,2,FALSE)
Where 'New_SKU' is a named range for $A:$B in "Lookup table 1", and "Lookup table 2", is
column B containing the products names (please see the image above).
2. Write the formula to pull the prices from "Lookup table 2", based on the product's name, by
nesting the above vlookup function in the lookup criteria:
=VLOOKUP(VLOOKUP(A2,New_SKU,2,FALSE),Price,3,FALSE)
Where 'Price' is a named range $A:$C in Lookup table 2, and 3 is column C containing the
prices.

The screenshot below shows the result returned by our nested vlookup formula:

Download this sample (nested VLOOKUP).


Use VLOOKUP and INDIRECT to dynamically pull data from different sheets
To begin with, let's define what exactly "dynamically pull data from different sheets" means to
make sure we are on the same page : )
In some cases, you may have data in the same format split over multiple spreadsheets and
each time you want to pull matching data from a specific sheet depending on what value is
entered in a given cell. I think this will be easier to understand from an example.

Suppose, you have a few regional sales reports for the same products in the same format, and
you want to find the sales number for a certain region:

If you have just a couple of regional reports, you can use a fairly simple VLOOKUP formula with
anIF function to select the correct sheet for vlookup:
=VLOOKUP($D$2,IF($D3="FL",FL_Sales,CA_Sales),2,FALSE)
Where:

$D$2 is a cell containing the "Product Name". Note that we use absolute cell references
in this case to prevent the lookup value from changing when copying the formula to other cells.
$D3 is a cell with the state name (use an absolute column reference and relative row if
you plan to copy the formula to other cells in the same column).
FL_Sales and CA_Sales are the table names, or named ranges, for corresponding sales
reports. You can also use worksheets names and usual cell ranges, e.g. 'FL Sheet'!$A$3:$B$10,
but using named ranges is much more convenient.

However, if you have multiple lookup tables, the IF function is not the ideal solution. Instead, you
can use the INDIRECT function to return the required lookup range.
As you probably know, the Excel INDIRECT function is used to indirectly reference a cell, and
this is exactly what we need now. So, go ahead and replace the IF statement with the
INDIRECT reference in the above formula. The following combination of VLOOKUP and
INDIRECT works a treat in our case:
=VLOOKUP($D$2,INDIRECT($D3&"_Sales"),2,FALSE)
Where:

$D$2 is the cell containing the product name, it always remains constant due to the
absolute row and column references.
$D3 is the cell containing the first state name, FL in our case.
"_Sales" is the common part of your range names, or table names. Concatenated with
the value in cell D3 it makes the full name of the required range. Below I'll provide some more
details for those who do not have much experience with Excel's INDIRECT function.
INDIRECT & VLOOKUP - how it works
First off, let me remind you the syntax of the INDIRECT function: INDIRECT(ref_text, [a1])
The first parameter can be a cell reference of the A1-style or R1C1-style, a range name, or a
text string. The second parameter specifies what type of reference is contained in ref_text - A1style (TRUE or omitted) or R1C1-style (FALSE). It is A1 in our case, so we can omit the second
parameter and focus solely on the first one.
Now, let's get back to our sales reports. As you remember, each report is a separate table
residing in a separate sheet. For the formula to work, you need to name your tables or ranges,
and all of the names should have some common part. For example, my sales reports are
named: CA_Sales, FL_Sales, TX_Sales etc. As you see, there is always the _Sales part.
So, our INDIRECT function INDIRECT($D3&"_Sales") concatenates the value in column D and
the word _Sales (with an underscore), and tells the VLOOKUP function in which exactly table to
look up. That is, if you have FL in cell D3, the formula will search in the FL_Sales table, if CA - in
CA_Sales table, and so on.
The result produced by your VLOOKUP and INDIRECT functions will look similar to this:

If your data reside in different workbooks, you will have to add a workbook name before the
named region (WorkbookName!NamedRange), for example:
=VLOOKUP($D$2,INDIRECT($D3&"Workbook1!_Sales"),2,FALSE)
Note. If the INDIRECT function refers to another workbook, that workbook must be open. If the
source workbook is not open, your INDIRECT formula will return the #REF! error.
Download this sample (VLOOKUP and INDIRECT).
Merge Tables Wizard - a visual way to do vlookup in Excel
If you are not an avid fan of complex Excel formulas and you'd rather save our energies for
occupations more interesting than making your way through the arcane twists of lookup criteria
and arrays, you may find this merging tool really helpful.
Instead of writing formulas, the Merge Tables Wizard will ask you to supply your main table and
lookup table, specify a common column or columns, and point out what info you want to update
or add to the end of the main table.

Then you click Next and allow the Merge Tables Wizard a few seconds to look up, match and
deliver the result. If you think you may like this add-in, you are most welcome to download a trial
version : )

How to create waterfall chart in Excel (bridge chart)


If you use Excel quite often, you know firsthand about the benefits of charts. Graphical
representation of your data turns to be very helpful when you want to make a comparison or
pinpoint a trend at a glance.
Microsoft Excel has lots of predefined chart types, including column, line, pie, bar, radar, etc. In
this article we will go above and beyond creating basic graphs and have a closer look at a
special chart type - the Waterfall chart in Excel. You will find out what a waterfall chart is and
how helpful it can be. You will know the secret of creating a waterfall chart in Excel 2010 - 2013
and learn about different utilities that can do it for you in a minute.
So let's start brushing up on your Excel skills! J

What is a Waterfall chart in Excel?


How to build an Excel bridge chart
Add-ins for creating waterfall charts

What is a Waterfall chart in Excel?


First let's see how a simple waterfall chart should look and when it can come in handy.
A waterfall chart is actually a special type of Excel column chart. It is normally used to
demonstrate how the starting position either increases or decreases through a series of
changes.

The first and the last columns in a typical waterfall chart represent total values. The intermediate
columns appear to float, and show positive or negative change from one period to another,
ending up in the final total value. As a rule, these columns are color-coded for distinguishing
positive and negative values. A bit further in this article you'll know a trick how to make the
intermediate columns float.
A waterfall chart is also known as an Excel bridge chart since the floating columns make a socalled bridge connecting the endpoints.
These charts are quite useful for analytical purposes. If you need to evaluate a company profit
or product earnings, make an inventory or sales analysis or just show how the number of your
Facebook friends changed during that year, a waterfall chart in Excel is just what you need.

How to build an Excel bridge chart


Don't waste your time on searching a waterfall chart type in Excel, you won't find it there. The
problem is that Excel doesn't have a built-in waterfall chart template. However, you can easily
create your own version by carefully organizing your data and using a standard Excel Stacked
Column chart type.

Rearrange the data table


Insert formulas
Create a standard Stacked Column chart
Transform the column graph into a waterfall chart
Format Excel bridge chart
Let's create a simple sample table with positive and negative values to understand the things
better. I'll take the sales amount as an example. If you look at the table below, you'll see that the
sales grow during some months, and they fall during others as compared to the starting

position.

Excel bridge chart will be a perfect way to visualize the sales flow over twelve months. But if you
apply a Stacked Column chart template to these particular values now, you'll get nothing similar
to a waterfall chart. So the first thing you should do is carefully rearrange your data.
Step 1: Rearrange the data table
You start with inserting three additional columns in your Excel table. Let's call them Base, Fall
and Rise. The Base column will be a calculated amount that is used as a starting point for the
Fall and Rise series in the chart. All the negative numbers from the Sales Flow column will be

placed in theFall column and all the positive numbers will be in the Rise column.

I've also added the End row at the bottom of the Month list to calculate the sales amount for the
whole year. Now move to the next step and fill in these columns with the necessary values.

Step 2. Insert formulas


The best way to complete the table is entering special formulas in the first cells in the
corresponding columns and then copy them down to the adjacent cells using the fill handle.
1. Select cell C4 in the Fall column and enter the following formula there: =IF(E4<=0, -E4,0)
The formula says that if the value in cell E4 is less or equal to zero, the negative number will be
shown as positive and the positive number will be displayed as zero.
Note. If you want all the values in a waterfall chart lie above zero, you need to enter the minus
sign ( - ) before the second cell reference (E4) in the formula. And two minuses will make a plus.

2. Copy the formula down to the end of the table.

3. Click on cell D4 and type in =IF(E4>0, E4,0).


It means if the value in cell E4 is greater than zero, all the positive numbers will be displayed as
positive and the negative ones as zero.

4. Use the fill handle to copy this formula down the column.

5. Insert the last formula =B4+D4-C5 in cell B5 and copy it down; include the End row.

This formula calculates base values that will prop up the rises and falls to the appropriate
height.
Step 3. Create a standard Stacked Column chart
Now your data are well-organized and you are ready to build the chart itself.
1. Select your data including the column and row headers, exclude the Sales Flow column.
2. Go to the Charts group on the INSERT tab.

3. Click on the Insert Column Chart icon and choose Stacked Column from the drop-down list.

The graph appears in the worksheet, but it hardly looks like a waterfall chart. Take the next step
and turn the stacked column graph into Excel bridge chart.

Step 4. Transform the column graph into a waterfall chart


The time has come to know the secret. You just need to make the Base series invisible to get a
waterfall chart from a stacked column.
1. Click on the Base series to select them, right-click and choose the Format Data
Series... option from the context menu.

The Format Data Series pane immediately appears to the right of your worksheet in Excel 2013.
2. Click on the Fill & Line icon.

3. Select No fill in the Fill section and No line in the Border section.

When the blue columns become invisible, just delete Base from the chart legend to completely
hide all the traces of the Base series.

Step 5. Format Excel bridge chart


Let's finish up with a little formatting. First I will make the flying bricks brighter and highlight the
Start and End values in the chart:
1. Select the Fall series in the chart and go to the FORMAT tab under CHART TOOLS.
2. Click on Shape Fill in the Shape Styles group.

3. Pick the color you want in the drop-down menu.


Here you can also experiment with the column outline or add special effects to them. Just use
theShape Outline and Shape Effects options on the FORMAT tab to make changes.
Then you should do the same trick with the Rise series. As for the Start and End columns, you
need to color-code them individually, but they should be of the same color.

When you are done, the chart should look like the one below:

Note. Alternatively, you can change the color and outline of the columns in the chart by opening
the Format Data Series pane or choosing the Fill or Outline options in the right-click menu.
Then you can remove excess white spaces between the columns to make them stand closer to
one another:
4. Double-click on one of the chart columns to bring up the Format Data Series pane.
5. Change the Gap Width to something smaller, like 15%. Close the pane.

Now the holes in the bridge chart are patched.

When you look at the waterfall chart above, some of the flying bricks seem to be of the same
size. However, when you refer to the data table, you'll see that the represented values are
different. For more accurate analysis I'd recommend to add data labels to the columns.
6. Select the series that you want to label.
7. Right-click and choose the Add Data Labels option from the context menu.

Repeat the process for the other series. You can also adjust the label position, the text font and
color to make the numbers more readable.

Note. If there is an apparent difference in column size and the specifics aren't important, you
can omit the data labels, but then you should add a Y-axis for better data interpretation.
When you are done with labeling the columns, just get rid of unnecessary elements such as
zero values and the legend. You can also change the default chart title to something more
descriptive. Please take a look at one of my previous blog posts how to add titles to Excel
charts.
My waterfall chart is ready! It looks completely different from the commonly used types of charts
and it is very readable, isn't it?

Add-ins for creating waterfall charts


As you can see, it is not difficult at all to manually create a waterfall chart in Excel 2010 and
2013. But if you don't want to mess with rearranging your data, you can use special add-ins that
can do all the work for you.
Jon Peltier offers to use his time-saving Peltier Tech Chart Utility to automatically create
waterfall charts and other custom graphs from raw data. You can choose to make either a
standard Waterfall Chart or a Stacked Waterfall Chart. It is not necessary to enter any formulas,
just select your data, click the Waterfall Chart command in the Ribbon, set a few options, click
OK and Excel bridge graph is ready. In addition to custom charts, the add-in provides you with
different Chart, Data and General Tools to make your work in Excel easier.

You can even create a waterfall chart online and receive it as an Excel file by email. It is
possible thanks to a great waterfall-chart online service. You just need to submit your data,
specify your email address and wait less than a minute while your chart is generated. Then
check your inbox. The waterfall chart is sent to you in an Excel file. You can then change the
title, labels, colors, etc. like in any other Excel chart. However, you cannot change the numeric
data. In this case you will have to create a chart again. You should also follow some rules of

submitting your data if you want your waterfall chart to look as expected.

The more complex chart you want to build, the more complex formulas you have to enter when
rearranging your data. And the chance of getting an error is increasing. In this situation the
Waterfall Chart Creator add-in for Microsoft Excel can help you save your time and effort. With
this add-in you can create, change and update multiple waterfall charts at a time. It allows you

to specify colors, solid or gradient fill, show values and position, and gives you many other
options. You can also customize the default settings and colors for new charts.
Now you've got a collection of waterfall charts in Excel. I hope it won't be a problem for you to
manually create your own version of a bridge graph. Otherwise, you can take advantage of
Excel waterfall chart add-ins.
If you are curious of other means of data visualization, the following articles may also be
interesting for you:

How to make a Gantt chart in Excel 2010 and 2013


What are Excel sparklines and how to insert them to analyze your data
Thank you for reading.

Top 5 Tips For Coding Excel VBA Macros


VBA, Visual Basic for Applications, is the programming language that Excel understands and
although Excel provides an easy to follow macro wizard, using VBA enables you ultimate control
in ensuring the macro performs exactly as you want it to. A macro is simply a set of instructions
and is usually created by letting Excel record the series of instructions that you want it to later
remember and perform automatically. Here are top five tops for coding Excel VBA macros.
Always have a spreadsheet you can play with!
Unfortunately the undo function doesn't work with macros so, while you are initially building it, I
would recommend that you do so on a version of your spreadsheet you are happy to delete later
on. Consider it a first draft and a way to ensure that you test your macro before letting it
potentially weak havoc on your final spreadsheet.
Use pre generated code as your guide
A big time saver and a great way to reduce the chances of making mistakes, use the macro
recorder to record you performing a series of similar steps that you want your coded macro to
perform. Then, view the code generated and use this as your guide to structuring your VBA
code. This can help you in your learning process with VBA but also save time in deciding the
best way to structure your VBA code.
To start recording your macro click on the 'developer' tab and then 'record macro'. This will bring
up a dialogue box asking you to name your macro. As soon as you click 'OK' Excel will bring

recording everything you do as a macro.

When you have completed your macro you need to stop it recording which you do by clicking '
Stop recording'. Next to see the VBA code that you have generated just click on the 'Visual
Basic' button.

Here the macro just asks Excel to select Cell A1, to write Acuity Training in it and then to select
Cell A2.

To avoid errors due to misspelling, always code in lower case letters.


If you have spelt everything correctly, the necessary words will automatically get capitalised
which means that if you find nothing is getting capitalised, you have made some spelling
mistakes. A great way to avoid the potentially long winded process of debugging later on.
Use the Immediate Window
The immediate window enables you to test statements during the debugging process and is a
great tool to see immediate results from your code. You can open it using the shortcut Alt+F11
and then Ctrl+G. It allows you to check the results of your code line by line.

In the example below we are checking what is in cell A1, which we put Acuity Training into
earlier in the article with our macro.

Break your code up into small chunks


The process of breaking code into small chunks is called modularization. It is a great way to
ensure that you can test and debug parts of the code in isolation and enables you to reuse parts
of the code easily.
The great thing about using VBA to create macros is that you do not need to be a programmer
in order to master the process. VBA is commonly used in Excel to automate repetitive tasks but
more importantly, it opens the door to more possibilities than what the user interface offers. It
means that you do not have to only rely on the capabilities that Excel generally hosts but can
instead create your own.
Bio - Hollie Miller
Hollie provides Microsoft VBA training for Acuity Training. In her spare time she loves to go to
the gym and dress making.

How to enable macros in Excel 2010-2013


This tutorial teaches how to enable macros in Excel 2010-2013. You'll also find step-by-step
instructions showing how to disable macros in Excel or turn them on via Message bar and
Backstage view. In addition you'll find a tip to run a macro even if all macros are disabled and
get a link to a piece of code that gets users enable macros in a workbook.
First off, I'd like to share a brief intro to Excel macros and security risk linked to enabling them.
Amacro is a series of commands assembled together and designed to automate frequent
routine tasks in Excel. You can run macros any time to perform certain actions.
Many macros are created using Visual Basic for Applications, or VBA. Lots of Excel users can
record simple macros to streamline their work with spreadsheets. Developers create codes that
are more complicated.
When enabling a macro in Excel that was written by someone else, you need to remember that
it can carry a potential security risk. A person with malicious intent, like hacker, can make a
destructive macro to spread a virus on your PC or network.
Read on to find detailed descriptions of macro settings, steps to enable Excel macros and save
a macro-enabled workbook. You can also click any of the links below to get straight to the point.

How to enable macros in Excel from the Message Bar


Excel - enable macros via the Backstage view
How to always run macros for a trusted worksheet
Adjust macro settings on the Trust Center window
Run a macro even if all macros are disabled
How to save a macro in a workbook
How to disable macros in Excel 2010-2013
Use special code to make users enable macros in a workbook

How to enable macros in Excel from the Message Bar


If you open an Excel document that contains macros, you'll see the yellow Message Bar with a
shield icon and the Enable Content button.
If you are sure, the macros are from a trustworthy source, just press the Enable Content button
on the bar.

The file will be opened as a trusted document and the security warning will disappear.

Excel - enable macros via the Backstage view


You can also enable macros in Excel using the Microsoft Office Backstage view. You can see
the yellow Message Bar if you click the File tab.
1. Click on the File tab.

2. You'll see the yellow Security Warning area. Click Enable Content.

3. You will see 2 features: Enable All Content and Advanced Options. Select Enable All
Content to always make the document's active content available.

The current Excel file will become a trusted document and all macros will be enabled.

How to always run macros for a trusted worksheet


If you create and share workbooks with macros you may want to avoid getting the security
message every time. If you get all your workbooks only from reliable sources, you can choose to
instantly run all macros for all publishers. Below you'll see how to enable all macros in Excel by
default.

1. Go to File -> Options -> Trust Center and press the Trust Center Settings button.

Tip. You can also click on the Trust Center Settings link on the Security Warning.

2. You will see the Trust Center window. Select the Macro Settings option.

3. Select the radio button Enable all macros (not recommended, potentially dangerous code can
run).
From now on all macros will run without warning.
Please note that this setting makes your computer open to viruses. You should be sure you get
all workbooks with macros only from the trusted publishers.

Adjust macro settings on the Trust Center window


You can find all macro settings on the Trust Center window. These settings let you adjust the
way you want to work with macro-enabled workbooks.
Follow the steps from How to always run macros for a trusted worksheet to get the Trust Center
window.
Please see all the macro settings explained below:

Disable all macros without notification. Macros and security alerts regarding them get
turned off.
Disable all macros with notification. If you select this radio button, macros will be
disabled, but security alerts will appear if there are macros in a file. It lets you enable macros in
Excel depending on the source.

Disable all macros except digitally signed macros. In this case, macros are turned
off, security alerts appear and digitally signed by a trusted publisher macros run. If you have not
trusted the publisher, you are offered to enable the signed macro and trust the publisher.
Enable all macros (not recommended, potentially dangerous code can run). All
macros run without warning. Please note that this setting makes your computer open to viruses.
Trust access to the VBA project object model. This checkbox forbids or allows
programmatic access to the Visual Basic for Applications (VBA) object model from an
automation client. This security setting is for the code that computerizes an Office program and
manipulates VBA environment and object model. For automation clients to access the VBA
object model, the user running the code must grant access. You need to tick the check box to
give access.

Run a macro even if all macros are disabled


Say the setting Disable all macros without notification is turned on your PC, but you need to run
certain macro here and now. If you have Excel 2007-2013, you can enable macros even if your
security settings don't allow this. The point is that Excel sees certain locations as trusted zones.
This means if you store your macro-enabled files there, the security check can be omitted and
the macro will run.
Please see the list of these trusted locations below:
Program Files\Microsoft Office\Templates
Program Files\Microsoft Office\Office12\Startup
Program Files\Microsoft Office\Office12\Library
Program Files\Microsoft Office\Office12\XLSTART
You can add any location on your PC to the trusted zone, by following the steps below:

1. In Excel navigate to the File tab -> Options -> Trust Center -> Trust Center Settings ->
Trusted Locations.

2. Click on the Add new location button to see the Microsoft Office Trusted Location dialog box.

3. Click Browse to search for the needed place on your PC.

Note. Before adding any location to trusted, make sure it's really safe since such location can
be attacked by hackers.

How to save a macro in a workbook


Macros need you to save the files in a new macro-enabled workbook format. This type adds
security warning to your file. If you don't choose the correcttype, the command will not be kept.
Below you'll find how to save a macro-enabled Excel document:
1. Navigate to File -> Save As and browse for the necessary location on your PC.

2. Click on the Save as type: arrow and select the Excel Macro-Enabled Workbook from the list
of types.

2. Click Save to keep the results.


If you forget to select the type of Macro Enabled Workbook, you'll get a warning message
notifying that the macro will not be saved:

Click No if you need to keep the macro.

How to disable macros in Excel 2010-2013


Suppose, you only proofread the files and don't need macros enabled on your PC. You get
documents from various sources and prefer to set your security settings to the highest level.
Since some macros can be potentially dangerous, you can disable them all using the Trust
Centeroptions.
1. Follow the steps from How to always run macros for a trusted worksheet to get the Trust
Centerwindow.
2. Select the Disable all macros without notification or Disable all macros with notification radio
button. If you go for the first option, you will not know if there are any macros in the current file.
The second button lets you identify Excel workbooks that contain macros.

Use special code to make users enable macros in a workbook


The code from this article forces a user to enable macros in a workbook. This code hides all
sheets until the macro is enabled. It also adds a warning sheet that alerts the user to run
macros. As soon as a user turns the commands on, the warning sheet is hidden and all other
content is shown.
1. Add the code to your workbook.
2. Create a new sheet named "Warning".
3. Add a message on the worksheet asking the user to re-open the workbook and enable
macros.
4. Finally, save your workbook.
You may also be interested in
Check out Tutorial with Excel examples about Macros for some nice and simple samples to
automate your daily spreadsheet tasks.
If you are starting to learn macros, read How to insert and run VBA code in Excel 2010, 2013 tutorial for beginners.
That's all about enabling and disabling macros in Excel. Hope you've found the information
helpful. Feel free to leave your questions in the comments below. Be happy and excel in Excel!

Excel VLOOKUP tutorial for beginners - syntax and formula examples


This article begins a series covering one of the most useful Excel functions
- VLOOKUP. At the same time, it's one of the most intricate and least understood.
In this VLOOKUP tutorial, I will try to explain the basics in a very plain language to make
the learning curve for an inexperienced user as easy as possible. We will also explore
some formula examples that address the most common usages of VLOOKUP in Excel.

o
o
o
o
o

Excel VLOOKUP - basic description and syntax


VLOOKUP formula examples
How to do vlookup from another worksheet
How to do vlookup from a different workbook
Using a named range or table in VLOOKUP formulas
VLOOKUP formulas with wildcard characters
Exact match vs. approximate match
Excel VLOOKUP - things to remember!
Merge Tables Wizard - quick and easy alternative for Excel VLOOKUP
Excel VLOOKUP function - basic description and syntax
So what is VLOOKUP? To begin with, it is an Excel function : ) What does it do? It
searches for the value you specify and returns a matching value from another column.
More technically, the VLOOKUP function looks up a value in the first column of the
specified range of cells, and returns a value in the same row from another column.
In its common usage, Excel VLOOKUP searches through your lists of data based on the
unique identifier and brings you a piece of information associated with that unique
identifier.
The letter "V" in VLOOKUP stands for "vertical". It is used to differentiate VLOOKUP
from the HLOOKUP function that looks up a value in the top row of an array (H stands
for "horizontal").
The VLOOKUP function is available in all versions of Excel 2013, Excel 2010, Excel
2007, Excel 2003, Excel XP and Excel 2000.
Excel VLOOKUP syntax
The syntax for the VLOOKUP function is as follows:
VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
As you see, the Microsoft Excel VLOOKUP function has 4 parameters, or arguments.
The first three parameters are requited, the last one is optional.

1.

lookup_value - the value to search for.


This can be either a value (number, date or text) or a cell reference (reference to a
cell containing a lookup value), or the value returned by some other Excel function.
For example, the formula =VLOOKUP(40, A2:B15,2) will search for value 40.

Note. If the lookup value is smaller than the smallest value in the first column of your
lookup array, the VLOOKUP function returns the #N/A error.
2.
table_array - two or more columns of data.
Remember, the VLOOKUP function always searches for the lookup value in the first
column of table_array. Your table_array may contain various values such as text,
dates, numbers, or logical values. Values are case-insensitive, meaning that
uppercase and lowercase text are treated as identical.
So, our formula =VLOOKUP(40, A2:B15,2) will search for "40" in cells A2 to A15
because A is the first column of the table_array A2:B15. Hopefully, everything is clear
so far : )
3.

col_index_num - the column number in table_array from which the value in


the corresponding row should be returned.
The left-most column in the specified table_array is 1, the second column is 2, the
third column is 3, and so on.
Well, now you can read the entire formula =VLOOKUP(40, A2:B15,2). The
formula searches for "40" in cells A2 through A15 and returns a matching value from

column B (because B is the 2nd column in the specified table_array A2:B15).

Note. If your col_index_num argument is less than 1, the VLOOKUP formula will
return the #VALUE! error. In case it is greater than the number of columns in
table_array, your function will return the #REF! error.
4.
range_lookup - determines whether you are looking for an exact match
(FALSE) or approximate match (TRUE or omitted). This final parameter is optional
but very important. Further on in this VLOOKUP tutorial, I will provide a few
examples explaining how to correctly make formulas for exact or approximate match.
Excel VLOOKUP examples
I hope the VLOOKUP function is starting to look a bit more familiar to you. Now let's
explore a few examples of using VLOOKUP formulas on real data.
How to do vlookup in Excel from another worksheet
In practice, VLOOKUP formulas are rarely used to find data in the same worksheet.
Most often you will have to look up and pull the matching data from a different sheet.
To do a vlookup from a different Excel sheet, you should enter the worksheet's name
and an exclamation mark in the table_array argument before the range of cells,
e.g. =VLOOKUP(40, Sheet2!A2:B15,2). The formula indicates that the lookup
range A2:B15 is located in Sheet2.
Of course, you don't have to type the sheet's name manually. Simply start typing the
formula and when it comes to the table_array argument, switch to the lookup worksheet
and select the range using a mouse.

The formula you see in the screenshot below searches for the text "Product 1" in
column A (the 1stcolumn of the lookup range A2:B9) in the Prices worksheet:
=VLOOKUP("Product 1",Prices!$A$2:$B$9,2,FALSE)

Please pay attention that you have to enclose a lookup text value in quotes (''") as you
usually do in Excel formulas.
Tip. It is a good idea to always use absolute cell references (with $) in the table_array
parameter of VLOOKUP formulas. In this case, the lookup range will remain constant
when you copy the formula to other cells.
How to do vlookup from a different workbook
To perform vlookup between two different Excel workbooks, you should supply the
workbook's name in square brackets before the worksheet's name.
For example, the below formula will look up value "40" in Sheet2 of
the Numbers.xlsx workbook:
=VLOOKUP(40,[Numbers.xlsx]Sheet2!A2:B15,2)
The easiest way to create an Excel VLOOKUP formula that refers to another workbook
is as follows:
1.

Open both workbooks. This step is not obligatory, but makes it easier to make the
formula because you won't have to type the workbook's name manually. In addition,
it will protect your formulas from accidental misprints.
2.
Start typing your VLOOKUP formula, and for the table_array argument, switch to
the other workbook and select the lookup range there.

In the formula you see in the screenshot below, the lookup workbook
is PriceList.xlsx and the lookup worksheet is Prices.

Once you close the workbook with your lookup table, your VLOOKUP formula will work
anyway, but it will display the full path for the lookup workbook, as shown below:

Note. If either a workbook name or worksheet name contains spaces, you should add
apostrophes around them: =VLOOKUP(40, '[Numbers.xlsx]Sheet2'!A2:B15,2)
How to use a named range or table in VLOOKUP formulas
If you are supposed to use the same lookup range in several VLOOKUP formulas, you
can created a named range for it and type its name directly in the formula instead of the
lookup region (table_array argument).

To create a named range, you simply select the cells and type any name in the Name
box, to the left of the Formula bar.

And now you can write the following VLOOKUP formula to get Product 1's price:
=VLOOKUP("Product 1",Products,2)
Most range names in Excel apply to the entire workbook, so you don't need to specify
the worksheet's name in the table_array argument, even if your lookup range is in a
different worksheet. If it is in another workbook, you have to put the workbook's name
before the named range, for example:
=VLOOKUP("Product 1",PriceList.xlsx!Products,2)
Such formulas are far more understandable, aren't they? Besides, using named ranges
can be a good alternative to absolute cell references. Since a named range doesn't
change when a formula is copied to other cells, you can be sure that your lookup range
will always remain correct.
If you have converted a range of cells into a fully-functional Excel table (Insert
tab > Table), then you can select the lookup range using a mouse, and Microsoft Excel
will automatically add the columns' names (or the table name in case you've selected

the entire table) to the formula:

The complete formula may look similar to this:


=VLOOKUP("Product 1",Table46[[Product]:[Price]],2)
or even =VLOOKUP("Product 1",Table46,2).
As well as named ranges, columns names are constant and your cell references won't
change no matter where the VLOOKUP formula is copied within the same workbook.
Using wildcard characters in VLOOKUP formulas
As well as in many other formulas, you can use the following wildcard characters in the
Excel VLOOKUP function:

Question mark (?) to match any single character, and


Asterisk (*) to match any sequence of characters.
Using wildcard chars in your VLOOKUP formulas may prove really useful in many
cases:

When you do not remember the exact text you are looking for.
When you want to find some word that is part of the cell's contents. Be aware
that the VLOOKUP function searches by the entire content of a cell, as if you selected
the option "Match entire cell content" in the standard Excel Find dialog.
When a lookup column contains extra leading or trailing spaces. If it is the case,
you may rack your brain trying to figure out why the normal formula does not work.
Example 1. Look up text starting or ending with certain characters
Suppose, you want to find a certain customer in the below database. You cannot
remember his surname, but you know it starts with "ack". So, the following VLOOKUP
formula will work a treat:

=VLOOKUP("ack*",$A$2:$C$11,1,FALSE)

Once you are sure you've found the correct name, you can use a similar VLOOKUP
formula to get the sum paid by that customer. You only have to change the
3rd parameter in the formula to the appropriate column number, column C (3) in our
case:
=VLOOKUP("ack*",$A$2:$C$11,3,FALSE)
Here a few more examples of VLOOKUP formulas with wildcard characters:
=VLOOKUP("*man",$A$2:$C$11,1,FALSE) - find the name ending with "man".
=VLOOKUP("ad*son",$A$2:$C$11,1,FALSE) - find the name starting with "ad" and
ending with "son".
=VLOOKUP("?????",$A$2:$C$11,1,FALSE) - find a 5-character last name.
Note. For a wildcard VLOOKUP formula to work correctly, you always have to add
FALSE as the last parameter. If your lookup range contains more than one entry that
meets the wildcard criteria, the first found value will be returned.
Example 2. Wildcard VLOOKUP formulas based on cell's value
And now let's discuss a bit more complex example of how to do a vlookup on the value
in some cell. Suppose, you have license keys in column A and license names in column
B. You also have part (a few characters) of some license key in cell C1 and you want to
find a matching License Name.
This can be done using a VLOOKUP formula like this:

=VLOOKUP("*"&C1&"*",$A$2:$B$12,2,FALSE)
This formula searches for the value in C1 through the specified range and returns a
corresponding value in column B. Please notice that we use an ampersand (&) before
and after a cell reference in the 1st parameter to concatenate a text string.
As you can see in the screenshot below, my VLOOKUP function returns "Jeremy Hill"
because his license key contains the group of chars stated in cell C1:

Also, please pay attention to the table_array argument in screenshot above. It contains
the table name ("Table7") instead of a range of cells, as we discussed in the example
above.
Using VLOOKUP formulas with exact or approximate match
And finally, let's have a closer look at the last argument you supply to the Excel
VLOOKUP function - range_lookup. As already mentioned at the beginning of this
tutorial, this parameter is highly important because you are likely to get different results
in the same formula depending on whether you enter TRUE or FALSE.
First off, let's see what Microsoft Excel actually means by "exact match" and
"approximate match".

If range_lookup is set to FALSE, the formula searches for exact match, i.e. for
the lookup value exactly as you've entered it in the first parameter (lookup_value ).If
there are two or more values in the first column of table_array that match the lookup
value, the 1st value found is returned. If an exact match is not found, the #N/A error is
returned.

For example, if you use the formula =VLOOKUP(4, A2:B15,2,FALSE), but your data
does not contain value 4 in cells A2 through A15, the formula will return #N/A.

If range_lookup is set to TRUE or omitted, the formula searches for approximate


match. More precisely, your VLOOKUP formula will search for an exact match first and
if an exact match is not found, it will return an approximate match. An approximate
match is the next largest value that is less than lookup_value.
Important Note! If you enter TRUE or omit the range_lookup argument, the values in
the first column of the lookup range must be sorted in ascending order, i.e. from
smallest to largest. Otherwise, the Excel VLOOKUP function may not find the correct
value.
To further explore the importance of specifying TRUE vs. FALSE, let's try out a few
more VLOOKUP formulas and see what results they return.
Example 1. How to do a vlookup in Excel with exact match
As you remember, to search for exact match, you have to put FALSE as the final
argument in a VLOOKUP formula in Excel.
Let's take the 'Animal speed' table from the very first example again and find out which
animal can run 50 miles per hour. I believe you won't have any difficulties with the
formula: =VLOOKUP(50,$A$2:$B$15,2,FALSE).

Please note, our lookup range (column A) contains two "50" values in cells A5 and A6;
and the formula returns a value from cell B5. Why is that? Because the VLOOKUP
function with exact match returns the 1st found value that matches the lookup value.
Example 2. Using vlookup in Excel with approximate match
When using VLOOKUP formulas with approximate match, i.e. with range_lookup set to
TRUE or omitted, the first thing you need to do is sort the first column in your lookup
range in ascending order.
This is very important because your VLOOKUP formula is going to return the next
largest value for the lookup value you specify and then stop searching. If you neglect to
sort your data properly, you will end up having really strange results or the #N/A error.

And now you can utilize either of the following formulas:

=VLOOKUP(69,$A$2:$B$15,2,TRUE)
=VLOOKUP(69,$A$2:$B$15,2)

As you see, I am trying to find the animal whose speed is closest to 69 mph. And here's
what the VLOOKUP formula returns:

As you see, the formula returns "Antelope" whose speed is 61mph, while we also have
Cheetah that runs 70 mile per hour, and 70 is much closer to 69 than 61, isn't it? So,
why is that? Because the VLOOKUP function with approximate match returns the next
largest value that is less than the lookup value.
Hopefully, these examples have shed some light on using VLOOKUP in Excel and this
function is not alien to you any longer : ) Now it may be a good idea to sum up the
essentials you have learned to remember the key points better.
Excel VLOOKUP - things to remember!
1.
Excel VLOOKUP function cannot look at its left. It always searches for the lookup
value in theleft-most column of the lookup range (table_array).
2.
In VLOOKUP formulas, all values are case-insensitive, meaning that uppercase
and lowercase characters are treated as equivalent.
3.
If the lookup value is smaller than the smallest value in the first column of your
lookup range, the VLOOKUP function returns the #N/A error.
4.
If the 3rd parameter (col_index_num) is less than 1, the VLOOKUP formula will
return the #VALUE! error. In case it is greater than the number of columns in your
lookup range (table_array), the formula will return the #REF! error.
5.
Use absolute cell references in the table_array argument of your VLOOKUP
formulas to have the correct lookup range when coping the formulas. Consider using
named ranges or Excel tables as an alternative.

6.

When searching with approximate match (range_lookup set to TRUE or omitted),


always have the data in the first column in your lookup range sorted in ascending
order.
7.
And finally, remember about the importance of the final parameter. Supply TRUE
or FALSE when appropriate and you will avoid a lot of headache : )
In the next part of our Excel VLOOKUP tutorial we will explore more advanced
examples such as performing various calculations with VLOOKUP, extracting values
from several columns and more. I thank you for reading and hope to see you next week!
Merge Tables Wizard - quick and easy alternative for Excel VLOOKUP
If your Excel files are enormously large and complex, the project's deadline is imminent,
and you are looking for someone who can lend you a helping hand, try out the Merge
Tables Wizard.
This tool is our visual and stress-free alternative to Excel's VLOOKUP function. You do
not have to invest hours to learn how to use - the smart wizard will comfortably walk you
through the following 4 easy steps:
1.
2.
3.
4.

Select your main table.


Select the lookup table.
Choose one or several common columns as the unique identifier.
Define whether you want to update values in existing columns or/and add new
columns to the end of the table.

Then you wait for a few second while the Merge Tables Wizard is processing your
data... and here you are:

If this looks like a tool that may be helpful in your work, you are welcome to download a
trial version : )
In the next part of our Excel VLOOKUP tutorial we will explore more advanced
examples such as performing various calculations with VLOOKUP, extracting values
from several columns and more. I thank you for reading and hope to see you next week!

How to use Excel COUNTIFS and COUNTIF with multiple criteria


The tutorial explains how to use COUNTIFS and COUNTIF formulas with multiple criteria in
Excel. You will find a number of examples for different data types - numbers, dates, text,
wildcard characters, non-blank cells and more.
Of all Excel functions, COUNTIFS and COUNTIF are probably most often mixed up because
they look very much alike and both are purposed for counting cells based on the specified
criteria.
The difference is that the COUNTIF function is intended for counting cells based on a single
condition in one range, while COUNTIFS allows using several criteria and ranges. In practice,
however, you can use Excel COUNTIF with multiple criteria as well. So, the aim of this tutorial is
to help you figure out the most efficient formula for each particular task.

o
o
o

Excel COUNTIFS function - syntax and usage


How to use COUNTIFS and COUNTIF with multiple criteria (AND and OR logic)
Examples for numbers
Examples for dates
Excel COUNTIFS formulas for text
Excel COUNTIFS function - syntax and usage
As I've already mentioned, the Excel COUNTIFS function is purposed for counting cells across
multiple ranges based on one or several conditions. The COUNTIFS function is available in
Excel 2013, Excel 2010, and Excel 2007, so you can use the below examples in any Excel
version.
COUNTIFS syntax
The syntax of the COUNTIFS function is as follows:

COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2])


criteria_range1 - defines the first range to which the first condition (criteria1)
shall be applied, required.
criteria1 - sets the condition in the form of a number, cell reference, text
string, expression or another Excel function, required. The criteria defines which cells shall be
counted and can be expressed as 10, "<=32", A6, "sweets".
[criteria_range2, criteria2] - these are additional ranges and their
associated criteria, optional. You can specify up to 127 range/criteria pairs in your formulas.
In fact, you don't have to remember the syntax of the COUNTIF function by heart. As well as
with any other formula, Microsoft Excel will display the function's arguments as soon as you
start typing; the argument you are entering at the moment is highlighted in bold.

Excel COUNTIFS - things to remember!


1. You can use the COUNTIFS function in Excel to count cells in a single range by a single
condition as well as in multiple ranges with multiple conditions.
2. Each additional range must have the same number of rows and columns as the first range
(criteria_range1 argument).
3. Both contiguous and non-contiguous ranges are allowed.
4. If the criteria is a reference to an empty cell, the COUNTIFS function treats it as a zero value
(0).
5. You can use the wildcard characters in criteria - asterisk (*) and question mark (?). See this
example for full details.
For the detailed description and syntax of the COUNTIF function, please see this tutorial - Excel
COUNTIF function.
How to use COUNTIFS and COUNTIF with multiple criteria in Excel
Below you will find a number of formula examples that demonstrate how to use the COUNTIFS
and COUNTIF functions in Excel to handle multiple conditions and ranges.
COUNTIFS and COUNTIF (with multiple criteria) for numbers
By and large, COUNTIFS formulas for numbers fall into 2 categories - counting numbers
between the two values you specify, and based on several conditions.
Example 1. Counting numbers between X and Y
You can count how many numbers are between the numbers you specify in two ways - using a
COUNTIFS function or a difference between two COUNTIF functions.
COUNTIFS formula: =COUNTIFS(C2:C10,">5", C2:C10,"<10")

This formula counts how many numbers between 5 and 10 (not including 5 and 10) are
contained in cells C2 through C10.

If you want to count cells based on the same condition but including 5 and 10, add "=" to the
criteria like this: =COUNTIFS(B2:B10,">=5", B2:B10,"<=10")
COUNTIF formulas to count numbers between X and Y:

=COUNTIF(C2:C10,">5")-COUNTIF(C2:C10,">=10") - counts how many numbers


greater than 5 and less than 10 are in the range C2:C10. The formula will produce the same
result as you see in the screenshot above.
=COUNTIF(C2:C10, ">=5")-COUNTIF(C2:C10, ">10") - the formula counts how
many numbers between 5 and 10 are in the range C2:C10, including 5 and 10.
Summing up, you use a combination of two COUNTIF functions in the following way. In the
1stfunction, you count how many numbers are greater than your lower bound value (5 in this
example). In the 2nd function, you count how many numbers are greater than the upper bound
value (10 in our case). The difference between the first and second number is the result you are
looking for.
Example 2. Counting numbers with multiple criteria (AND logic)
Suppose you have a list of products indicating how many items are sold, delivered and in stock.
You can use the following formulas to count the numbers of products, at least one item of which
has been sold and delivered, i.e. if the values in columns B and D are greater than 0:

=COUNTIFS(B2:B11,">0", D2:D11,">0")

Here is one more COUNTIFS formula example with multiple ranges:


=COUNTIFS(B2:B11, 0, C2:C11, 0, D2:D11, 0)
The above formula counts the number of products with zeroes in columns B, C and D. This
COUNTIFS formula returns 1 because only Product 5 have "0" in all the three columns.

Note. You do need to use three separate ranges in the formula, one per column, if you want to
count the products that contain "0" in all the columns. A simpler formula with a single
range =COUNTIFS(B2:D11,"=0") would produce a different result because it returns the total
count of cells containing a zero.
Example 3. How to use cell references in COUNTIFS formulas
Of course, you can use a cell reference instead of a number in Excel COUNTIFS formulas.
Just remember to enclose the operator in quotes ("") and add an ampersand (&) before the cell

reference to construct a text string. For more information about the use of an ampersand in
COUNTIF and COUNTIFS formulas, please see Excel COUNTIF - frequently asked questions.
So, let's make a COUNTIFS formula with a cell reference equivalent to the formula from the
previous example:
=COUNTIFS(B2:B11,"="&C2, C2:C11,"="&C2, D2:D11,"="&C2)
Cell C2 used in the criteria contains a zero value, so the formula will produce exactly the same
result you see in the screenshot above.
Example 4. COUNTIF formulas with OR logic
Examples 2 and 3 above demonstrate how to use COUNTIFS in Excel to count cells based on
several conditions with the AND logic. Such formulas can be applied both to contiguous or noncontiguous ranges. For example, we have used this formula =COUNTIFS(B2:B11,">0",
D2:D11,">0") to find out how many products have a value greater than "0" both in column B
and column D.
But what if you want a total count of cells with a certain value in several non-adjacent ranges or
when at least one of the conditions is met (like OR operator)? For instance, how do you count
the total number of zero values in columns B and D? The answer is to use a combination, more
precisely, a sum of several COUNTIF functions:
=COUNTIF(B2:B11,"=0") + COUNTIF(D2:D11,"=0")

In a similar manner, you can add up several COUNTIFS functions if you want to count
something with the OR logic. For example, the following formula counts the number of rows that
have either "Product1" or "Product2" in column A and 0 in column B:
=COUNTIFS(A2:A11,"Product1", B2:B11, 0) + COUNTIFS(A2:A11,"Product2",
B2:B11, 0)

COUNTIFS and COUNTIF (with multiple criteria) for dates


The COUNTIFS and COUNTIF formulas you use for dates are very much similar to the above
formulas for numbers.
Example 1. Count dates in a specific date range
To count the dates that fall in a certain date range, you can also use either a COUNTIFS
formula with two criteria or a combination of two COUNTIF functions.
For example, the following formulas count the number of dates in cells C2 through C10 that fall
between 1-Jun-2014 and 7-Jun-2014, inclusive:
=COUNTIFS(C2:C9, ">=6/1/2014", C2:C9, "<=6/7/2014")
=COUNTIF(C2:C9, ">=6/1/2014") - COUNTIF(C2:C9, ">6/7/2014")

Example 2. Count dates with multiple conditions


In the same manner, you can use a COUNTIFS formula to count the number of dates in
different columns that meet 2 or more conditions. For instance, the below formula will find out
how many products were purchased after the 20th of May and delivered after the 1st of June:

=COUNTIFS(C2:C9, ">5/1/2014", D2:D9, ">6/7/2014")

Example 3. Count dates with multiple conditions based on the current date
You can use Excel's TODAY() function in combination with COUNTIF to count dates based on
the current date.
For example, the following COUNTIF formula with two ranges and two criteria will tell you how
many products have already been purchased but not delivered yet.
=COUNTIFS(C2:C9, "<"&TODAY(), D2:D9, ">"&TODAY())

This formula allows for many possible variations. For instance, you can tweak it to count how
many products were purchased more than a week ago and are not delivered yet:
=COUNTIFS(C2:C9, "<="&TODAY()-7, D2:D9, ">"&TODAY())

COUNTIFS formulas for text values


In the previous article, I provided an example of Excel COUNTIF formula with two criteria to
count the number of cells with 2 different text values in a single range. Now let's see how you
can use the COUNTIFS function with multiple criteria and across multiple ranges.
Example 1. COUNTIFS for text values
Suppose, you have a table listing the results of the credits and exams passed by students. What
you want to know is how many students have passed all the credits. To do this, you use a usual
COUNTIFS formula with several different ranges and the same criteria:
=COUNTIFS(B2:B7,"=P",C2:C7,"=P",D2:D7,"=P",E2:E7,"=P")

If you want to know how many credits a particular student has passed or not passed, you can
utilize either a COUNTIFS or COUNTIF formula, because this time you need a single range
only.
For example, the below formulas will tell you how many credits Bella has passed:
=COUNTIFS(B3:E3,"=P")

=COUNTIF(B3:E3,"=P")

Example 2. COUNTIFS with wildcard characters


As I mentioned at the beginning of this tutorial, you can use the following wildcard characters in
Excel COUNTIFS formulas:

Question mark (?) - matches any single character, use it to count cells starting and/or
ending with certain characters.
Asterisk (*) - matches any sequence of characters, you use it to count cells containing a
specified word or a character(s) as part of the cell's contents.
Tip. If you want to count cells with an actual question mark or asterisk, type a tilde (~) before the
character in your COUNTIFS formula.
Now let's see how you can use a wildcard char in your real COUNTIFS formulas in Excel.
Suppose, you a list of projects assigned to your company's employees. You want to find how
many projects are already assigned to someone, i.e. any name is stated in column A. And
because we are leaning how to use the COUNTIFS function with multiple criteria, let's add a
second condition - the End Date in column D should also be set.
Here is the formula that works a treat: =COUNTIFS(B2:B10,"*",D2:D10,"<>"&""))
Please note, you cannot use a wildcard character criteria with the second range because you
have dates rather that text values in column D. That is why, you use the criteria that finds non-

blankcells - "<>"&""

Important note! Please remember, when you use an Excel COUNTIFS formula with multiple
ranges, all of the ranges must all be the same size, i.e. have the same number of rows and
columns. Otherwise, your formula will return the #VALUE! error. This applies to all COUNTIFS
formulas in Excel, with any data type - numbers, dates and text.

How to rotate charts in Excel - rotate bar, column, pie and line charts
This post describes how to rotate a chart in Excel 2010-2013. You'll learn different ways to spin
bar, column, pie and line charts including their 3-D variations. Besides, you'll see how to reverse
the plotting order of values, categories, series and legend. Those who often print graphs and
charts will read how to adjust the sheet orientation for printing.
Excel makes it really easy to represent your table as a chart or graph. You just select your data
and click on the icon of the suitable chart type. However, the default settings may not work for
you. If your task is to rotate a chart in Excel to arrange the pie slices, bars, columns or lines in a
different way, this article is for you.

o
o
o
o

Rotate a pie chart in Excel to any angle you like


Rotate 3-D charts in Excel: spin pie, column, line and bar charts
Rotate charts to 180 degrees: change the order of categories, values, or series
Rotate the plotting order of categories in your Excel chart
Reverse the plotting order of values
Flip the plotting order of data series in a 3-D chart
Change the Legend position in a chart
Modify worksheet orientation to better fit your chart
Use the Camera tool to rotate your Excel chart to any angle
Rotate a pie chart in Excel to any angle you like
If you often deal with relative sizes and illustrate proportions of the whole, you are likely to use
pie charts. In my picture below, data labels overlap the title, which makes it look unpresentable.
I am going to copy it to my PowerPoint Presentation about peoples' eating habits and want the
chart to look well-ordered. To fix the issue and emphasize the most important fact, you need to
know how to rotate pie chart in Excel clockwise.

1. Right-click on any slice of your pie chart and select the option Format Data Series from the
menu.

2. You'll get the Format Data Series pane. Go to the Angle of first slice box, type the number of
degrees you need instead of 0 and press Enter. I think 190 degrees will work fine for my pie
chart.

After being rotated my pie chart in Excel looks neat and well-arranged.

Thus, you can see that it's quite easy to rotate an Excel chart to any angle till it looks the way
you need. It's helpful for fine-tuning the layout of the labels or making the most important slices
stand out.
Rotate 3-D charts in Excel: spin pie, column, line and bar charts
I think 3-D charts look awesome. When other people see your 3-D chart, they may believe you
know it all about Excel visualization techniques. If a graph created with the default settings
doesn't look the way you need, you can adjust it by rotating it and changing the perspective.

1. Right-click on your chart and select 3-D Rotation from the menu list.

2. You'll get the Format Chart Area pane with all available settings. Enter the necessary number
of degrees in the X and Y Rotation boxes.

I changed the numbers to 40 and 35 correspondingly to make my chart look slightly deeper.

This pane also lets you adjust Depth and Height, as well as Perspective. Just play with the
options to see which suite best for your type of chart. Feel free to use the same steps for pie
charts as well.
Rotate charts to 180 degrees: change the order of categories, values, or series
If the chart you need to rotate in Excel displays Horizontal and Vertical axes, you can quickly
reverse the order of the categories or values plotted along those axes. Additionally, in 3-D charts
that have a depth axis, you can flip the plotting order of data series so that large 3-D columns do
not block smaller ones. You can also reposition the Legend on your pie or column chart in Excel.

Reverse the plotting order of categories in a chart


You can rotate your chart based on the Horizontal (Category) Axis.

1. Right click on the Horizontal axis and select the Format Axis item from the menu.

2. You'll see the Format Axis pane. Just tick the checkbox next to Categories in reverse order to
see you chart rotate to 180 degrees.

Reverse the plotting order of values in a chart


Follow the simple steps bellow to get the values from the Vertical axis rotated.

1. Right-click on the Vertical (Value) Axis and pick the option Format Axis.

2. Select the checkbox Values in reverse order.

Note. Please remember that it's not possible to reverse the plotting order of values in a radar
chart.
Reverse the plotting order of data series in a 3-D chart
If you have a column or line chart with the third axis, which shows some columns (lines) in front
of others, you can change the plotting order of data series so that large 3-D data markers do not
overlap smaller ones. You can also use the below steps to create two or more charts for
showing all values from the legend.

1. Right-click on the Depth (Series) Axis on the chart and select the Format Axis menu item.

2. You will get the Format Axis pane open. Tick the Series in reverse order checkbox to see the
columns or lines flip.

Change the Legend position in a chart


In my Excel pie chart below, the legend is located at the bottom. I want to get the legend values
on the right to make them more eye-catching.

1. Right click on the Legend and select the Format Legend option.

2. Select one of the checkboxes you will see on the Legend options pane: Top, Bottom, Left,
Right orTop right.

Now I like my chart more.

Modify worksheet orientation to better fit your chart


If you need to just print your chart, it may be enough to modify the worksheet layout without
rotating the chart in Excel. On my screenshot below, you can see that the chart doesn't fit
correctly. By default, worksheets are printed in a portrait orientation (taller than wide). I'm going

to change the layout to a landscape mode for my picture to look correct on the printable.

1. Select the worksheet with your chart for printing.


2. Go to the Page Layout tab and click on the arrow under the Orientation icon. Pick
the Landscapeoption.

Now when I go to the Print Preview window I can see that my chart fits perfectly.

Use the Camera tool to rotate your Excel chart to any angle
You can rotate your chart to any angle using the Camera tool in Excel. It allows you to place the
result next to your original chart or insert the picture to a new sheet.
Tip. If you want to rotate your chart by 90 degrees, it may be a good idea to simply modify the
chart type. For example, from column to bar.

You can add the Camera tool if you go to the Quick Access tool bar and click on the small drop
down arrow. Select the option More Commands

Add Camera by choosing it from the list of all commands and clicking Add.

Now follow the steps below to make the Camera option work for you.
Note. Please remember, it's not possible to place the Camera tool over your chart since the
result is unpredictable.

1. Create your line or any other chart.

2. You may need to flip the alignment of your chart axis to 270 degrees using the Format
Axisoption I described above. Therefore, the labels will be readable when the chart is rotated.

3. Select the range of cells that contain your chart.

4. Click on the Camera icon on the Quick Access toolbar.

5. Click on any cell within your table to create a camera object.

6. Now grab the Rotate control at the top.

7. Rotate your chart in Excel to the needed angle and drop the control.

Note. There is one problem with using the Camera tool. The resulting objects may have a
reduced resolution from the actual chart. They may look grainy or pixelated.
Creating a chart is a really good way to showcase your data. Charts in Excel are easy-to-use,
comprehensive, visual and can be adjusted to look the way you need. Now you know how to
rotate your column, bar, pie or line chart.
Having written all the above I feel like a real chart rotation guru. Hope my article will help you
with your task as well. Be happy and excel in Excel!

Transform your crosstab to list with Unpivot Table for Excel


If you've been searching the web for an easy and flexible way to unpivot data in Excel, you are
in the right place at the right time. Ablebits have just released a new tool for Ultimate Suite. This
little add-in will easily convert your crosstab table to a normalized list.

If you often create summary reports with Excel Pivot Table functionality, sometimes you may
need to turn your crosstab table to list. The point is that many analysis and visualization tools,
like Tableau, or Protovis, don't work with pivoted data. Here you start searching for a VBA macro
or any other possibility to transform your summary table to list. Good news is that you can
simply use Unpivot Table add-in and get the necessary results in seconds.
Unpivot your Excel table in seconds
The Unpivot Table tool is a part of Ultimate Suite by Ablebits. Thus to try it out, please download
and install the latest version of Ultimate Suite to your PC.
When you open Excel, you will see the Unpivot Table icon under the Ablebits Data tab in
theTransform section.

Just open your Pivot Table by clicking on its icon, choose if you want to separate the resulting
parts by an empty row and select the destination for your list. It's possible to place the results to
a new workbook or worksheet.

That's it! Forget the time when you needed to spend hours manipulating and transforming your
spreadsheets. Unpivot Table for Excel will normalize your crosstab list and will prepare it for
further processing with complex visualization

COUNTIF in Excel - count if not blank, greater than, duplicate or unique


Microsoft Excel provides several functions purposed for counting different kinds of cells, such as
blanks or non-blanks, with number, date or text values, containing specific words or character,
etc.
In this article, we will focus on the Excel COUNTIF function that is purposed for counting cells
with the condition you specify. First, we will briefly cover the syntax and general usage, and then
I provide a number of examples and warn about possible quirks when using this function with
multiple criteria and specific types of cells.
In essence, COUNTIF formulas are identical in all Excel versions, so you can use the examples
from this tutorial in Excel 2013, 2010, 2007 and 2003.

o
o
o
o
o
o
o

Excel COUNTIF function - syntax and usage


Examples of how to use COUNTIF in Excel
COUNTIF formula for text and numbers (exact match)
COUNTIF with wildcard characters (partial match)
Count if blank or not blank
Count if greater than, less than or equal to
COUNTIF formulas for dates
Excel COUNTIF with multiple criteria
Count duplicates and unique values
Excel COUNTIF - frequently asked questions and issues
COUNTIF function in Excel - syntax and usage
Excel COUNTIF function is used for counting cells within a specified range that meet a certain
criterion, or condition.
For example, you can write a COUNTIF formula to find out how many cells in your worksheet
contain a number greater than or less than the number you specify. Another typical use of
COUNTIF in Excel is for counting cells with a specific word or starting with a particular letter(s).
The syntax of the COUNTIF function is very simple:
COUNTIF(range, criteria)
As you see, there are only 2 arguments, both of which are required:

range - defines one or several cells to count. You put the range in a formula like you
usually do in Excel, e.g. A1:A20.
criteria - defines the condition that tells the function which cells to count. It can be
a number,text string, cell reference or expression. For instance, you can use the criteria like
these: "10", A2, ">=10", "some text".
And here is the simplest example of Excel COUNTIF function. What you see in the image below
is the list of the best tennis players for the last 14 years. The
formula =COUNTIF(C2:C15,"Roger Federer") counts how many times Roger Federer's

name is on the list:

Note. A criterion is case insensitive, meaning that if you type "roger federer" as the criteria in the
above formula, this will produce the same result.
Excel COUNTIF function examples
As you have just seen, the syntax of the COUNTIF function is very simple. However, it allows for
many possible variations of the criteria, including wildcard characters, the values of other cells,
and even other Excel functions. This diversity makes the COUNTIF function really powerful and
fit for many tasks, as you will see in the examples that follow.
COUNTIF formula for text and numbers (exact match)
In fact, we discussed the COUNTIF function that counts text values matching a specified
criterion exactly a moment ago. Let me remind you that formula for cells containing an exact
string of text: =COUNTIF(C2:C15,"Roger Federer"). So, you enter:

A range as the first parameter;


A comma as the delimiter;
A word or several words enclosed in quotes as the criteria.
Instead of typing text, you can use a reference to any cell containing that word or words and
get absolutely the same results, e.g. =COUNTIF(C1:C9,C7).
Similar COUNTIF formulas work for numbers as well as for text values. As you can see in the
screenshot below, the formula =COUNTIF(D2:D9,5) perfectly counts cells with quantity 5 in

Column D.

COUNTIF formulas with wildcard characters (partial match)


In case your Excel data include several variations of the keyword(s) you want to count, then you
can use a wildcard character to count all the cells containing a certain word, phrase or letters
aspart of the cell's contents.
Suppose, you have a list of tasks assigned to different persons, and you want to know the
number of tasks assigned to Danny Brown. Because Danny's name is written in several different
ways, we enter "*Brown*" as the search criteria =COUNTIF(D2:D10, "*Brown*").

An asterisk (*) is used to find cells with any sequence of leading and trailing characters, as
illustrated in the above example. If you need to match any single character, enter a question
mark (?) instead, as demonstrated below.
Count cells beginning or ending with certain characters
You can use either wildcard character, asterisk (*) or question mark (?), with the criterion
depending on which exactly result you want to achieve.

If you want to know the number of cells that start or end with certain text no matter how many
other characters a cell contains, use these formulas:
=COUNTIF(C2:C10,"Mr*") - count cells that begin with "Mr".
=COUNTIF(C2:C10,"*ed") - count cells that end with the letters "ed".
The image below demonstrates the second formula in action:

If you are looking for a count of cells that start or end with certain letters and contain the exact
number of characters, you use the Excel COUNTIF function with the question mark character
(?) in the criteria:
=COUNTIF(D2:D9,"??own") - counts the number of cells ending with the letters "own" and
having exactly 5 characters in cells D2 through D9, including spaces.
=COUNTIF(D2:D9,"Mr??????") - counts the number of cells starting with the letters "Mr"
and having exactly 8 characters in cells D2 through D9, including spaces.
Tip. To find the number of cells containing an actual question mark or asterisk, type a tilde (~)
before the ? or * character in the formula. For example, =COUNTIF(D2:D9,"*~?*") will count
all cells containing the question mark in the range D2:D9.
Excel COUNTIF for blank and non-blank cells
These formula examples demonstrate how you can use the COUNTIF function in Excel to count
the number of empty or non-empty cells in a specified range.
COUNTIF not blank
In some of other Excel COUNTIF tutorials, you may come across formulas for counting nonblank cells in Excel similar to this one:
=COUNTIF(range,"*")

But the fact is, the above formula counts all cells that contain any text, meaning that cells with
dates and numbers will be treated as blank cells!
If you need a universal COUNTIF formula for counting all non-blank cells in a specified range,
here you go:
=COUNTIF(range,"<>"&"")
This formula works correctly with all value types - text, dates and numbers - as you can see in
the screenshot below.

COUNTIF blank
If you want the opposite, i.e. count blank cells in a certain range, you should adhere to the same
approach - use a formula with a wildcard character for text values or another one (with the ""
criteria) to count all empty cells.
Formula to count cells not containing any text: =COUNTIF(range,"<>"&"*")
Translated into plain English, the criteria used in the above formula ("<>"&"*") means to find
cells not equal to *, i.e. not containing any text in the specified range.
Universal COUNTIF formula for blanks (all value types): =COUNTIF(range,"")
The above formula correctly handles numbers, dates and text values. For example, the
formula =COUNTIF(C2:C11,"") returns the number of all empty cells in the range C2:C11.
Note. Please be aware that Microsoft Excel provides another function for counting blank cells
=COUNTBLANK(range). For instance, the below formulas will produce exactly the same
results as the COUNTIF formulas you see in the screenshot above:
Count blanks: =COUNTBLANK(C2:C11)

Count non-blanks: =ROWS(C2:C11)*COLUMNS(C2:C11)-COUNTBLANK(C2:C11)


Also, please keep in mind that both =COUNTIF(range,"") and =COUNTBLANK(range) count
cells with formulas that only look empty. If you do not want to treat such cells as blanks, use this
formula instead: =ROWS(C2:11)*COLUMNS(C2:11)-COUNTIF(C2:11,"<>"&"").
For more information about counting blanks and not blanks in Excel, see the following
tutorials: 3 ways to count empty cells in Excel and How to count non-empty cells in Excel.
COUNTIF greater than, less than or equal to
To count cells with values greater than, less than or equal to the number you specify, you simply
add a corresponding operator to the criteria, as shown in the table below.
Please pay attention that in COUNTIF formulas, an operator with a number are
always enclosed in quotes.
Criteria

Formula Example

Description

Count if greater than

=COUNTIF(A2:A10,"
>5")

Count cells where value is greater


than 5.

Count if less than

=COUNTIF(A2:A10,"
<5")

Count cells with values less than 5.

Count if equal to

=COUNTIF(A2:A10,"
=5")

Count cells where value is equal to


5.

Count if not equal to

=COUNTIF(A2:A10,"
<>5")

Count cells where value is not


equal to 5.

Count if greater than


or equal to

=COUNTIF(C2:C8,">
=5")

Count cells where value is greater


than or equal to 5.

Count if less than or


equal to

=COUNTIF(C2:C8,"<
=5")

Count cells where value is less


than or equal to 5.

You can also use all of the above formulas to count cells based on another cell value, you
will just need to replace the number in the criteria with a cell reference.
Note. In case of a cell reference, you have to enclose the operator in quotes and add an
ampersand (&) before the cell reference. For example, to count cells in the range D2:D9 with

values greater than a value in cell D3, you use this formula =COUNTIF(D2:D9,">"&D3):

If you want to count cells that contain an actual operator as part of the cell's contents, i.e. the
characters ">", "<" or "=", then use a wildcard character with the operator in the criteria. Such
criteria will be treated as a text string rather than a numeric expression. For example, the
formula =COUNTIF(D2:D9,"*>5*") will count all cells in the range D2:D9 with contents like
this "Delivery >5 days" or ">5 available".
Using Excel COUNTIF function with dates
If you want to count cells with dates that are greater than, less than or equal to the date you
specify or date in another cell, you proceed in the already familiar way using formulas similar to
the ones we discussed a moment ago. All of the above formulas work for dates as well as for
numbers. Let me give you just a few examples:
Criteria

Formula Example

Description

Count dates equal


to the specified
date.

=COUNTIF(B2:B10,"6/1/20
14")

Counts the number of cells in


the range B2:B10 with the
date 1-Jun-2014.

Count dates greater


than or equal to
another date.

=COUNTIF(B2:B10,">=6/1
/2014")

Count the number of cells in


the range B2:B10 with a date
greater than or equal to
6/1/2014.

Count dates greater


than or equal to a
date in another cell,
minus x days.

=COUNTIF(B2:B10,">="&
B2-"7")

Count the number of cells in


the range B2:B10 with a date
greater than or equal to the
date in B2 minus 7 days.

Apart from these common usages, you can utilize the COUNTIF function in conjunction with
specific Excel Date and Time functions such as TODAY() to count cells based on the current
date.

Criteria

Formula Example

Count dates equal to the current


date.

=COUNTIF(A2:A10,TODAY())

Count dates prior to the current


date, i.e. less than today.

=COUNTIF(A2:A10,"<"&TODAY())

Count dates after the current


date, i.e. greater than today.

=COUNTIF(A2:A10,">"&TODAY())

Count dates that are due in a


week.

=COUNTIF(A2:A10,"="&TODAY()+7)

Count dates in a specific date


range.

=COUNTIF(B2:B10, ">=6/7/2014")COUNTIF(B2:B10, ">6/1/2014")

Here is an example of using such formulas on real data (at the moment of writing today was 25Jun-2014):

Excel COUNTIF with multiple criteria


In fact, Excel COUNTIF function is not exactly purposed for counting cells based on multiple
criteria. There is another function, COUNTIFS, especially designed for this (it is the topic of the
next week's article). However, you can use COUNTIF to count values based on two or more
criteria by adding or subtracting several COUNTIF functions.
Example 1. COUNTIF with two conditions for numbers
One of the most common applications of Excel COUNTIF function with 2 criteria is
countingnumbers within a specific range, i.e. less than X but greater than Y. For example, you

can use the following formula to count cells in the range B2:B9 where a value is greater than 5
and less than 15.
=COUNTIF(B2:B9,">5")-COUNTIF(B2:B9,">=15")

Example 2. COUNTIF with multiple conditions for text values


Let's consider one more example of the COUNTIF function that will count 2 different text
values. Suppose you have a shopping list and you want to find out how many soft drinks are
included. So, the following formula works a treat:
=COUNTIF(B2:B13,"Lemonade")+COUNTIF(B2:B13,"*juice")

Please pay attention to the wildcard character (*) in the second criterion, it is used to count all
kinds of juice on the list.

In the same manner, you can write a COUNTIF formula with several conditions. Here is an
example of the COUNTIF function with multiple conditions that counts lemonade, juice and
ice cream:
=COUNTIF(B2:B13,"Lemonade") + COUNTIF(B2:B13,"*juice") +
COUNTIF(B2:B13,"Ice cream")
You can find plenty more examples for text, numbers and dates in this tutorial - Excel
COUNTIFS and COUNTIF with multiple criteria.
Using COUNTIF function to find duplicates and unique values
Another possible usage of the COUNTIF function in Excel is for finding duplicates in one
column, between two columns, or in a row.
Example 1. Find and count duplicates in 1 column
For example, this simple formula =COUNTIF(B2:B10,B2)>1 will spot all duplicate entries in the
range B2:B10 while another function =COUNTIF(B2:B10,TRUE) will tell you how many dupes

are there:

Example 2. Count duplicates between two columns


If you have two separate lists, say lists of names in columns B and C, and you want to know
how many names appear in both columns, you can use Excel COUNTIF in combination with the
SUMPRODUCT function to count duplicates:
=SUMPRODUCT((COUNTIF(B2:B1000,C2:C1000)>0)*(C2:C1000<>""))
We can even take a step further and count how many unique names there are in Column C,
i.e. names that do NOT appear in Column B:
=SUMPRODUCT((COUNTIF(B2:B1000,C2:C1000)=0)*(C2:C1000<>""))

Tip. If you want to highlight duplicate cells or entire rows containing duplicate entries, you can
create conditional formatting rules based on the COUNTIF formulas, as demonstrated in this
tutorial - Excel conditional formatting formulas to highlight duplicates.
Example 3. Count duplicates and unique values in a row
If you want to count duplicates or unique values in a certain row rather than a column, use one
of the below formulas. These formulas might be helpful, say, to analyze the lottery draw history.
Count duplicates in a row:
=SUMPRODUCT((COUNTIF(A2:I2,A2:I2)>1)*(A2:I2<>""))
Count unique values in a row:
=SUMPRODUCT((COUNTIF(A2:I2,A2:I2)=1)*(A2:I2<>""))

Excel COUNTIF - frequently asked questions and issues


I hope these examples have helped you to get a feel for the Excel COUNTIF function. If you've
tried any of the above formulas on your data and were not able to get them to work or are
having a problem with the formula you created, please look through the following 5 most
common issues. There is a good chance that you will find the answer or a helpful tip there.
1. COUNTIF on a non-contiguous range of cells
Question: How can I use COUNTIF in Excel on a non-contiguous range or a selection of cells?
Answer: Excel COUNTIF does not work on non-adjacent ranges, nor does its syntax allow
specifying several individual cells as the first parameter. Instead, you can use a combination of
several COUNTIF functions:
Wrong: =COUNTIF(A2,B3,C4,">0")
Right: =COUNTIF(A2,">0") + COUNTIF(B3,">0") + COUNTIF(C4,">0")

An alternative way is using the INDIRECT function to create an array of ranges. For example,
both of the below formulas produce the same result you see in the screenshot:
=SUM(COUNTIF(INDIRECT({"B2:B8","D2:C8"}),"=0"))
=COUNTIF($B2:$B8,0) + COUNTIF($C2:$C8,0)

2. Ampersand and quotes in COUNTIF formulas


Question: When do I need to use an ampersand in a COUNTIF formula?
Answer: This is probably the most arcane part. I personally find the syntax of the COUNTIF
function very confusing, though if you give it some thought, you'll see the reasoning behind it.
An ampersand and quotes are needed to construct a text string for the argument. So, you can
adhere to these rules:

If you use a number or a cell reference in the exact match criteria, you need neither
ampersand nor quotes, e.g. or =COUNTIF(A1:A10,10) or =COUNTIF(A1:A10,C1).
If your criteria includes text, wildcard character or some operator with a number, you
enclose it in quotes,
e.g. =COUNTIF(A2:A10,"lemons") or =COUNTIF(A2:A10,"*") or =COUNTIF(A2:A10,"
>5")
If you use an expression with a cell reference or another Excel function, you have to
use the quotes ("") to start a text string and ampersand (&) to concatenate and finish the string
off. For example, =COUNTIF(A2:A10,">"&D2) or =COUNTIF(A2:A10,"<="&TODAY()).
If you are in doubt whether an ampersand is needed or not, try out both ways. In most cases an
ampersand works just fine, e.g. the formulas =COUNTIF(C2:C8,"<=5") and
=COUNTIF(C2:C8,"<="&5) work equally well.
3. COUNTIF for formatted (color coded) cells
Question: How do I count cells by fill or font color rather than by values?
Answer: Regrettably, the syntax of the Excel COUNTIF function does not allow using formats as
the condition. The only possible way to count or sum cells based on their color is using a macro,

or more precisely an Excel User-Defined function. You can find the code working for cells
colored manually as well as for conditionally formatted cells in this article - How to count, sum
and filter cells by color in Excel.
4. #NAME? error in the COUNTIF formula
Issue: My COUNTIF formula throws a #NAME? error. How can I get it fixed?
Answer: Most likely, you have supplied an incorrect range to the formula. Please check out point
1above.
5. Excel COUNTIF formula not working
Issue: My COUNTIF formula is not working! What have I done wrong?
Answer: If you have written a formula which is seemingly correct but it does not work or
produces a wrong result, start by checking the most obvious things such as a range, conditions,
cell references, use of ampersand and quotes.
Be very careful with using spaces in a COUNTIF formula. When creating one of the formulas
for this article I was on the verge of pulling my hair out because the correct formula (I knew with
certainty it was right!) wouldn't work. As it turned out, the problem was in a measly space
somewhere in between, argh... For instance, look at this formula =COUNTIF(B2:B13,"
Lemonade"). At first sight, there is nothing wrong about it, except for an extra space after the
opening quotation mark. Microsoft Excel will swallow the formula just fine without an error
message, warning or any other indication, assuming you really want to count cells containing
the word 'Lemonade' and a leading space.
If you use the COUNTIF function with multiple criteria, split the formula into several pieces and
verify each function individually.
And this is all for today. In the next article, we will explore several ways to count cells in Excel
with multiple conditions. Hope to see you next week and thanks for reading!

3 ways to count empty cells in Excel


If your task is to get Excel count blank cells in your worksheet, read this article to find 3 ways to
accomplish it. Learn how to search and select empty cells with the Go to Special option, use
Find and Replace to count blanks or enter a formula in Excel 2010-2013.
In my previous post How to count non-empty cells in Excel, I showed 3 ways to get the number
of filled cells in a range. Today, you'll learn how find and count blanks in your table.
Suppose you supply goods to multiple stores. You have a worksheet in Excel with the shops'
names and the quantity of items they sold. Some cells in the Items sold column are empty.

You need to make Excel count blank cells in your sheet or find and select them to see how
many stores didn't provide the necessary details. Doing it manually would take too much time,
so feel free to use one of the options I show in this post:

How to find empty cells in Excel with Go to Special


Excel - count blank cells using Find and Replace functionality
Use a special formula for counting blank cells
How to find empty cells in Excel with Go to Special
If you need to quickly find all blank cells in Excel, use the Go to Special functionality. Though it
will not show you the number of blanks, the tool will quickly highlight all empty cells so that you
can easily locate them in your sheet.

1. Select a range with blank cells in your table and press F5 on the keyboard to get the Go
Todialog box.

2. Then press the Alt + S hotkey to get the Go To Special window. On this window, select
theBlanks radio button.

3. Click Ok to see the empty cells found and highlighted in your table.

Tip. You can use the Fill Color option under the Home tab to change the background of empty
cells and keep the selection.

Please note that Go to Special will not find pseudo-blank cells with spaces or those with
formulas that return blanks.
Excel - count blank cells using Find and Replace functionality
You can use the standard Excel Find and Replace dialog to count empty cells in your table. This
tool will display the list with all blanks next to their addresses in your sheet. It also lets
you navigate to any empty cell by clicking on its link in the list.

1. Select the range where you need to count blank cells and press the Ctrl + F hotkey.
Note. If you select one cell Find and Replace will search the entire table.
2. Leave the Find what field empty.

3. Press Options and select the Match entire cell contents checkbox.

4. Pick Formulas or Values from the Look in: drop-down list.

If you choose to find Values, the tool will count all empty cells including the pseudo-blank
ones.

Select the Formulas option to search for empty cells only. You will not get cells with
blank formulas or spaces.

5. Press the Find All button to see the results. You will get the number of blanks in the bottomleft corner.

Tip. If you select the results on the add-in pane, it's possible to fill the empty cells with the same
value, like 0 or the words "no information". To learn more, please check the article Fill empty
cells with 0 or another specific value.
Use a special formula for counting blank cells
This part is for the formula-oriented users. Though you will not see the found items highlighted,
it's possible to get the number of blanks in any cell you select to compare to the next search.

The formula =countblanks() will show you the number of empty cells, including the
pseudo-blank ones.
If you enter the formula =ROWS()*COLUMNS()-COUNTA(), you'll get all truly
empty cells. No values, no blank formulas.
Follow the steps below to apply them:
1. Select any empty cell in your sheet.
2. Enter =countblanks() or =ROWS() * COLUMNS() - COUNTA() into the formula bar.
3. Then you can enter the range address between the brackets in your formula. Or place the
mouse cursor between the brackets and manually select the necessary cell range in your sheet.
You will see the address automatically appear in the formula.
4. Press Enter on your keyboard.
You will get the result in the selected cell.
On the below picture, I show the summary of how these 2 formulas work with constants and
pseudo-blank cells. In my sample, I have 4 cells selected. A2 has a value, A3 has a formula that
returns an empty string, A4 is empty and A5 contains two spaces. Below the range, you can see
the number of the found cells next to the formula I employed.

You can also use the COUNTIF formula for counting empty cells in Excel, please check out this
tutorial for full details - COUNTIF for blanks and non-blanks.
Now you know how to find and count blank cells in your Excel table. Use a formula to paste the
number of empty cells, turn on Find and Replace to highlight blanks, navigate to them and see
their number, or choose the Go To Special feature to quickly select all blank ranges in your
table. Feel free to share any other hints you may have. Be happy and excel in Excel!

How to count non-empty cells in Excel 2010, 2013


This articles looks at the ways to count non-blank cells in Excel 2010-2013. Below you'll find 3
methods for counting non-blanks: see the number on the Excel Status bar, employ the Find and
Replace dialog or use a special formula.
Your table may have numerous blank cells left for better visualization. On the one hand, such
layout is really convenient. On the other hand, it may prevent from seeing the correct number of
data rows. You may need to count all non-empty cells in Excel to see how many products are
sold, or how many people take part in a conference.
Note. If a cell contains a formula that returns space between quotes (""), it's not seen as empty.
I will refer to them as to blank formulas in this article.
Below you'll find 3 possibilities in Excel for counting non-blank cells.

Count option on the Excel Status bar


Excel - count non-blank cells with the Find and Replace tool
Use a special formula to count all non-empty cells
Count option on the Excel Status bar
Excel Status bar shows a number of tools you may find helpful. Here you can see page layouts,
zoom slider and basic math functions displayed for numerical values.
To see how many selected cells contain data, just look at the COUNT option on the Status bar.
Note. This option will not work if you have only one filled cell in the selected range.

Excel - count non-blank cells with the Find and Replace option
It's also possible to count non-empty cells with the help of the standard Excel Find and
Replacedialog. This method is good if you have a large table. You'll get all values displayed on
one window along with their cell addresses. In addition, you can easily navigate to any item by
clicking on its name in the list.
1. Select the range where you need to count the non-blanks and press the Ctrl + F hotkey.
2. You will see the Find and Replace dialog box. Enter the asterisk symbol ( * ) in the Find
what field.

3. Press the Options button and pick the Values or Formulas item from the Look in: drop-down
list.

If you select Values, the tool will count all filled cells and ignore blank formulas.
When you pick Formulas, Find and Replace shows all cells that have values and any
formulas.

4. Click Find All to see the results. You'll get all the found items and their quantity on the pane.

Tip. You can now select all found items on the Find and Replace pane. You'll see all non-blank
cells highlighted and it will stay after you close the window.

Use a special Excel formula to count all non-blank cells


The third way to calculate the number of non-empty cells is to use an Excel formula. Though
you will not see where the cells are, this option helps you choose what kinds of filled cells you
want to count.
If you need to count all filled cells, constants, formulas, cells with spaces, you should use the
formula =COUNTA().
To get the number of cells with constants and those including spaces, enter
=ROWS(L8:L11) * COLUMNS(L8:L11)-COUNTBLANK(L8:L11)

Follow these steps to apply the formulas:


1. Select any empty cell in your sheet.
2. Enter =counta() or =ROWS() * COLUMNS()-COUNTBLANK() to the formula bar.
3. Then you can manually enter the range address between the brackets in your formula. Or
place the mouse cursor between the brackets and highlight the necessary cell range in your
table. You will see the address automatically appear in the formula.

With the formula =ROWS() * COLUMNS()-COUNTBLANK() you need to enter the range
address 3 times.

4. Press Enter on your keyboard.


You will see the result in the selected cell.
If you want to count only constants without cells with extra spaces, use =SUM(-(LEN(TRIM(range))>0)) Please note, this is an array formula that needs to be entered
with CTR + Shift + Enter.
1. Select any empty cell in your sheet.
2. Enter =SUM(--(LEN(TRIM())>0)) in the formula bar.
3. Place your mouse cursor between the brackets and select the range in your table. You will
see the range address appear in the formula.

4. Press Ctrl + Shift + Enter to see the number in the selected cell.
On the screenshot below, you can see a brief summary showing how these 3 formulas work
with constants, blank formulas and extra spaces. In the test table I have a range with 4 cells
selected. A2 contains a value, A3 has a formula that returns an empty string, A4 is empty and
A5 has two spaces entered. Under the range, you can see the number of the found cells next to

the formula I used to find them.

Another way to count non-blanks in Excel is using the COUNTIF


formula =COUNTIF(range,"<>"&""). You will find the full details in this tutorial - COUNTIF
for non-blanks.
Now three ways of counting non-blank cells in Excel are at your disposal. Just pick the one that
suites you best. It can be the Status bar, Find and Replace or a formula. Be happy and excel in
Excel!

How to conditionally format dates and time in Excel - built-in rules and formulas
If you are a regular visitor of this blog, you've probably noticed a few recent articles covering
different aspects of Excel conditional formatting. Those tutorials explain how to apply Excel's
built-in rules and make your own conditional formats based on formulas.
And now we will leverage this knowledge and create spreadsheets that differentiate between
weekdays and weekends, highlight public holidays and display a coming deadline or delay. In
other words, we are going to apply Excel conditional formatting to dates.
If you have some basic knowledge of Excel formulas, then you are most likely familiar with
some of date and time functions such as NOW, TODAY, DATE, WEEKDAY, etc. In this tutorial,
we are going to take this functionality a step further to conditionally format Excel dates in the
way you want.

o
o
o
o
o
o
o

Excel conditional formatting rules for dates


Excel conditional formatting date formulas
Highlight weekends
Highlight holidays
Highlight cells when a value changes to a date
Shade every row with a certain date
Conditionally format dates based on the current date
How to highlight dates within a date range
Shade gaps and time intervals
Excel conditional formatting for dates (built-in rules)
Microsoft Excel provides 10 options to format selected cells based on the current date.

1. To apply the formatting, you simply go to the Home tab > Conditional Formatting > Highlight
Cell Rules and select A Date Occurring.

2. Select one of the date options from the drop-down list in the left-hand part of the window,
ranging from last month to next month.
3. Finally, choose one of the pre-defined formats or set up your custom format by choosing
different options on the Font, Border and Fill tabs. If the Excel standard palette does not suffice,

you can always click the More colors... button.

4. Click OK and enjoy the result! : )

However, this fast and straightforward way has two significant limitations - 1) it works for
selected cells only and 2) the conditional format is always applied based on the current date.

Excel conditional formatting formulas for dates


If you want to highlight cells or entire rows based on a date in another cell, or create rules
forgreater time intervals (i.e. more than a month from the current date), you will have to create
your own conditional formatting rule based on a formula. Below you will find a few examples of
my favorite Excel conditional formats for dates.
How to highlight weekends in Excel
Regrettably, Microsoft Excel does not have a built-in calendar similar to Outlook's. Well, let's see
how you can create your own automated calendar with quite little effort.
When designing your Excel calendar, you can use the =DATE(year,month,date) function to
display the days of the week. Simply enter the year and the month's number somewhere in your
spreadsheet and reference those cells in the formula. Of course, you could type the numbers
directly in the formula, but this is not a very efficient approach because you would have to adjust
the formula for each month.
The screenshot below demonstrates the DATE function in action. I used the
formula =DATE($B$2,$B$1,B$4) which is copied across row 5.

Tip. If you want to display only the days of the week like you see in the image above, select the
cells with the formula (row 5 in our case), right-click and choose Format Cells...> Number >
Custom. From the drop-down list under Type, select either dddd or ddd to show full day names
or abbreviated names, respectively.
Your Excel calendar is almost done, and you only need to change the color of weekends.
Naturally, you are not going to color the cells manually. We'll have Excel format the weekends
automatically by creating a conditional formatting rule based on the WEEKDAY formula.
1. You start by selecting your Excel calendar where you want to shade the weekends. In our
case, it is the range $B$4:$AE$10. Be sure to start the selection with the 1st date column Colum B in this example.
2. On the Home tab, click Conditional Formatting menu > New Rule.
3. Create a new formatting rule based on a formula, as explianed in How to create Excel
conditional formatting rules with a formula.

4. In the "Format values where this formula is true" box, enter the following WEEKDAY formula
that will determine which cells are Saturdays and Sundays: =WEEKDAY(B$5,2)>5
5. Click the Format... button and set up your custom format by switching between
the Font,Border and Fill tabs and playing with different formatting options. When done, click
the OK button to preview the rule.

Now, let me briefly explain the WEEKDAY(serial_number,[return_type]) formula so that


you can quickly adjust it for your own spreadsheets.

The serial_number parameter represents the date you are trying to find. You enter a
reference to your first cell with a date, B$5 in our case.
The [return_type] parameter determines the week type (square brackets imply it is
optional). You enter 2 as the return type for a week starting from Monday (1) through Sunday
(7). You can find the full list of available return types here.
Finally, you write >5 to highlight only Saturdays (6) and Sundays (7).
The screenshot below demonstrates the result in Excel 2013 - the weekends are highlighted in
the reddish colour.

Tips:

If you have non-standard weekends in your company, e.g. Fridays and Saturdays, then
you would need to tweak the formula so that it starts counting from Sunday (1) and highlight
days 6 (Friday) and 7 (Saturday) - WEEKDAY(B$5,1)>5.
If you are creating a horizontal (landscape) calendar, use a relative column (without $)
and absolute row (with $) in a cell reference because you should lock the reference of the row in the above example it is row 5, so we entered B$5. But if you are designing a calendar in
vertical orientation, you should do the opposite, i.e. use an absolute column and relative row,
e.g. $B5 as you can see in the screenshot below:

How to highlight holidays in Excel


To improve your Excel calendar further, you can shade public holidays as well. To do that, you
will need to list the holidays you want to highlight in the same or some other spreadsheet.
For example, I've added the following holidays in column A ($A$14:$A$17). Of course, not all of
them are real public holidays, but they will do for demonstration purposes : )

Again, you open Conditional Formatting > New Rule. In the case of holidays, you are going to
use either MATCH or COUNTIF function:

=COUNTIF($A$14:$A$17,B$5)>0
=MATCH(B$5,$A$14:$A$17,0)
Note. If you have chosen a different color for holidays, you need to move the public holiday rule
to the top of the rules list via Conditional Formatting > Manage Rules...
The following image shows the result in Excel 2013:

Conditionally format a cell when a value is changed to a date


It's not a big problem to conditionally format a cell when a date is added to that cell or any other
cell in the same row as long as no other value type is allowed. In this case, you could simply
use a formula to highlight non-blanks, as described in Excel conditional formulas for blanks and
non-blanks. But what if those cells already have some values, e.g. text, and you want to change
the background color when text is changed to a date?
The task may sound a bit intricate, but the solution is very simple.
1. First off, you need to determine the format code of your date. Here are just a few examples:

D1: dd-mmm-yy or d-mmm-yy


D2: dd-mmm or d-mmm
D3: mmm-yy
D4: mm/dd/yy or m/d/yy or m/d/yy h:mm
You can find the complete list of date codes in this article.
2. Select a column where you want to change the color of cells or the entire table in case you
want to highlight rows.
3. And now create a conditional formatting rule using a formula similar to this
one: =CELL("format",$A2)="D1". In the formula, A is the column with dates and D1 is the
date format.
If your table contains dates in 2 or more formats, then use the OR operator,
e.g. =OR(cell("format",$A2)="D1",cell("format",$A2)="D2",cell("format",
$A2)="D3")

The screenshot below demonstrates the result of such conditional formatting rule for dates.

How to highlight rows based on a certain date in a certain column


Suppose, you have a large Excel spreadsheet that contains two date columns (B and C). You
want to highlight every row that has a certain date, say 13-May-14, in column C.
To apply Excel conditional formatting to a certain date, you need to find its numerical
value first. As you probably know, Microsoft Excel stores dates as sequential serial numbers,
starting from January 1, 1900. So, 1-Jan-1900 is stored as 1, 2-Jan-1900 is stored as 2... and
13-May-14 as 41772.
To find the date's number, right-click the cell, select Format Cells > Number and choose
theGeneral format. Write down the number you see and click Cancel because you do not really
want to change the date's format.

That was actually the major part of the work and now you only need to create a conditional
formatting rule for the entire table with this very simple formula: =$C2=41772. The formula
implies that your table has headers and row 2 is your first row with data.
An alternative way is to use the DATEVALUE formula that converts the date to the number
format is which it is stored, e.g. =$C2=DATEVALUE("5/13/2014")
Whichever formula you use, it will have the same effect:

Conditionally format dates in Excel based on the current date


As you probably know Microsoft Excel provides the TODAY() functions for various calculations
based on the current date. Here are just a few examples of how you can use it to conditionally
format dates in Excel.
Example 1. Highlight dates equal to, greater than or less than today
To conditionally format cells or entire rows based on today's date, you use the TODAY function
as follows:
Equal to today: =$B2=TODAY()
Greater than today: =$B2>TODAY()
Less than today: =$B2<TODAY()
The screenshot below demonstrates the above rules in action. Please note, at the moment of
writing TODAY was 12-Jun-2014.

Example 2. Conditionally format dates in Excel based on several conditions


In a similar fashion, you can use the TODAY function in combination with other Excel functions
to handle more complex scenarios. For example, you may want your Excel conditional

formatting date formula to color the Invoice column when the Delivery Date is equal to or greater
than today BUT you want the formatting to disappear when you enter the invoice number.
For this task, you would need an additional column with the following formula (where E is
yourDelivery column and F the Invoice column):
=IF(E2>=TODAY(),IF(F2="", 1, 0), 0)
If the delivery date is greater than or equal to the current date and there is no number in the
Invoice column, the formula returns 1, otherwise it's 0.
After that you create a simple conditional formatting rule for the Invoice column with the
formula =$G2=1 where G is your additional column. Of course, you will be able to hide this
column later.

Example 3. Highlight upcoming dates and delays


Suppose you have a project schedule in Excel that lists tasks, their start dates and durations.
What you want is to have the end date for each task calculated automatically. An additional
challenge is that the formula should also consider the weekends. For example, if the starting
date is 13-Jun-2014 and the number of days of work (Duration) is 2, the ending date should
come as 17-Jun-2014, because 14-Jun and 15-Jun are Saturday and Sunday.
To do this, we will use the WORKDAY.INTL(start_date,days,[weekend],
[holidays]) function, more precisely =WORKDAY.INTL(B2,C2,1).

In the formula, we enter 1 as the 3rd parameter since it indicates Saturday and Sunday as
holidays. You can use another value if your weekends are different, say, Fri and Sat. The full list
of the weekend values is available here. Optionally, you can also use the 4th parameter
[holidays], which is a set of dates (range of cells) that should be excluded from the working day
calendar.
And finally, you may want to highlight rows depending on how far away the deadline is. For
example, the conditional formatting rules based on the following 2 formulas highlight upcoming
and recent end dates, respectively:

=AND($D2-TODAY()>=0,$D2-TODAY()<=7) - highlight all rows where the End Date


(column D) is within the next 7 days. This formula is really handy when it comes to tracking
upcoming expiration dates or payments.
=AND(TODAY()-$D2>=0,TODAY()-$D2<=7) - highlight all rows where the End Date
(column D) is within the last 7 days. You can use this formula to track the latest overdue
payments and other delays.

Here are a few more formula examples that can be applied to the table above:
=$D2<TODAY() - highlights all passed dates (i.e. dates less than the current date). Can be
used to format expired subscriptions, overdue payments etc.
=$D2>TODAY() - highlights all future dates (i.e. dates greater than the current date). You can
use it to highlight upcoming events.
Of course, there can be infinite variations of the above formulas, depending on your particular
task. For instance:
=$D2-TODAY()>=6 - highlights dates that occur in 6 or more days.
=$D2=TODAY()-14 - highlights dates occurring exactly 2 weeks ago.
How to highlight dates within a date range
If you have a long list of dates in your worksheet, you may also want to highlight the cells or
rows that fall within a certain date range, i.e. highlight all dates that are between two given
dates.
You can fulfil this task using the TODAY() function again. You will just have to construct a little bit
more elaborate formulas as demonstrated in the examples below.
Formulas to highlight past dates

More than 30 days ago: =TODAY()-$A2>30


From 30 to 15 days ago, inclusive: =AND(TODAY()-$A2>=15, TODAY()-$A2<=30)
Less than 15 days ago: =AND(TODAY()-$A2>=1, TODAY()-$A2<15)

The current date and any future dates are not colored.

Formulas to highlight future dates

Will occur in more than 30 days from now: =$A2-TODAY()>30


In 30 to 15 days, inclusive: =AND($A2-TODAY()>=15, $A2-TODAY()<=30)
In less than 15 days: =AND($A2-TODAY()>=1, $A2-TODAY()<15)
The current date and any past dates are not colored.

How to shade gaps and time intervals


In this last example, we are going to utilize yet another Excel date function
- DATEDIF(start_date, end_date, interval). This function calculates the difference
between two dates based on the specified interval. It differs from all other functions we've
discussed in this tutorial in the way that it lets you ignore months or years and calculate the
difference only between days or months, whichever you choose.
Don't see how this could work for you? Think about it in another way... Suppose you have a list
of birthdays of your family members and friends. Would you like to know how many days there

are until their next birthday? Moreover, how many days exactly are left until your wedding
anniversary and other events you wouldn't want to miss? Easily!
The formula you need is this (where A is your Date column):
=DATEDIF(TODAY(),DATE((YEAR(TODAY())+1),MONTH($A2),DAY($A2)),"yd")
The "yd" interval type at the end of the formula is used to ignore years and calculate the
difference between the days only. For the full list of available interval types, look here.
Tip. If you happen to forget or misplace that complex formula, you can use this simple one
instead: =365-DATEDIF($A2,TODAY(),"yd"). It produces exactly the same results, just
remember to replace 365 with 366 in leap years : )
And now let's create an Excel conditional formatting rule to shade different gaps in different
colors. In this case, it makes more sense to utilize Excel Color Scales (Conditional formatting >
Color Scales) rather than create a separate rule for each period.
The screenshot below demonstrates the result in Excel - a gradient 3-color scale with tints from
green to red through yellow.

"Days Until Next Birthday" Excel Web App


We have created this Excel Web App to show you the above formula in action. Just enter your
events in 1st column and change the corresponding dates in the 2nd column to experiment with
the result.
If you are curious to know how to create such interactive Excel spreadsheets, check out this
article - Move Excel spreadsheets online.
Hopefully, at least one of the Excel conditional formats for dates discussed in this article has
proven useful to you. If you are looking for a solution to some different task, you are most
welcome to post a comment. Thank you for reading!

Fastest ways to insert multiple rows in Excel 2010-2013


Inserting multiple rows in Excel may be one of the numerous tasks you come across daily. In
today's article, I hope to inspire shortcut-oriented users by showing some really quick ways to
add new rows in Excel. You'll also see how to solve this task using standard menus and Ribbon
buttons and how to add empty rows between multiple data lines.
If you work in Excel actively, you know that most of the tables are constantly changing. Very
often, they get modified when you add new details and as a result insert multiple empty rows for
them. If you add rows below or above certain data in your spreadsheets every now and then,
the standard Insert command looks like the most evident solution. However if pasting blank lines
is your day-to-day or even hour-to-hour routine in Excel, insert-row shortcuts are by far more
effective.
This article will be useful both for the shortcut people and for users who prefer standard Excel
options located on the Ribbon and within different menu lists. You will find several solutions how
to insert new rows in Excel with shortcuts and learn how to add blank rows between existing
lines with data.

Insert multiple rows in Excel using the standard menu options


Excel - Insert row shortcuts to speed up pasting blanks
Use numerical keypad shortcut to add rows in Excel
Special shortcut to insert rows in Excel if there's data to the right of your table
Add empty rows between multiple data lines in Excel
Insert multiple rows in Excel using the standard menu options
Below you'll find the most obvious ways for pasting blank rows which is employing
the Insertfunctionality.
1. Pick one or several rows where the blanks will appear. To do this, select the destination cells
and use the Shift + Space shortcut to turn them into rows.

Tip. You can also select entire lines using the row number buttons. You'll see the number of the
highlighted rows next to the last button.

2. Go to the Home tab in Excel and click on the Insert icon.

You will see your table in Excel with the rows inserted below the necessary line.

You can get the same result if you use the Insert menu option. Please see the steps below.
1. Select the cells where the empty rows need to appear and press Shift + Space.

2. When you pick the correct number of rows, right-click within the selection and choose
the Insertoption from the menu list.

Tip. If your cells contain any formatting, use the Insert Options icon to match the format.

Again, you'll see multiple rows inserted in your table in Excel. Now you can enter the necessary
details to get your report ready.
Excel - Insert row shortcuts to speed up pasting blanks
If you think that the ways described above are fast enough, check out the below options to see
what is really quick. I'll share how to insert new rows in Excel with keyboard shortcuts.
The first shortcut I'd like to cover is the one repeating the Ribbon option Insert Sheet Rows.
1. Select the necessary number of rows where the blank lines will appear by picking the
corresponding cells and pressing Shift + Space. The current content will be moved down to

make room for the new rows.

2. Then press Alt+I. Then, holding the Alt button press R.

Voila! You can see the new rows added below. Please keep reading - the most interesting
details are ahead.

Use numerical keypad shortcut to add rows in Excel


Even if you don't enter large amounts of numeric data, you can still benefit from using the
number pad. The Excel insert row shortcut I show below will work only if you press the Plus key
on the numerical keypad.
1. Select the range in Excel to insert a new row. To do this left-click on the row number button
next to the fist cell of the selection and extend the range keeping the left mouse button pressed.
2. Now press Ctrl + Plus on the numerical pad.

If you prefer to use the main keyboard, you can get the same results if you use the Ctrl + Shift +
Plus on the main pad.

Tip. If you need to add numerous rows at a time, like one or two hundred, take the advantage of
the F4 button. It repeats your last action. For example, if you want to insert 100 empty rows,
select a range with 10 rows, use the shortcut you like to insert the blanks and then just
press F4ten times.
Special shortcut to insert rows in Excel if there's data to the right of your table
Ctrl + Plus hotkey is fast and reliable, but if you have data to the right of your main table like on
the screenshot below, it may insert blanks where you wouldn't like them to be and break the

structure.

If that's your case, in this part you'll find a solution for inserting multiple new rows in your Excel
table and keeping the structure of the data next to your list as is.
1. Format your data as Excel Table using the shortcut Ctrl + T, or go to the Home tab -> Format
as Table button and pick the style that suites you best.

You will see the Create Table dialog box that will help you select the necessary range.

That's how your data look like after being formatted as Excel Table:

2. Now that your list is formatted, select a range within your table.

3. Hold the Alt key, first press H, then press I and finally - A. This is a shortcut for the
optionInsert Table Rows Above.

Tip. You can achieve the same result if you select the necessary range and press Ctrl + Plus on
the numerical keypad.
As you can see, new rows didn't appear between the rows to the right:

Add empty rows between multiple data lines in Excel


Suppose you have a report in Excel and need to insert a blank line between each of the existing
rows in your table. There are two ways to solve this task - the first will work for relatively small
lists and the second - for bigger ones.
If your spreadsheet is not so large, look at the steps below:
1. Keep the Ctrl key pressed and manually select each row with data by clicking on the row
number.

2. Press the Insert button on the Ribbon or use any Excel shortcut I listed above to see the
results.

The second option will suite better if you have a big data table.
1. Create a helper column. Enter 1 and 2 in the starting cells, grab the fill handle and drag it to
the last data cell.

2. Now copy the series in the helper column and paste the range just below the last cell.

3. Select the entire table, go to the Data tab in Excel and press the Sort button.

4. On the window that will appear choose to sort by your Helper column (in my example its
column D) -> Values -> Smallest to Largest.

5. Click OK and see the results. Empty rows will appear between the lines with data.

Now you can delete the helper column.


That's it! You learned several shortcuts to insert multiple rows in Excel 2010-2013 and other
versions. Now you know all the fastest ways for adding blank rows to your data. I'll readily
answer any questions you may have. Feel free to post your query below. Be happy and excel in
Excel!

Excel formulas for conditional formatting based on another cell value


In this tutorial, we will continue exploring the fascinating world of Excel Conditional Formatting. If
you do not feel very comfortable in this area, you may want to look through the previous article
first to revive the basics - How to use conditional formatting in Excel 2010 and 2013.
Today are going to dwell on how to use Excel formulas to format individual cells and entire rows
based on the values you specify or based on another cell's value. This is often considered
advanced aerobatics of Excel conditional formatting and once mastered, it will help you push
the formats in your spreadsheets far beyond their common uses.

How to create a conditional formatting rule with a formula


Examples of Excel conditional formatting formulas
How to fix Excel conditional formatting not working
Excel formulas for conditional formatting based on cell value
Excel's pre-defined conditional formatting rules are mainly purposed to format cells based on
their own values or the values you specify. I am talking about Data Bars, Color Scales, Icon
Setsand other rules available to you on the Conditional Formatting button click.
If you want to apply conditional formatting based on another cell or format the entire row based
on a single cell's value, then you will need to use Excel formulas. So, let's see how you can
make a rule using a formula and after that I will provide a number of formula examples for
different tasks.
How to create a conditional formatting rule using a formula
As you remember, in all modern versions of Excel 2013, Excel 2010 and Excel2007, the
conditional formatting feature resides on the Home tab > Styles group. In Excel 2003, you can
find it under theFormat menu.
So, you set up a conditional formatting rule based on a formula in this way:
1.

o
o

Select the cells you want to format. You can select one column, several columns or the
entire table if you want to apply your conditional format to rows.
Tip. If you plan to add more data in the future and you want the conditional formatting rule to
get applied to new entries automatically, you can either:
Convert a range of cells to a table (Insert tab > Table). In this case, the
conditional formatting will be automatically applied to all new rows.
Select some empty rows below your data, say 100 blank rows.

2.

Click Conditional formatting > New Rule

3.

In the New Formatting Rule window, select Use a formula to determine which cells to
format.
4.
Enter the formula in the corresponding box.
5.
Click the Format button to choose your custom format.

6.

Switch between the Font, Border and Fill tabs and play with different options such as
font style, pattern color and fill effects to set up the format that works best for you. If the

standard palette does not suffice, click More colors and choose any RGB or HSL color to
your liking. When done, click the OK button.

7.

Make sure the Preview section displays the format you want and if it does, click
the OK button to save the rule. If you are not quite happy with the format preview, click

the Format button again and make the edits.

Excel conditional formatting formula examples


Now that you know how to create and apply Excel conditional formatting based on another cell,
let's move on and see how to use various Excel formulas in practice:

Tip. For your Excel conditional formatting formula to work correctly, please always follow these
simple rules.
Formulas to compare values (Greater than, Less than, Equal to)
Compare values based on several conditions (OR and AND formulas)
Formulas for blanks and non-blanks
Formulas for text values
Formulas to highlight duplicates
Format values above or below average
Highlight the nearest value in the data set
Formulas to compare values (numbers and text)
As you know Microsoft Excel provides a handful of ready-to-use rules to format cells with values
greater than, less than or equal to the value you specify (Conditional Formatting >Highlight
Cells Rules). However, these rules do not work if you want to conditionally format certain
columns or entire rows based on a cell's value in another column. In this case, you use
analogous formulas:
Condition

Formula example

Equal to

=$B2=10

Not equal to

=$B2<>10

Greater than

=$B2>10

Greater than or equal to

=$B2>=10

Less than

=$B2<10

Less than or equal to

=$B2<=10

Between

=AND($B2>5, $B2<10)

The screenshot below shows an example of the Greater than formula that highlights product
names in column A if the number of items in stock (column C) is greater than 0. Please pay
attention that the formula applies to column A only ($A$2:$A$8). But if you select the whole
table (in our case, $A$2:$E$8), this will highlight entire rows based on the value in column C.

In a similar fashion, you can create a conditional formatting rule to compare values of two cells.
For example:

=$A2<$B2 - format cells or rows if a value in column A is less than the corresponding value in
column B.
=$A2=$B2 - format cells or rows if values in columns A and B are the same.
=$A2<>$B2 - format cells or rows if a value in column A is not the same as in column B.
As you can see in the screenshot below, these formulas work for text values as well as for
numbers.

AND and OR formulas


If you want to format your Excel table based on 2 or more conditions, then use either =AND or
=OR function:
Condition

Formula

Description

If both conditions are met

=AND($B2<$C2,
$C2<$D2)

Formats cells if the value in


column B is less than in column
C, and if the value in column C
is less than in column D.

If one of the conditions is


met

=OR($B2<$C2,
$C2<$D2)

Formats cells if the value in


column B is less than in column
C, or if the value in column C is
less than in column D.

In the screenshot below, we use the formula =AND($C2>0, $D2="Worldwide") to change


the background color of rows if the number of items in stock (Column C) is greater than 0 and if
the product ships worldwide (Column D). Please pay attention that the formula works withtext

values as well as with numbers.

Naturally, you can use two, three or more conditions in your =AND and =OR formulas.
These are the basic conditional formatting formulas you use in Excel. Now let's consider a bit
more complex but far more interesting examples.

Conditional formatting for empty and non-empty cells


I think everyone knows how to format empty and not empty cells in Excel - you simply create a
new rule of the "Format only cells that contain" type and choose either Blanks or No Blanks.

But what if you want to format cells in a certain column if a corresponding cell in another column
is empty or not empty? In this case, you will need to utilize Excel formulas again:
Formula for blanks: =$B2="" - format selected cells / rows if a corresponding cell in Column B
is blank.
Formula for non-blanks: =$B2<>"" - format selected cells / rows if a corresponding cell in
Column B is not blank.
Note. The formulas above will work for cells that are "visually" empty or not empty. If you use
some Excel function that returns an empty string, e.g. =if(false,"OK", ""), and you don't want
such cells to be treated as blanks, use the following formulas
instead =isblank(A1)=true or=isblank(A1)=false to format blank and non-blank cells,
respectively.
And here is an example of how you can use the above formulas in practice. Suppose, you have
a column (B) which is "Date of Sale" and another column (C) "Delivery". These 2 columns have
a value only if a sale has been made and the item delivered. So, you want the entire row to turn
orange when you've made a sale; and when an item is delivered, a corresponding row should
turn green. To achieve this, you need to create 2 conditional formatting rules with the following
formulas:

Orange rows (a cell in column B is not empty): =$B2<>""

Green rows (cells in column B and column C are not empty): =AND($B2<>"",
$C2<>"")
One more thing for you to do is to move the second rule to the top and select the Stop if
truecheck box next to this rule:

In this particular case, the "Stop if true" option is actually superfluous, and the rule will work with
or without it. You may want to check this box just as an extra precaution, in case you add a few
other rules in the future that may conflict with any of the existing ones.
Excel formulas to work with text values
If you want to apply conditional formatting to selected columns when another cell in the same
row contains a certain word, you can use a simple formula like =$D2="Worldwide" (we've
used a similar formula in one of the previous examples). However, this formula will work
forexact match only.
For partial match, you will need another Excel function: =SEARCH. You use it in this way:

=SEARCH("Worldwide", $D2)>0 - format selected cells or rows if a corresponding cell in


column D contains the word "Worldwide". This formula will find all such cells, regardless of
where the search text is located in a cell, e.g. "Ships Worldwide", "Worldwide, except for" etc.
=SEARCH("Worldwide", $D2)>1 - shade selected cells or rows if the cell's content starts
with the search text.

Excel formulas to highlight duplicates


If your task is to conditionally format cells with duplicate values, you can go with the pre-defined
rule available under Conditional formatting > Highlight Cells Rules > Duplicate Values The
following article provides a detailed guidance on how to use this feature: How to automatically
highlight duplicates in Excel.
However, in some cases the data looks better if you color selected columns or entire rows when
a duplicate values occurs in another column. In this case, you will need to employ an Excel
conditional formatting formula again, and this time we will be using the =COUNTIF formula. As
you know, this Excel function counts the number of cells within a specified range that meet a
single criterion.
Highlight duplicates including 1st occurrences
=COUNTIF($A$2:$A$10,$A2)>1 - this formula finds duplicate values in the specified range in
Column A (A2:A10 in our case), including first occurrences.
If you choose to apply the rule to the entire table, the whole rows will get formatted, as you see
in the screenshot below. I've decided to change a font color in this rule, just for a change : )

Highlight duplicates without 1st occurrences


To ignore the first occurrence and highlight only subsequent duplicate values, use this
formula: =COUNTIF($A$2:$A2,$A2)>1

Highlight consecutive duplicates in Excel


If you'd rather highlight only duplicates on consecutive rows, you can do this in the following
way. This method works for any data types: numbers, text values and dates.

Select the column where you want to highlight duplicates, without the column header.
Create a conditional formatting rule(s) using these simple formulas:
Rule 1 (blue): =$A1=$A2 - highlights the 2nd occurrence and all subsequent occurrences, if any.
Rule 2 (green): =$A2=$A3 - highlights the 1st occurrence.
In the above formulas, A is the column you want to check for dupes, $A1 - the column header,
$A2 - the first cell with data.
Important! For the formulas to work correctly, it is essential that Rule 1, which highlights the
2ndand all subsequent duplicate occurrences, should be the first rule in the list, especially if you
are using two different colors.

Check for duplicates across multiple columns


If you want apply the conditional format when duplicate values occur in two or more columns,
you will need to add an extra column to your table in which you concatenate the values from the
key columns using a simple formula like this one =A2&B2. After that you apply a rule using
either variation of the =COUNTIF function (with or without 1st occurrences). Naturally, you can
hide an additional column after creating the rule.

Compare 2 columns for duplicates


One of the most frequent tasks in Excel is to check 2 columns for duplicate values - i.e. find and
highlight values that exist in both columns. To do this, you will need to create an Excel
conditional formatting rule for each column with a combination of
=ISERROR() and =MATCH() functions:
For Column A: =ISERROR(MATCH(A1,$B$1:$B$10000,0))=FALSE

For Column B: =ISERROR(MATCH(B1,$A$1:$A$10000,0))=FALSE


Note. For such conditional formulas to work correctly, it's very important that you apply the rules
to the entire columns, e.g. =$A:$A and =$B:$B.
You can see an example of practical usage in the following screenshot that highlights duplicates
in Columns E and F.

As you can see, Excel conditional formatting formulas cope with dupes pretty well. However, for
more complex cases, I would recommend using the Duplicate Remover add-in that is especially
designed to find, highlight and remove duplicates in Excel 2013, 2010, 2007 and 2003, in one
sheet or between two spreadsheets.
Formulas to highlight values above or below average
When you work with several sets of numeric data, the =AVERAGE function may come in handy
to format cells whose values are below or above the average in a column.

For example, you can use the formula =$E2<AVERAGE($E$2:$E$8) to conditionally format the
rows where the sale numbers are below the average, as shown in the screenshot below. If you
are looking for the opposite, i.e. to shade the products performing above the average, replace
"<" with ">" in the formula: =$E2>AVERAGE($E$2:$E$8).

How to highlight the nearest value in Excel


If I have a set of numbers, is there a way I can use Excel conditional formatting to highlight the
number in that set that is closest to zero? This is what one of our blog readers, Jessica, wanted
to know. The question is very clear and straightforward, but the answer is a bit too long for the
comments sections, that's why you see a solution here :)
Example 1. Find the nearest value, including exact match
In our example, we'll find and highlight the number that is closest to zero. If the data set
contains one or more zeroes, all of them will be highlighted. If there is no 0, then the value
closest to it, either positive or negative, will be highlighted.
First off, you need to enter the following formula to any empty cell in your worksheet, you will be
able to hide that cell later, if needed. The formula finds the number in a given range that is
closest to the number you specify and returns the absolute value of that number (absolute value
is the number without its sign):
=MIN(ABS(B2:D13-(0)))
In the above formula, B2:D13 is your range of cells and 0 is the number for which you want to
find the closest match. For example, if you are looking for a value closest to 5, the formula will
change to: =MIN(ABS(B2:D13-(5)))
Note. This is an array formula, so you need to press Ctrl + Shift + Enter instead of a simple
Enter stroke to complete it.
And now, you create a conditional formatting rule with the following formula, where B3 is the
top-right cell in your range and $C$2 in the cell with the above array formula:
=OR(B3=0-$C$2,B3=0+$C$2)

Please pay attention to the use of absolute references in the address of the cell containing the
array formula ($C$2), because this cell is constant. Also, you need to replace 0 with the number
for which you want to highlight the closest match. For example, if we wanted to highlight the
value nearest to 5, the formula would change to: =OR(B3=5-$C$2,B3=5+$C$2)

Example 2. Highlight a value closest to the given value, but NOT exact match
In case you do not want to highlight the exact match, you need a different array formula that will
find the closest value but ignore the exact match.
For example, the following array formula finds the value closest to 0 in the specified range, but
ignores zeroes, if any:
=MIN(ABS(B3:C13-(0))+(10^0*(B3:C13=0)))
Please remember to press Ctrl + Shift + Enter after you finished typing your array formula.
The conditional formatting formula is the same as in the above example:
=OR(B3=0-$C$2,B3=0+$C$2)

However, since our array formula in cell C2 ignores the exact match, the conditional formatting
rule ignores zeroes too and highlights the value 0.003 that is the closest match.

If you want to find the value nearest to some other number in your Excel sheet, just replace "0"
with the number you want both in the array and conditional formatting formulas.
I hope the conditional formatting formulas you have learned in this tutorial will help you make
sense of whatever project you are working on. If you need more examples, please check out the
following articles:

How to change the row color based on a cell's value


Excel conditional formatting for dates
Alternate row and column colors in Excel
Two ways to change background color based on cell value
Count and sum cells by color in Excel 2010 and 2013
Conditional formatting in Excel PivotTables
Why isn't my Excel conditional formatting working correctly?
If your conditional formatting rule is not working as expected, though the formula is apparently
correct, do not get upset! Most likely it is not because of some weird bug in Excel conditional
formatting, rather due to a tiny mistake, not evident at the first sight. Please try out 6 simple
troubleshooting steps below and I'm sure you will get your formula to work:
1.

Use absolute & relative cell addresses correctly. It's very difficult to deduce a general
rule that will work in 100 per cent of cases. But most often you would use an absolute
column (with $) and relative row (without $) in your cell references, e.g. =$A1>1.

Please keep in mind that the formulas =A1=1, =$A$1=1 and =A$1=1 will produce different
results. If you are not sure which one is correct in your case, you can try all : ) For more
information, please see Relative and absolute cell references in Excel conditional formatting.
2.

Verify the applied range. Check whether your conditional formatting rule applies to the
correct range of cells. A rule of thumb is this - select all the cells / rows you want to format
but do not include column headers.
3.
Write the formula for the top-left cell. In conditional formatting rules, cell references
are relative to the top-left most cell in the applied range. So, always write your conditional
formatting formula for the 1st row with data.
For example, if your data starts in row 2, you put =A$2=10 to highlight cells with values
equal to 10 in all the rows. A common mistake is to always use a reference to the first row
(e.g. =A$1=10). Please remember, you reference row 1 in the formula only if your table does
not have headers and your data really starts in row 1. The most obvious indication of this
case is when the rule is working, but formats values not in the rows it should.
4.

Check the rule you created. Double-check the rule in the Conditional Formatting Rules
Manager. Sometimes, for no reason at all, Microsoft Excel distorts the rule you have just
created. So, if the rule is not working, go to Conditional Formatting > Manage Rules and
check both the formula and the range it applies to. If you have copied the formula from the
web or some other external source, make sure the straight quotes are used.
5.
Adjust cell references when copying the rule. If you copy Excel conditional
formatting using Format Painter, don't forget to adjust all cell references in the formula.
6.
Split complex formulas into simple elements. If you use a complex Excel formula that
includes several different functions, split it into simple elements and verify each function
individually.
And finally, if you've tried all the steps but your conditional formatting rule is still not working
correctly, drop me a line in comments and we will try to fathom it out together :)
In my next article we are going to look into the capabilities of Excel conditional formatting for
dates. See you next week and thanks for reading!

What are Excel sparklines and how to insert them to analyze your data
Do you know what Excel sparklines are and how helpful they can be? Read this article and find
the answers to these questions. You will learn how to insert sparklines in Excel 2010 2013;
change their type, style and color; highlight the most important points and remove sparklines
from cells.
Imagine you are working on a spreadsheet that includes a number of different salespersons and
the amount they sold each month. You want to see how each person's sales are progressing
over time. You can just put this information in one big chart, but it will be hard to pinpoint a trend
for an individual person. Luckily Excel 2010 2013 provides you with a special feature that can
help you give each salesperson a separate mini chart that fits into a single cell. Please
welcome Excel Sparklines!

What is a sparkline in Excel?


How to insert sparklines in Excel 2010 2013
Customize Excel mini charts
Remove sparklines from Excel cells
What is a sparkline in Excel?
First let's define what a sparkline is.
Excel sparkline is a small chart placed in a single cell. It gives you a visual representation of
the selected data set. Sparklines allow you to quickly view and analyze relationships and trends
for multiple data series at the same time. Excel versions 2010 and 2013 offer three types of
sparklines: Line, Column and Win/Loss.
The Line type appears as a simple line chart within a cell. Column sparklines take the form of
simple bar charts reflecting the relative size of the value. Win/Loss shows a basic positive or
negative representation of your data set.

Why should you use sparklines?


Compared to traditional charts, sparklines offer a very different approach to visualizing your
data. The key benefit of using them in your worksheet is that they are compact and don't take
much space. Sparklines are ideal for situations when you need a clear overview of the data at a
glance and when you don't need all features of a full chart. They also make it easy to view and

analyze trends on a more individual basis, and they can really help you manage your worksheet
data.
How to insert sparklines in Excel 2010 2013
Excel sparklines are usually inserted in cells next to the data source. It doesn't matter which of
the three sparklines you want to create, the steps are the same for all types.
1. Select the cells that will serve as the source data for your mini chart.
2. Go to the Sparklines group on the INSERT tab and choose the desired type.

The Create Sparklines dialog box appears on the screen. You see that the selected data range
automatically displays in the Data Range field.
3. Select the cell where you want to place the sparkline. You can just click on the necessary cell
or use the Select Range button to specify the location for your mini chart. The cell reference will
appear in the Location Range field.

4. Click OK.

You see the first sparkline in the cell right next to your source data. If you'd like to apply it for all
other rows of data, you can easily do it by holding and dragging the fill handle.

When you release the mouse button, the sparklines will be inserted in the adjacent cells.

If you have Excel 2013, you can use the Quick Analysis tool to quickly add sparklines to your
data. All you have to do is select the cells in the worksheet and click on the Quick Analysis icon
in the bottom-right corner of the selection. Then switch to the SPARKLINES tab and pick one of
the types.

Note. If you use the Quick Analysis tool for inserting sparklines in Excel 2013, you have a
chance to preview how your data will look with each type. Just hover the pointer over the
respective icon.
Customize Excel mini charts
Once you create sparklines, you may notice that an additional tab appears on the Ribbon. Here
you can find a wide range of tools that'll let you customize your mini charts. So let's make
sparklines stand out a bit.

Show points
Change the sparkline type
Modify the style of a sparkline
Customize Axis settings
Show empty and hidden cells
Before you start modifying your mini charts, I should mention that when you create a range of
sparklines, Excel puts them in a group. As a result it is not necessary to highlight all of the
sparklines when you want to modify them. Change one and you will change them all.
Show points
Since sparklines are so small, the default formatting applied to them by Excel makes it difficult
to identify which values are the highest and lowest points, especially in the line mini chart.
Follow the simple steps described below to see how to emphasize the highs and lows of Excel
sparklines:
1. Click on the cell that contains the sparkline.
2. Go to the Show group on the DESIGN tab.

3. Check the High Point and Low Point options.

The sparklines look more readable with the high and low points marked, don't they?
You can also select First Point and Last Point to clearly mark the beginning and the end of the
line. If you check the box next to Markers, every point will be highlighted, which can make your
sparklines look a bit cluttered. Showing Negative Points will be useful in case you have negative
values in your data.
Change the sparkline type
I've already mentioned that there are three different types of sparklines. You can easily switch
between Line, Column and Win/Loss charts. Just click on a sparkline to activate
the DESIGN tab and select the desired type in the Type group.

Modify the style of sparklines


Let's go on and give a different style to the mini charts.

1. Select the sparkline(s) you want to change.


2. Click on the More down arrow in the Style group on the DESIGN tab.

3. Choose one of the predefined styles in the drop-down menu.


If you want to add a specific style to a sparkline, use the Sparkline Color and the Marker
Colorcommands in the Style group. The first option allows you to change the color of lines or
bars in your mini chart. The second one makes it possible to highlight the most important points
using different colors.

Customize Axis settings


One more fact you should know about sparklines is that by default they are scaled to fit the cell
size. It means when you adjust row-height or column-width of the cell containing a sparkline, the
size of the sparkline changes too. It sounds good, but it can be misleading. Let me explain why.
For example, look at the sparklines in cells G3 and G4 on the screenshot below. You see that
their maximum and minimum values look the same. If you turn to the source data, you will see

that the numbers are different.

Luckily there is a solution to this problem:


1. Select the sparklines you want to modify.
2. Go to DESIGN -> Group and click the Axis command.
3. Select Same for All Sparklines in the Vertical Axis Minimum Value Options and Vertical Axis
Maximum Value Options sections.

Now it is easy to compare one sparkline to another.


You can find some more useful options in the Axis drop-down menu. If you click on the Custom
Value option, it will let you set your own minimum and maximum values for the vertical axis of a
sparkline or a sparkline group. You can also use the Plot Data Right-to-Left option to change the
direction in which data are plotted in a mini chart. If there are negative values in your data,
chooseShow Axis to display the horizontal zero line in your sparkline. You can select Date Axis
Type to format the shape of the chart in a sparkline to reflect any irregular time periods in the
source data.
Show empty and hidden cells
As far as you already know sparklines are usually used for displaying numeric values. What if
you have empty cells in the data source? Don't worry and see below how to control the way a
sparkline displays blanks.
1. Click on a mini chart to make the DESIGN tab visible.
2. Go to the Sparklines group and open the Edit Data drop-down menu.
3. Choose the Hidden & Empty Cells option.

4. Select the way for a sparkline to show empty cells in the Hidden and Empty Cell
Settings dialog box.

Here you can also check the box next to Show data in hidden rows and columns to display such
values in your sparkline.

The Edit Data option also allows you to change the location and data source for a sparkline
group or a single mini chart.
We examined in depth how you can customize your mini charts and the time has come to know
how to delete sparklines from your Excel worksheet.
Remove sparklines from Excel cells
If you want to get rid of a sparkline, the Delete button won't help with this task. You should use
one of the following methods:
1. Right-click on the mini chart and select Sparklines -> Clear Selected Sparklines from the
context menu.

Note. If you want to delete the entire group, choose the Clear the Selected Sparkline
Groupsoption.

2. Alternatively, select the cell with a sparkline, go to DESIGN -> Group and click the down
arrow next to Clear. You will see the same options as in the right-click menu. Choose the option
you need.

In this article I tried to cover all the bases of creating and customizing sparklines in Excel 2010
2013. Now you know how to insert a sparkline; change its type, style and color; highlight the
most important points and remove sparklines from Excel cells. If I've forgotten to say anything
about this useful feature, let me know in the comments. Thank you for reading!

Excel conditional formatting Icon Sets, Data Bars and Color Scales
The article provides the detailed guidance on how use conditional formatting Icon Sets, Data
Bars and Color Scales in Excel 2013, 2010 and 2007. It will teach you how to extend these
conditional formats beyond their common uses and apply icons based on another cell's value.
Last week we started to explorer various features and capabilities of Conditional formatting in
Excel 2007, 2010 and 2013. If you have not got a change to read that article, you may want to
do this know. If you already know the basics, let's move on and see what format options you
have with regard to Excel's icon sets, color scales and data bars and how you can leverage
them for your projects.
When you click the Conditional Formatting button, a drop-down menu offers you a handful of
pre-defined formatting rules. Let's quickly go through them, one at a time.

Icon sets
Data Bars
Color Scales
Excel conditional formatting Icon Sets
Excel conditional formatting icon sets will help you visually represent your data with arrows,
shapes, check marks, flags, rating starts and other objects.

You apply the icon sets to your data by clicking Conditional Formatting > Icon Sets, and the
icons appear inside selected cells straight away.

In the screenshot above, you can see a table listing the household spendings with a green circle
representing the highest value and red circles lower values. I cannot say that Excel has
interpreted the data in the way I wanted, so let's customize the icon set a bit. To do this,
click More Rules...underneath the icon sets list to bring up the New Formatting Rule dialog.

From here you are able to choose other icons and assign them to different values. I have
decided to stick with the same icons but assign them in a different way:

Tips:

To change the order of icons, click the Reverse Icon Order button.
To hide the cells' values, select the Show Icon Only check box.
To assign icons based on a cell's value instead of specifying a number or percent, type
the cell's address in the Value box or click the selection range icon to select a cell, as shown in
the screenshot below.

How to apply an Excel icon set based on other cells' values


A common opinion is that Excel conditional formatting icon sets can only be used to format cells
based on their own values. But this is a delusion. With just a little creativity, you can assign

icons depending on the values of other cells in a row or based on another cell's value, as
demonstrated in the following examples.
Example 1. Apply an icon set based on other cells in a row (blanks vs. non-blanks)
Suppose, you have a list of products that includes units in stock, delivery and other details.
What you want is to add different icons at the beginning of each row depending on whether
other cells in the same row are blank or non-blank. That is, you will add a check mark in Column
A if all cells in a row are filled in with data, an exclamation mark if some cells are blank, and a
cross icon if all cells in a row are blank. To use an Excel icon set in this way, perform the
following steps:
1. Add an empty column in front of your table (Column A).
2. Copy the following formula across Column A: =COUNTBLANK(B2:F2), where F is the last
column in your table. This formula will count the number of blank cells in each row.
3. Apply the conditional formatting icon set rule to Column A by clicking More Rules..., as
explained above.
4. In the New Formatting Rule dialog, do the following:

Click the Reverse Icon Order button to change the order of icons.
Select the Icon Set Only checkbox.
For the cross icon, set >=5 (where 5 is the number of columns in your table, excluding
the first "Icon" column).
For the exclamation mark icon, set >=1.
Set Type to "Number" for both icons.

You can verify the settings in the screenshot below:

And here is the result:

Example 2. Add icons based on another cell's value


Suppose, you have a list of orders and you need to add a green flag to column A when a certain
product is delivered, i.e. there is any value in the corresponding cell in column D (Delivery
Date). If there is no value in column D, a red flag should be placed in column A.
In fact, this example is very similar to the previous one, with the difference that you apply a 2icon set based on the value in another column.

1. And again, you start by adding a formula to column A. This time we will use the IF function:
=IF($D2<>"",3,1). The formula says to put 3 in column A if there is any value in the
corresponding cell in column D, otherwise put 1. Naturally, you will need to replace D with the
column you base your formatting on.

2. Select all cells in column A, except for the column header, and create a conditional formatting
icon set rule by clicking Conditional Formatting > Icon sets > More Rules...
3. In the New Formatting Rule dialog, select the following options:

Click the Reverse Icon Order button to change the icons' order.
Select the Icon Set Only checkbox.
For the green flag, set >=3.
For the yellow flag, set >2. As you remember, we do not really want a yellow flag
anywhere, so you set a condition that will never be met, i.e. a value greater than 2 and less than
3.
Set Type to "Number" for both icons.

And here is the result of your effort - the green and red flag icons are added to column A based
on the value in column D.

Excel conditional formatting Data Bars


You use conditional formatting Data Bars to represent data graphically inside a cell. The longest
bar represents the highest value and, as you can easily guess, shorter bars represent smaller
values. Data bars can help you spot large and small numbers in your spreadsheets, for example
top-selling and bottom-selling products in your sales reports.

You apply data bars in Excel in the already familiar way - simply select the cells,
click Conditional Formatting > Data Bars and choose the bar type you want. Once you do
this, the colored bars will be placed inside the selected cells.

As you can see in the screenshot above, Excel conditional formatting data bars work very well
to visually show your household spendings.
If you want to apply your own data bar style, click More Rules... as usual to bring up the Edit
Formatting Rule window, where you choose the desired options:

Place a check in the Show Bar Only checkbox to hide the cells' values and display the
colored bars only.
To select the Minimum and Maximum data types, click the little black arrow next to the
corresponding box. While the Automatic type works fine in most cases, you can also choose
some other data type such as percent, number, formula, etc.
Experiment with Fill color, Border and Bar direction and click OK when you are happy
with theData Bar Preview.

Excel conditional formatting Color Scales


Using conditional formatting Color Scales, you can format your cells with two or three color
gradients, where different color shades represent different cell values.
You can start by clicking Conditional formatting > Color Scales and hovering over the
thumbnails of ready-to-use color scales Excel has already created for you. The 2-color green-

white color scale seems to have worked pretty well too for my household budget:

But if you really want to impress someone and have the time and desire to experiment, try out
theMore Rules... option again and play with the colors a bit. First off, you choose either a 2Color or 3-Color scale, then select your own colors and assign them to the minimum, maximum,

and midpoint values.

This is how you use Excel's icon sets, color scales and data bars. Very intuitive and userfriendly, aren't they? If you are curious to learn other conditional formatting rule types, the
following tutorials may come in handy:

How to change the row color based on a cell's value


How to apply banded rows and columns in Excel
How to change a cell's background color based on its value
Excel conditional formatting for dates
How to count and sum cells by color in Excel 2010 and 2013
How to automatically highlight duplicates in Excel
Conditional formatting in Excel PivotTables
In the next article we are going to investigate arcane twists of Excel conditional formatting
formulas, please stay tuned!

How to use AutoFill in Excel 2010, 2013 - all fill handle options
This post looks at the AutoFill Excel feature. You will learn how to fill down series of numbers,
dates and other data, create and use custom lists in Excel 2010, 2013 and lower. This article
also lets you make sure you know everything about the fill handle, cause you may be surprised
how powerful this tiny option is.
When you are pressed for time, every single minute counts. So you need to know every way to
automate daily spreadsheet tasks. AutoFill in Excel is a popular feature, and I'm sure most of
you already use it. However, it may be a new fact for you that it's not only about copying values
down a column or getting a series of numbers or dates. It's also about creating custom lists,
double-clicking to populate a large range and much more. If you know where the fill handle is
located, it's high time to find out all the benefits it stores.
Below you see a plan of the post. Just click on the link you find especially interesting to get right
to the point.

o
o
o
o
o
o
o
o

Use AutoFill to populate a range in Excel


All AutoFill Excel options:
Double-click the fill handle to auto-populate a large range
Excel - fill down a series of values that contain text
Create custom list series in Excel
Use the AutoFill option to get repeating series
Filling down cells horizontally and vertically
Autofill several rows or columns
Automatically insert empty cells when filling a range
Use the Auto Fill Options list to fine tune the way the data are entered
Excel - autofill formulas
Flash fill in Excel 2013
Enable or disable autofilling cells
Switch Auto Fill Options on or off
Use AutoFill Excel option to populate a range in Excel 2010-2013 and lower
Whether you just want to copy the same value down or need to get a series of numbers or text
values, fill handle in Excel is the feature to help. It's an irreplaceable part of the AutoFill option.
Fill handle is a small square that appears in the bottom-right corner when you select a cell or
range.

It may be hard to believe that this tiny, almost unnoticeable part of selection gives you numerous
helpful options to use every day.

The scheme is simple. Whenever you need to get a series of values in the adjacent cells, just
click on the Excel fill handle to see a small black cross and drag it vertically or horizontally. As
you release the mouse button, you will see the selected cells filled with the values depending on
the pattern you specify.

One of the most popular questions is how to autofill numbers is Excel. This can also be dates,
times, days of the week, months, years and so on. In addition, Excel's AutoFill will follow any
pattern.
For example, if you need to continue a sequence, just enter the first two values into the starting
cell and grab the fill handle to copy the data across the specified range.

You can also auto-populate any arithmetic progression sequence where the difference between
numbers is constant.

It will even alternate sequences if the selected cells don't relate to each other numerically, like
on the picture below.

And it goes without saying, that you can use the AutoFill option to copy a value across your
range. I think you already know how to make the same value appear in the adjacent cells in
Excel. You just need to enter this number, text, or their combination, and drag it across the cells
using the fill handle.
Presume you have already heard of the features I described above. I still believe, some of them
appeared new to you. So go on reading to learn even more about this popular yet underexplored tool.
All AutoFill Excel options - see the fill handle at its best
Double-click to automatically populate a large range
Suppose you have a huge database with names. You need to assign a serial number to each
name. You can do it in a flash by entering the first two numbers and double-clicking the Excel fill

handle.

Note. This hint will only work if you have values to the left or right of the column you need to fill
as Excel looks at the adjacent column to define the last cell in the range to fill. Please also keep
in mind that it will populate by the longest column in case you have values to the right and to the
left of the empty range you want to fill down.
Excel - Fill down a series of values that contain text
It's not a problem for the AutoFill option to copy across the values that contain both text and
numerical values. Moreover, Excel is quite smart to know that there are only 4 quarters or that

some ordinal numbers need the corresponding letter suffixes.

Create custom list series for autofilling


If you use the same list every now and then, you can save it as a custom one and make Excel
fill handle populate cells with the values from your custom list automatically. Please follow the
steps below to do this:
1. Enter the header and complete your list.

Note. A custom list can only contain text or text with numerical values. If you need it to store
only numbers, please create a list of digits formatted as text.
2. Select the range with your list.
3. In Excel 2003 go to Tools -> Options -> Custom Lists tab.
In Excel 2007 click on the Office button -> Excel options -> Advanced -> scroll down till you see
theEdit Custom Lists button in the General section.

In Excel 2010-2013 click File -> Options -> Advanced -> scroll to the General section to find
the Edit Custom Lists button.

4. Since you already selected the range with your list, you will see its address in the Import list
from cells: field.

5. Press the Import button to see your series in the Custom Lists window.

6. Finally click OK -> OK to save the list.


When you need to get this list autofilled, enter the name of the header into the necessary cell.
Excel will recognize the item and when you drag the fill handle in Excel across your range, it will
populate it with the values from your list.

Use the AutoFill option to get repeating series


If you need a series of recurring values, you can still use the fill handle. For example, you need
to repeat YES, NO, TRUE, FALSE sequence. First, enter all these values manually to give Excel
a pattern. Then just grab the fill handle and drag it to the necessary cell.

Autofilling horizontally and vertically


Most likely, you use AutoFill to populate cells down a column. However, this feature also works if
you need to extend a range horizontally, leftward or upward. Just select the cells with the
value(s) and drag the fill handle to the needed direction.

Autofill multiple rows or columns


The Excel Autofill can deal with data in more than one row or column. If you pick two, three or
more cells and drag the fill handle they all will be populated.

Insert empty cells when filling down a series


AutoFill also enables you to create a series with empty cells like on the screenshot below.

Use AutoFill Options list to fine tune the way the data is entered
You can adjust the settings with the help of the AutoFill Options list to get the exact results.
There are two ways to get this list.

1. Right-click on the fill handle, drag and drop it. Then you will see a list with options
automatically pop up like on the screenshot below:

Let's see what these options offer.

Copy Cells - populates a range with the same value.


Fill Series - works if you select more than one cell and the values are different. AutoFill
will generate the range according to a given pattern.
Fill Formatting Only - this Excel AutoFill option will only get the format of the cell(s)
without pulling any values. It can be helpful if you need to quickly copy the formatting and then
enter the values manually.
Fill Without Formatting - copies values only. If the background of the starting cells is red,
the option will not preserve it.
Fill Days / Weekdays / Months / Years - these features do what their names suggest. If
your starting cell contains one of those, you can quickly have it complete the range by clicking
one of the options.
Linear Trend - creates a linear series or linear best-fit trend.
Growth Trend - generates a growth series or geometric growth trend.
Flash Fill - helps you enter plenty of repetitive information and format your data in the
right way.
Series - this option pops up the Series dialog box with a number of advanced
possibilities to choose from.

2. The other way to get the list is to click on the fill handle, drag and drop it and then click on
theAuto Fill Options icon.

When you click on this icon you get a list with AutoFill options.

This list just repeats some features from the previous part.

Excel - Autofill formulas


Autofilling formulas is a process pretty much similar to copying values down or getting a series
of numbers. It involves drag-n-dropping the fill handle. You will find some helpful tips and tricks
in one of our previous posts named The fastest way to insert a formula into the entire column.
Flash fill in Excel 2013
If you use Office 2013, you can try Flash Fill, a new feature introduced in the most recent Excel
version.

Now I will try to briefly describe what it does. Flash Fill instantly studies the data you enter and
the format you use and checks if these data are already in your worksheet. If Flash Fill
recognizes these values and grabs the pattern, it offers you a list based on this mode. You can

click Enter to paste it or ignore the offer. Please see it in action on the picture below:

Flash Fill enables you to format numerous names, dates of birth, and phone numbers in a click
of a mouse. You just enter initial data, which Excel quickly recognizes and uses. I promise that
one of our upcoming articles will give you as many details on this interesting and helpful feature
as possible.
Enable or disable the AutoFill feature in Excel
The fill handle option is turned on in Excel by default. So whenever you select a range you can
see it in the bottom-right corner. In case you need to get Excel AutoFill not working, you can
switch it off by doing the following:
1. Click on File in Excel 2010-2013 or on the Office button in version 2007.
2. Go to Options -> Advanced and untick the checkbox Enable fill handle and cell drag-anddrop.

Note. To prevent replacing the current data when you drag the fill handle, make sure that
theAlert before overwriting cells check box is ticked. If you don't want Excel to display a
message about overwriting non-blank cells, just clear this check box.
Turn Auto Fill Options on or off
If you don't want to display the Auto Fill Options button every time you drag the fill handle, just
turn it off. Similarly, if the button does not show when you use the fill handle, you can turn it on.
1.

Go to File / Office button -> Options -> Advanced and find the Cut, copy and paste
section.
2.
Clear the Show Paste Options buttons when content is pasted check box.

In Microsoft Excel, AutoFill is a feature that allows the user to extend a series of numbers,
dates, or even text to the necessary range of cells. This little option gives you plenty of
possibilities. Use Flash Fill in Excel, autofill dates and numbers, populate numerous cells, and
get custom list values.
That's it! Thank you for reading to the end. Now you know it all, or almost all about the AutoFill
option. Subscribe to our blog to learn even more about this and other helpful Excel features.
Let me know if I didn't manage to cover all the questions and issues you have and I'll be happy
to help you. Just drop me a line in the comments. Be happy and excel in Excel!

How to use conditional formatting in Excel 2010, 2013 and 2007


The tutorial explains the basics of Excel conditional formatting feature. You will learn how to
create different formatting rules, how to do conditional formatting based on another cell, how to
edit and copy your formatting rules in Excel 2007, 2010 and 2013.
Excel conditional formatting is a really powerful feature when it comes to applying different
formats to data that meets certain conditions. It can help you highlight the most important
information in your spreadsheets and identify variances of cells' values with a quick glance.
At the same time, Conditional Formatting is often deemed as one of the most intricate and
obscure Excel functions, especially by beginners. If you feel intimidated by this feature too,
please don't! In fact, conditional formatting in Excel is very straightforward and easy to use, and
you will make sure of this in just 5 minutes when you have finished reading this short tutorial.

Excel conditional formatting basics


Where is conditional formatting in Excel?
How to create conditional formatting rules
Apply several rules to one cell
Edit conditional formatting rules
Copy conditional formatting in Excel
Delete formatting rules
The basics of Excel conditional formatting
The same as usual cell formats, you use conditional formatting in Excel to format your data in
different ways by changing cells' fill color, font color and border styles. The difference is that
conditional formatting is more flexible, it allows you to format only the data that meets certain
criteria, or conditions.
You can apply conditional formatting to one or several cells, rows, columns or the entire table
based on the cell contents or based on another cell's value. You do this by creating rules
(conditions) where you define when and how the selected cells should be formatted.
Where is conditional formatting in Excel?
For a start, let's see where you can find the conditional formatting feature in different Excel
versions. And the good news is that in all modern versions of Excel, conditional formatting
resides in the same location, on the Home tab > Styles group.
Conditional formatting in Excel 2007

Conditional formatting in Excel 2010

Conditional formatting in Excel 2013

Now that you know where the conditional formatting feature is located in Excel, let's move on
and see what format options you have and how you can create your own rules.
How to create Excel conditional formatting rules
To truly leverage the capabilities of conditional format in Excel, you have to learn how to create
various rule types. This will help you make sense of whatever project you are currently working
on.
Conditional formatting rules in Excel define 2 key things:

What cells the conditional formatting should be applied to, and


Which conditions should be met.
I will show you how to apply conditional formatting in Excel 2010 because this seems to be the
most popular version these days. However, the options are essentially the same in Excel 2007
and 2013, so you won't have any problems with following no matter which version is installed on
your computer.
1. In your Excel spreadsheet, select the cells you want to format.
For this example, I've created a small table listing the monthly crude oil prices. What we want is
to highlight every drop in price, i.e. all cells with negative numbers in the Change column, so we

select the cells C2:C9.

2. Go to the Home tab > Styles group and click Conditional Formatting. You will see a number
of different formatting rules, including data bars, color scales and icon sets.
3. Since we need to apply conditional formatting only to the numbers less than 0, we
chooseHighlight Cells Rules > Less Than...

Of course, you can go ahead with any other rule type that is more appropriate for your data,
such as:

Format values greater than, less than or equal to


Highlight text containing specified words or characters

Highlight duplicates
Format specific dates
4. Enter the value in box in the right-hand part of the window under "Format cells that are LESS
THAN", in our case we type 0. As soon as you have entered the value, Microsoft Excel will
highlight the cells in the selected range that meet your condition.
5. Select the format you want from the drop-down list. You can choose one of the pre-defined
formats or click Custom Format... to set up your own formatting.

5. In the Format Cells window, switch between the Font, Border and Fill tabs to choose the font
style, border style and background color, respectively. On the Font and Fill tabs, you will
immediately see a preview of your custom format.

6. When done, click the OK button at the bottom of the window.

Tips:

If you want more background or font colors than the standard palette provides, click
the More Colors... button on the Fill or Font tab.
If you want to apply a gradient background color, click the Fill Effects button on
the Fill tab and choose the desired options.
7. Click OK to close the "Less Than" window and check whether the conditional formatting is
correctly applied to your data.

As you can see in the screenshot below, our newly created conditional formatting rule works
right - it shades all the cells with a negative price change.

Creating an Excel conditional formatting rule from scratch


If none of the ready-to-use formatting rules is suitable for your needs, you can create a new one
from scratch.
1. Select the cells to which you want to apply the conditional format and click Conditional
Formatting > New Rule.

2. The New Formatting Rule dialog opens and you select the needed rule type. For example,
let's choose "Format only cells that contain" and opt to format the cell values between 60

and 70.

3. Click the Format... button and set up your formatting exactly as we did in the previous
example.

4. Click OK twice to close the open windows and your conditional formatting is done!

Excel conditional formatting based on cell's value


In both of the previous examples, we created the formatting rules by entering the numbers.
However, in some cases it makes more sense to base your condition format on a certain cell's
value. The advantage if this approach is that no matter how that cell's value changes in the
future, your conditional formatting will adjust automatically and reflect the data change.
For instance, let's use the "Oil price" example again, but this time highlight all the prices in
column B that are greater than February's price.
You create the rule in a similar fashion by selecting Conditional formatting > Highlight Cells
Rules > Greater Than... But instead of typing a number in step 4, you select cell B6 by clicking
the range selection icon as you usually do in Excel. As the result, the prices get formatted as
you see in the screenshot below.

This is the simplest example of Excel conditional formatting based on another cell. Other, more
complex scenarios, may require the use of formulas. And you can find several examples of such
formulas along with the step-by-step instructions in this article: How to change a cell color based
another cell's value.

This is how you do conditional formatting in Excel. Hopefully, these very simple rules we have
just created was helpful to understand the general approach.
Apply several conditional formatting rules to one cell / table
When using conditional formatting in Excel, you are not limited to only one rule per cell. You can
apply as many rules as your project's logic requires.
For example, let's create 3 rules for the weather table that will shade temperatures higher than
60 F in yellow, higher than 70 F in orange, and higher than 80 F in red.
You already know how to create Excel conditional format rules of this kind - by
clicking Conditional Formatting > Highlight Cells rules > Greater than. However, for the rules to
work correctly, you also need to set their priority in this way:
1. Click Conditional Formatting > Manage Rules... to bring up the Rules Manager.
2. Click the rule that needs to be applied first to select it, and move it to the top using
the upward arrow. Do the same for the second-in-priority rule.

3. Select the Stop If True check box next to the first 2 rules because you do not want the other
rules to be applied when the first condition is met.

Using "Stop If True" in conditional formatting rules


We have already used the Stop If True option in the example above to stop processing other
rules when the first condition is met. That usage is very obvious and straightforward. Now let's
consider two more examples where the use of the Stop If True function is not so obvious but
also very helpful.

Example 1. Show only some items of the icon set


Suppose, you have added the following icon set to your sales report.

It looks nice, but a bit inundated with graphics. So, our goal is to keep only the red down arrows
to draw attention to the products performing below the average and get rid of all other icons.
Let's see how you can do this:
1. Create a new conditional formatting rule by clicking Conditional formatting > New Rule >
Format only Cells that contain.
2. Now you need to configure the rule in such a way that it gets applied only to the values
greater than the average. You do this by using the =AVERAGE() formula, as shown in the
screenshot below.
Tip. You can always select a range of cells in Excel using the standard range selection icon
or type the range inside the brackets manually. If you opt for the latter, remember to use
absolute cell references with the $ sign.

3. Click OK without setting any format.

4. Click Conditional Formatting > Manage Rules... and put a tick into the Stop if True check box
next to the rule you have just created. And... see the result in the screenshot below : )

Example 2. Remove conditional formatting from empty cells


Suppose you created the "Between" rule to highlight cells' values between $0 and $1000, as
you can see in the screenshot below. But the problem is that empty cells are also highlighted.

To fix this, you create one more rule of the "Format only cells that contain" type. In the New
Formatting rule dialog, select Blanks from the drop-down list.

And again, you simply click OK without setting any format.


Finally, open the Conditional Formatting Rule Manager and select the Stop if true check box
next to the "Blanks" rule.

The result is exactly as you would expect : )

How to edit conditional formatting rules in Excel


If you've had a close look at the screenshot above, you probably noticed the Edit Rule... button
there. So, if you want to change an existing formatting rule, proceed in this way:
1. Select any cell to which the rule applies and click Conditional Formatting > Manage Rules...

2. In the Conditional Manager Rules Manager dialog, click the rule you want to edit, and then
click the Edit Rule... button.

3. Make the required changes in the Edit Formatting Rule window and click OK to save the
edits.
The Edit Formatting Rule window looks very similar to the New Formatting Rule dialog you used
when creating the rule, so you won't have any difficulties with it.
Tip. If you don't see the rule you want to edit, select This Worksheet from the "Show formatting
rules for" drop-down list to display the list of all rules in your worksheet.

How to copy conditional formatting in Excel


If you want to apply the conditional format you have created earlier to other data on your
worksheet, you won't need to create the rule from scratch. Simply use Format Painter to copy
the existing conditional formatting to the new data set.
1. Click any cell with the conditional formatting you want to copy.
2. Click Home > Format Painter. This will change the mouse pointer to a paintbrush.

Tip. You can double-click Format Painter if you want to paste the conditional formatting in
several different ranges of cells.
3. To paste the conditional formatting, click on the first cell and drag the paintbrush down to the
last cell in the range you want to format.

4. When done, press Esc to stop using the paintbrush.


Note. If you've created the conditional formatting rule using a formula, you may need to adjust
cell references in the formula after copying the conditional format.
How to delete conditional formatting rules
I've saved the easiest part for last : ) To delete a rule, you can either:

Open the Conditional Manager Rules Manager (as you remember, you open it
via Conditional Formatting > Manage Rules...), select the rule and click the Delete Rule button.
Select the range of cells, click Conditional Formatting > Clear Rules and choose one of
the available options.

Now you have basic knowledge of Excel conditional format. In the next article, we will focus on
more advanced features that will help you push conditional formatting in your spreadsheets far
beyond its traditional uses.
And in the meantime, you may want to check out a few more examples of Excel conditional
formatting:

Excel Icon Sets, Data Bars and Color Scales - learn how to extend these conditional
formats beyond their common uses, e.g. apply icons based on another cell's value.
Excel formulas for conditional formatting based on another cell - the tutorial explains how
to use Excel formulas to format individual cells and entire rows based on the values you specify
or based on another cell's value.
How to conditionally format dates in Excel - how to apply Excel conditional formatting to
dates using built-in rules and formulas.
How to change the row color based on a cell's value in Excel - see how you can quickly
shade the entire row based on a numeric or text value of a single cell.
Alternate row colors and column shading in Excel - the article explains how to alternate
row and column shading in Excel using table styles (banded rows and columns) and conditional
formatting.
Change background color based on cell value - two quick ways to change the
background color of cells based on their values in Excel 2013, 2010 and 2007.
How to count and sum cells by color in Excel 2010 and 2013 - see how you can count
cells by color and get the sum of colored cells automatically. The solutions work both for cells
colored manually and with conditional formatting.

How to automatically highlight duplicates in Excel - the article explains how to use
conditional formatting to highlight duplicates values.
Conditional formatting in Excel PivotTables - this tutorial covers some of the differences
in PivotTable formatting in Excel 2010.

How to recover unsaved Excel file or restore its previous version


Do you want to protect your workbooks from unexpected computer crashes or power failures?
This article explains how to recover unsaved files and restore previous versions of your
workbook in Excel 2010 - 2013. You'll also learn different ways of file backup on your PC or in
the cloud.
Just imagine that you have been working on a very important document in Excel for some
hours, creating a very complicated graph, and then... oops! Excel crashed, the power went out
or you accidentally closed a file without saving. That is frustrating, but don't be so cut up about it
- you can easily recover your unsaved document.
What is the worst that could be? While working on a workbook you found out that you made a
mistake about an hour ago, you already made a lot of changes since that time and undo is not
an option. If you want to know how to retrieve an overwritten Excel file, go ahead and read this
article.

Excel AutoSave and AutoRecover


How to recover unsaved files in Excel
Recover overwritten Excel files
How to save a backup copy of your workbook
Create time-stamped backup versions in Excel 2010 - 2013
Back up Excel files to the cloud
Excel AutoSave and AutoRecover
Excel provides us with such good features as AutoSave and AutoRecover. If they are enabled,
it won't be a problem for you to recover unsaved files and restore previous versions in Excel
2010 - 2013. But these two features are often misunderstood, so at first let's define what they
mean.
Excel AutoSave is a tool that automatically saves a new document that you've just created, but
haven't saved yet. It helps you not to lose important data in case of a computer crash or power
failure.
Excel AutoRecover helps you retrieve unsaved files after an accidental closure or crash. It
allows you to restore to the last saved version which displays in the Document Recovery pane

when you start Excel next time.

Note. The AutoRecover feature only works on Excel workbooks that have been saved at least
once. If you never save a document before a computer crash, the Document Recovery pane
won't show up in Excel.
Luckily, the options to auto save and auto recover files are turned on in Excel by default. If you
are not sure, you can easily check them up.
How to configure the AutoSave (AutoRecover) settings in Excel:
1. Go to the FILE tab and choose Options from the FILE menu
2. Click Save on the left-hand pane of the Excel Options dialog.

3. Make sure that both Save AutoRecover information every X minutes and Keep the last
autosaved version if I close without saving are checked.

4. Click OK.
By default the AutoRecover feature is set to automatically save changes to your workbook every
10 minutes. You can shorten or lengthen this interval as you like. Here you can also change
Excel AutoRecover file location and specify AutoRecover exceptions.
Tip. If you want to be more secure in case of a crash or electricity failure, you should lower the
time interval for saving information. The more frequently the document is saved, the more
versions you have, the more chances to get all the changes back.
Now when Excel is configured to auto save and auto recover your documents, you will easily
restore a file when something goes wrong. Further in this article you'll find out how to recover
new files that you've just created and the ones that you've already saved.
How to recover unsaved Excel files
Suppose you are working on a new document in Excel and the program locks up unexpectedly.
In a few seconds you realize that you didn't save the workbook. Don't panic and discover below
how to recover an unsaved file.
1. Go to FILE -> Open.

2. Choose Recent Workbooks.

3. Scroll down and click on the Recover Unsaved Workbooks button at the bottom of the list.

Note. You can also go to FILE - > Info, open the Manage Workbooks drop-down and
selectRecover Unsaved Workbooks from the menu.

4. When the Open dialog box pops up, just select the necessary file and click Open.

The document will open in Excel and the program will prompt you to save it. Click on the Save
Asbutton in the yellow bar above your worksheet and save the file to the desired location.

Recover overwritten Excel files


Excel 2010 and 2013 make it possible not only to restore the unsaved workbooks, but also to
recover previous versions of your document. It is especially helpful when you make a mistake
that you can't undo, or when you want to see how the document looked like a few minutes
earlier. See below how to retrieve an overwritten Excel file:

Click on the FILE tab and choose Info on the left-hand pane. Next to the Manage
Versions button you'll see all autosaved versions of your document.

Excel automatically saves versions of the workbook at specified intervals, but only if you've
made changes to your spreadsheet between these intervals. The name of each version has a
date, time and the "(autosave)" note. When you click any of them, it will open along with the
most current version of your workbook so that you can compare them and see all the changes.
If the program closed incorrectly, the last autosaved file is labeled with the words (when I
closed without saving).

When you open this file in Excel, you'll get the message above your worksheet. Just click on
theRestore button in the yellow bar to revert to the newer unsaved version of the workbook.

Note. Excel deletes all previously autosaved versions when you close the document. If you
want to look at the previous version again, it is better to create a backup copy of your data.
How to save a backup copy of your workbook
Excel's Auto Backup is a very useful feature that can help you retrieve a previously saved
version of your workbook. Saving a backup copy can protect your work if you accidentally save
changes that you do not want to keep or delete the original file. As a result, you will have the
current saved information in the original workbook and all previously saved information in the
backup copy.
Though this feature is very helpful, it is hard enough to find in Excel 2010 / 2013. So let's do it
together now:
1. Go to FILE - > Save As.

2. Select Computer and click on the Browse button.

3. When the Save As dialog window pops up, click on the small arrow next to the Tools button at
the bottom of the window.

4. Select General Options... from the drop-down list.

5. Check the Always create backup box in the General Options dialog and click OK.

Now you can rename your file and choose the desired location to save it. Excel will create a
backup copy of the document in the same folder.
Note. A backed up copy is saved with different .xlk file extension. When you open it, Excel will
ask you to verify that you really want to open this workbook. Just click Yes and you can restore

a previous version of your spreadsheet.

Create time-stamped backup versions in Excel 2010 - 2013


Now you know how to enable the Excel Auto Backup option. However, every time you save a
workbook, a new backup copy will replace the existing one. How can you get back to the earlier
version if you've already saved the document several times? Take it easy - you have at least two
ways out from this situation.
The first one is to use ASAP Utilities. They offer the Save file and create backup tool that helps
you create multiple backup versions of your document. Once you install these utilities in Excel,
you can use a special keyboard shortcut to save your workbook and automatically create a
backup copy. Each version has a timestamp in the file name, so you can easily find the
necessary copy according to the date and time it was created.
If you are comfortable with VBA, you can use a special Excel AutoSave macro to backup your
files. Just copy it from this article and paste into the code Module. You can create as many
backup copies as you want just by pressing a simple shortcut. It will restore a previously saved
version of your workbook and won't overwrite any old backup file. Each copy is marked with a
date and time of backup.
Back up Excel files to the cloud
For those who use cloud storage services for saving their docs, retrieving overwritten Excel files
won't be a problem at all.
Let's have a closer look at OneDrive, Microsoft's storage option. Its biggest strength is that
OneDrive is closely tied with Office. As an example, you can quickly open and save OneDrive
documents right from your Excel. OneDrive and Excel work together to sync workbooks faster
and let you work with other people on shared documents at the same time.
When you or your colleague makes changes to a document, OneDrive keeps track of the
versions automatically, so you don't need to store multiple copies of the same document. With
OneDrive's Version history you'll be able to see the earlier variants of the file, you'll know when
the document was modified and who made the changes. You can also restore any of the
previous versions if necessary.

Another very popular cloud storage service is Dropbox. It keeps snapshots of every change in
your Dropbox folder over the last 30 days. So even if you saved a bad change, or if the file has
been damaged or deleted, you can restore the document to an older version with only a few
clicks. Dropbox doesn't work so closely with Microsoft Office as OneDrive, but it is so simple
that everybody can master it.
Now you know different ways to recover unsaved files and create a backup copy of your
workbook in Excel 2010 and 2013. And I hope you won't push the panic button next time when
your computer crashes or power goes out.

How to make a Gantt chart in Excel 2010 and 2013


If you were asked to name three key components of Microsoft Excel, what would they be? Most
likely, spreadsheets to input data, formulas to perform calculations and charts to create
graphical representations of various data types.
I believe, every Excel user knows what a chart is and how to create it. However, one graph type
remains opaque to many - the Gantt chart. This short tutorial will explain the key features of the
Gantt diagram, show how to make a simple Gantt chart in Excel, where to download advanced
Gantt chart templates and how to use the online Project Management Gantt Chart creator.

What is the Gantt diagram?


How to make a Gantt chart in Excel
Excel Gantt chart templates
What is a Gantt chart?
The Gantt chart bears a name of Henry Gantt, American mechanical engineer and
management consultant who invented this chart as early as in 1910s. A Gantt diagram in Excel
represents projects or tasks in the form of cascading horizontal bar charts. A Gantt chart
illustrates the breakdown structure of the project by showing the start and finish dates as well as
various relationships between project activities, and in this way helps you track the tasks against
their scheduled time or predefined milestones.

How to make Gantt chart in Excel 2010, 2007 and 2013


Regrettably, Microsoft Excel does not have a built-in Gantt chart template as an option.
However, you can quickly create a Gantt chart in Excel by using the bar graph functionality and
a bit of formatting.

Please follow the below steps closely and you will make a simple Gantt chart in under 3
minutes. We will be using Excel 2010 for this Gantt chart example, but you can simulate Gantt
diagrams in Excel 2007 and Excel 2013 exactly in the same way.
1. Create a project table
You start by entering your project's data in an Excel spreadsheet. List each task is a separate
row and structure your project plan by including the Start date, End date and Duration, i.e. the
number of days required to complete the tasks.
Tip. Only the Start date and Duration columns are really necessary for creating an Excel Gantt
chart. However, if you enter the End Dates too, you can use a simple formula to
calculateDuration, as you can see in the screenshot below.

2. Make a standard Excel Bar chart based on Start date


You begin making your Gantt chart in Excel by setting up a usual Stacked Bar chart.

Select a range of your Start Dates with the column header, it's B1:B11 in our case. Be
sure to select only the cells with data, and not the entire column.
Switch to the Insert tab > Charts group and click Bar.
Under the 2-D Bar section, click Stacked Bar.

As a result, you will have the following Stacked bar added to your worksheet:

Note. Some other Gantt Chart tutorials you can find on the web recommend creating an empty
bar chart first and then populating it with data as explained in the next step. But I think the
above approach is better because Microsoft Excel will add one data series to the chart
automatically, and in this way save you some time.
Step 3. Add Duration data to the chart
Now you need to add one more series to your Excel Gantt chart-to-be.
1. Right-click anywhere within the chart area and choose Select Data from the context menu.

The Select Data Source window will open. As you can see in the screenshot below, Start
Date is already added under Legend Entries (Series). And you need to add Duration there as
well.

2. Click the Add button to select more data (Duration) you want to plot in the Gantt chart.

3. The Edit Series window opens and you do the following:

In the Series name field, type "Duration" or any other name of your choosing.
Alternatively, you can place the mouse cursor into this field and click the column header in your
spreadsheet, the clicked header will be added as the Series name for the Gantt chart.
Click the range selection icon

next to the Series Values field.

4. A small Edit Series window will open. Select your project Duration data by clicking on the first
Duration cell (D2 in our case) and dragging the mouse down to the last duration (D11). Make

sure you have not mistakenly highlighted the header or any empty cell.

5. Click the range selection icon again to exit this small window. This will bring you back to the
previous Edit Series window with Series name and Series values filled in, where you click OK.

6. Now you are back at the Select Data Source window with both Start Date and Duration added
under Legend Entries (Series). Simply click OK for the Duration data to be added to your Excel
chart.

The resulting bar chart should look similar to this:

Step 4. Add task descriptions to the Gantt chart


Now you need to replace the days on the left side of the chart with the list of tasks.
1. Right-click anywhere within the chart plot area (the area with blue and orange bars) and
clickSelect Data to bring up the Select Data Source window again.

2. Make sure the Start Date is selected on the left pane and click the Edit button on the right
pane, under Horizontal (Category) Axis Labels.

3. A small Axis Label window opens and you select your tasks in the same fashion as you
selected Durations in the previous step - click the range selection icon
, then click on the first
task in your table and drag the mouse down to the last task. Remember, the column header
should not be included. When done, exit the window by clicking on the range selection icon
again.

4. Click OK twice to close the open windows.

5. Remove the chart labels block by right-clicking it and selecting Delete from the context menu.

At this point your Gantt chart should have task descriptions on the left side and look something
like this:

Step 5. Transform the bar graph into the Excel Gantt chart
What you have now is still a stacked bar chart. You have to add the proper formatting to make it
look more like a Gantt chart. Our goal is to remove the blue bars so that only the orange parts
representing the project's tasks will be visible. In technical terms, we won't really delete the blue
bars, but rather make them transparent and therefore invisible.
1. Click on any blue bar in your Gantt chart to select them all, right-click and choose Format
Data Series from the context menu.

2. The Format Data Series window will show up and you do the following:

Switch to the Fill tab and select No Fill.


Go to the Border Color tab and select No Line.

Note. You do not need to close the dialog because you will use it again in the next step.
3. As you have probably noticed, the tasks on your Excel Gantt chart are listed in reverse
order. And now we are going to fix this.
Click on the list of tasks in the left-hand part of your Gantt chart to select them. This will display
the Format Axis dialog for you. Select the Categories in reverse order option under Axis

Optionsand then click the Close button to save all the changes.

The results of the changes you have just made are:

Your tasks are arranged in a proper order on a Gantt chart.


Date markers are moved from the bottom to the top of the graph.

Your Excel chart is starting to look like a normal Gantt chart, isn't it? For example, my Gantt
diagram looks like this now:

Step 6. Improve the design of your Excel Gantt chart


Though your Excel Gantt chart is beginning to take shape, you can add a few more finishing
touches to make it really stylish.
1. Remove the empty space on the left side of the Gantt chart.
As you remember, originally the starting date blue bars resided at the start of your Excel Gantt
diagram. Now you can remove that blank white space to bring your tasks a little closer to the left
vertical axis.

Right-click on the first Start Date in your data table, select Format Cells > General.
Write down the number that you see - this is a numeric representation of the date, in my case
41730. As you probably know, Excel stores dates as numbers based on the number of days

since 1-Jan-1900. Click Cancel because you don't actually want to make any changes here.

Click on any date above the task bars in your Gantt chart. One click will select all the
dates, you right click them and choose Format Axis from the context menu.

Under Axis Options, change Minimum to Fixed and type the number you recorded in
the previous step.
2. Adjust the number of dates on your Gantt chart.
In the same Format Axis window that you used in the previous step, change Major
unit and Minor unit to Fixed too, and then add the numbers you want for the date intervals.
Typically, the shorter your project's timeframe is, the smaller numbers you use. For example, if
you want to show every other date, enter 2 in the Major unit. You can see my settings in the

screenshot below:

Tip. You can play with different settings until you get the result that works best for you. Don't be
afraid to do something wrong because you can always revert to the default settings by switching
back to Auto in Excel 2010 and 2007, or click Reset in Excel 2013.
3. Remove excess white space between the bars.
Compacting the task bars will make your Gantt graph look even better.

Click any of the orange bars to get them all selected, right click and select Format Data
Series.
In the Format Data Series dialog, set Separated to 100% and Gap Width to 0% (or
close to 0%).

And here is the result of our efforts - a simple but nice-looking Excel Gantt chart:

Remember, though your Excel chart simulates a Gantt diagram very closely, it still keeps the
main features of a standard Excel chart:

Your Excel Gantt chart will resize when you add or remove tasks.
You can change a Start date or Duration, the chart will reflect the changes and adjust
automatically.
You can save your Excel Gantt chart as an image or convert to HTML and publish
online.
Tips:

You can design your Excel Gant chart in different ways by changing the fill color, border
color, shadow and even applying the 3-D format. All these options are available in the Format
Data Series window (right-click the bars in the chart area and select Format Data Series from

the context menu).

When you have created an awesome design, it might be a good idea to save your Excel
Gantt chart as a template for future use. To do this, click the chart, switch to the Design tab on
the ribbon and click Save as Template.

Download this Gantt chart example.


Excel Gantt chart templates
As you see, it's not a big problem to build a simple Gantt chart in Excel. But what if you want a
more sophisticated Gantt diagram with percent-complete shading for each task and a
verticalMilestone or Checkpoint line? Of course, if you are one of those rare and mysterious
creatures whom we respectively call "Excel gurus", you can try to make such a graph on your
own, with the help of this article: Advanced Gantt Charts in Microsoft Excel.
However, a faster and more stress-free way would be using an Excel Gantt chart template.
Below you will find a quick overview of several project management Gantt chart templates for
different versions of Microsoft Excel.
Gantt chart template for Excel 2013 from Microsoft
This Excel Gantt chart template, called Gantt Project Planner, is purposed to track your project
by different activities such as Plan Start and Actual Start, Plan Duration and Actual Duration as
well as Percent Complete.
In Excel 2013, this template is available directly on the File > New tab. If you cannot find it there,
you can download it from Microsoft's web-site - Gantt Project Planner template. This template
requires no learning curve at all, simply click on it and it's ready for use.

Online Gantt chart template


This is an Interactive Online Gantt Chart Creator from smartsheet.com. As well as the previous
Gantt chart template, this one is fast and easy-to-use. They offer 30 days free trial, so you can
sign with your Google account here and start making your first Excel Gantt diagram online
straight away.

The process is very straightforward, you enter your project details in the left-hand table, and as
you type a Gantt Chart is being built in the right-hand part of the screen.

Gantt chart template for Excel, Google Sheets and OpenOffice Calc
Gantt chart template from vertex42.com is a free Gantt chart template that works with Excel
2003, 2007, 2010 and 2013 as well as OpenOffice Calc and Google Sheets. You work with this
template in the same fashion as you do with any normal Excel spreadsheet. Simply enter the
start date and duration for each task and define % in the Complete column. To change the

range of dates displayed in the Gantt chart area, slide the scroll bar.

And finally, one more Gant chart Excel template for your consideration.
Project Manager Gantt Chart template
Project Manager Gantt Chart from professionalexcel.com is also a free project management
Gantt chart template for Excel that can help track your tasks against their allocated time. You
can choose either the standard weekly view or daily for short term projects.
Hopefully, at least one of the above-mentioned Gantt chart Excel templates is well suited for
your needs. If not, you can find plenty more Gantt chart templates on the web.
Now that you are familiar with the main features of the Gantt diagram, you can explore it further
and create your own sophisticated Gantt charts in Excel to amaze your boss and co-workers : )

How to mail merge and print labels from Excel


This tutorial explains how to mail merge and print labels from Excel 2010 and 2013. You will
learn how to prepare your Excel address list for mail merge, set up the Word document, make
custom labels, print them and save the file for later use.
Last week we started to look into the capabilities of Mail Merge. Today let's see how you can
leverage this feature to mail merge and print labels from Excel's address list.

o
o
o
o
o
o
o
o

Printing address labels from Excel


Prepare the address list in Excel
Configure a Word mail merge document
Connect to Excel's address list
Select recipients
Arrange your mailing labels
Preview the labels
Print the address labels
Save the labels for later use
Third party add-ins to print labels from Excel
How to print address labels from Excel
If you've had a chance to look through Mail Merge from Excel to Word article, a large part of this
tutorial will be already familiar to you because printing labels from Excel is yet another variation
of the Mail Merge. Whatever intricate and intimidating the task may sound, it actually boils down
to 7 basic steps.

Now let's have a closer look at each step. I will be using Microsoft Excel 2013 in this example,
but the steps are absolutely identical in Excel 2010 and very similar in Excel 2007.
Step 1. Prepare the address list in Excel for mail merge
In essence, when you mail merge labels from Excel to Word, the column headers of your Excel
sheet become placeholders in a Word document denoting the mail merge fields. Each
placeholder corresponds to one entry such as first name, last name, salutation, city etc.

Microsoft Word will be pulling out the information from your Excel columns and placing it into the
corresponding merge fields in this way:

So, before starting the Mail Merge, invest some time in setting up your Excel spreadsheet to
ensure it is properly structured for the merging purpose. This will make it easier for you to
arrange, review and print your mailing labels in Word and you save more time in the long run.
Tips:
1.
2.
3.
4.
5.
6.
o
o

Give clear and self-explanatory names to your Excel columns, for example First
Name, Middle Name, Zip Code and so on. In this way you will be able to quickly locate the
right column in a Word mail merge document.
Separate the recipients' information into very small pieces. For example, you'd better
create 3 separate columns for titles, first names and last names rather than a single Name
column.
Make sure your Excel spreadsheet does not contain any blank rows or columns. When
doing a mail merge, empty rows may mislead Microsoft Word and as a result it may merge
only some of the entries believing it has already reached the end of your address list.
To correctly mail merge zip codes and any other numbers, please follow the
recommendations provided in How to format mail merge numbers and dates. This will
ensure that all leading zeros in your postal codes will remain intact.
If you create a mailing list by importing information from a .csv or a .txt file, then use
the Text Import Wizard. You will find the detailed guidance in this article - How to import CSV
to Excel.
To help Microsoft Word locate your address list during mail merge, you can give it a
name in your Excel sheet in this way:
Select the address list in your Excel spreadsheet, including column headers.
Switch to the Formulas tab >Defined Names group > Define Name.

Type a name for the address list in the Name box and click OK. Note that neither
spaces nor hyphens between words are allowed, you can use an underscore _ instead.

Step 2. Set up the mail merge document in Word


Now you need to configure the main document for the mailing labels you want to print. The good
news is that you have to do this only once for all the labels in the mail merge. You can also
choose some other content (text or graphics) to include in each label, e.g. your company logo or
return address.
You can configure the label main document in 2 ways:

Using the Mail Merge Wizard. It provides the step-by-step guidance which may be
helpful for beginners.
Using the Mailings ribbon group. If you are pretty comfortable with the mail merge
feature or prefer working with the ribbon, you can proceed in this way.

Now let's go ahead and configure your main label document. We will be using the step-by-step
wizard in this tutorial to make the learning curve easier.
1. In Microsoft Word 2007, 2010 or 2013, create a new document or open an existing one. The
currently opened document will become your label main document.
Note. If your company already has a package of label sheets from a certain manufacturer, e.g.
Avery, then you need to match the dimensions of your Word mail merge document with the
dimensions of the label sheets you are going to use.
2. Head over to the Mailings tab > Start Mail Merge group and click Step by Step Mail Merge
Wizard.The Mail Merge pane will open in the right part of the screen.

3. Select Labels and click the Next: Starting document link near the bottom of the Mail Merge
pane.

4. Decide where you want to set up your mailing labels - in the current document, some other
existing document or a new document.
If you want to create a new sheet of mailing labels, select the Change document layout radio
button and then click Label options.

Tip. If you do not see the document you want in the Start from existing box, click (More
files...)and you will be able to select any other document from your computer or local network.

5. The Label Options dialog box will open and you select the needed options such as:

Under Printer information, select the printer type.


Under Label information, choose supplier of your label sheets.
Under Product number, select the number that matches the product number listed on
your package of label sheets.
For example, if you want to print Avery labels from Excel, your settings may be similar to this:

Tip. For more information about the selected label package, click the Details... button in the
lower part of the dialog window.

6. When done, click the OK button. Then click Next: Select recipients.
Step 3. Connect the address labels to your Excel mailing list
It's time to connect to your Excel address list to merge the address information with your mailing
labels.
1. Choose to Use an existing list under Select recipients.

2. Click the Browse button and locate the Excel worksheet you want to use.

3. If you have given a name to your address list, as recommended in Step 1. Prepare the
address list in Excel, select it and click OK. Otherwise, select the whole table, you will be able to
refine, sort or filter the recipients to include in the mail merge later.

Those of you who prefer working with the ribbon can connect to an Excel worksheet by
clickingSelect Recipients > Use an Existing List...

Tip. If you wish to make address labels from your Outlook contacts, you do not necessarily
need to import the contacts into Excel. Simply select Choose from Outlook Contacts...instead
of Use an Existing List...
Step 4. Select the recipients to include in the mail merge
The Mail Merge Recipients window will open with all the recipients from your Excel mailing list
selected by default.
To exclude some of the recipients, clear a check box next to their names. When done, click OK.

When you are finished refining the recipients list, click Next: Arrange your labels.
Tips:

To sort the recipient list by a particular column, click the column's heading. The first
click sorts in ascending order, the second - in descending.
To filter the recipient list, click the arrow next to the column heading and choose the
option you want, e.g. blanks or non-blanks. You can also filter the list by some other information

such as country or state.

For advanced sorting or filtering, click the arrow next to the column name, and then
select(Advanced...) from the drop-down list.
You can find more options under Refine recipient list section in the lower part of
the Mail Merge Recipients window, e.g. find a recipient, find duplicate items and validate
recipients. The last option is available if you have any validation software installed.
Step 5. Arrange the layout of your address labels
Now you need to define the content of your labels, decide what information to included and
specify how the addresses will appear on each mailing label.
You do this by adding the placeholders to your Word document that correspond to the column
headers in your Excel worksheet. These placeholders are called mail merge fields. When you
perform the label mail merge, the placeholders will be replaced with the information from your
Excel's address list.
To arrange your mailing labels, follow these steps.
1. In the main Word document, click where you want to insert a certain field and then click the
corresponding link on the Mail Merge pane. Typically, for mailing labels you would need only

theAddress block merge field.

Another way to add the Address Block is to click the corresponding button on the Mailing tab >
Write and Insert Fields group.

2. The Inset Address Block dialog window will open. Select the desired options, check the
result under the Preview section and click OK.
3. When you are finished with refining your Address Block, click OK, and then Next: Preview
your labels.
How to add missing address elements
It may happen that address elements you see under in the Preview section do not match the
selected address pattern. Typically, this is the case when the column headings of your Excel
sheet differ from the default Word mail merge fields.
For example, you have chosen the following address format for your labels: Salutation, First
name, Last name, Suffix, but the preview shows only the First name and Last name, as you see
in the screenshot below.

In this case, first off verify whether your Excel source file contains all the required data. If it
does, click the Match Fields... button in the lower part of the window to help Word correctly
interpret the elements from your Excel mailing list.

Click the arrow next to the required field and select the right match. For Word to remember your
choice, check the Remember this matching for this set of data... check box.

Click OK and make sure the address elements are displayed correctly. As, you can see in the
next screenshot, the Courtesy Tile does show up now. And since our Excel data source file does

not have the Suffix column, missing Jr. or Sr. is fine : )

Note. The Address Block will appear simply as AddressBlock in your Word document. When
you print labels from your Excel source file, the chevrons ( ) won't be there, they are used
only to distinguish the mail merge fields in the Word document.
How to make a custom layout of mailing labels
If none of the pre-defined options in the Address Block is suitable for you, you can arrange
acustom layout of your address labels in this way:
1. Click the More items... link on the Mail Merge pane or Insert Merge Field button on
theMailings ribbon group.

2. In the Inset Merge Field dialog, select the desired field and click Insert.

Your custom mail merge fields and the printed mailing labels may look similar to this:

Tips:

To copy the format and layout of the first label to all other labels, click Update all
labels on the Mail Merge pane.
In addition to the mail merge fields, you can add some text or graphics to be printed on
each label, e.g. your company logo or return address.
You can change the format of a particular merge field directly in the Word document,
e.g. display dates or numbers in a different way. Select the needed field, press Shift+F9 to
display the field coding and add a picture switch to the merge field, as explained in Mail merge
with dates, currencies and other numbers.
Step 6. Preview your mailing labels
Well, you are very close to finished : )

1. Click the left or right arrows on the Mail Merge pane or Preview Results ribbon group to see
how your mailing labels will look like when printed.

2. If you want to change the labels' font type, font size, font color or make any other changes,
switch to the Home tab and design the currently previewed label to your liking. The edits will be
automatically applied to all other labels.
3. When you are satisfied with the appearance of your address labels, get back to
the Mailings tab and click Next: Complete the merge.
Tips:

To find and preview a certain label, click Find a recipient... link and type your search
criteria in the Find Entry box.
To make changes in the address list, click the Edit recipient list... link and refine your
mailing list.
Step 7. Print address labels
You are ready to print the address labels from your Excel mailing list.

1. Simply click Print... on the Mail Merge pane or Finish & Merge > Print documents on the
ribbon.

2. Decide whether to print all of your mailing labels, current or selected ones.
Step 8. Save the labels for later use (optional)
If you may want to print the same labels at some point in the future, you have two options:
1. Save the mail merge document connected to the Excel address list.
Click the Save button or press Ctrl+S to save the Word document in the usual way. The mail
merge document will be saved "as-is", connected to your Excel source file. If you make any
changes in the Excel mailing list, your address labels in Word with be updated automatically.
The next time you open the document, Word will ask you whether you want to merge the
information from the Excel data file. Click Yes to merge labels from Excel to Word.

If you click No, Word will break the connection between the document and Excel data file, and
replace the mail merge fields with the information from the first record.
2. Save merged labels as text.

If you want to save the merged labels as usual text, click the Edit individual labels... on the
Mail Merge pane.

In the Merge to New Document dialog box, specify what labels you want to merge. When you
clickOK, Word will open the merged labels in a separate document. You can make any edits
there and then save the file as a usual Word document.
Third party add-ins to print mailing labels from Excel
There exist a number of third-party add-ins purposed for printing address labels. Some of them
are manufactured by label sheets' suppliers and designed especially for formatting and printing
their label packages.
Let's have a quick look at one of such add-ins - Avery Wizard for Microsoft Office. As its name
suggests, this tool is intended for printing Avery labels. The wizard will help you print all kinds of
Avery labels from Excel, Word, Access and Outlook. It supports all versions of Office XP to
Office 2010 and 2013 (32-bit and 64 bit).
You can download a free trial using the above link. To be able to download, you will need to
provide them some basic information such as your name and email address. But this seems to
be the only complexity. The installation goes smoothly and once completed, you will see the
new AVERY tab on your ribbon. Clicking the Avery Wizard button opens a nice looking wizard

that will walk you through the process:

One more example of the printing labels software is Brother P-touch Add-In. This tool might help
you print labels using the Ptouch printer. However, the significant limitation of this add-in is that
it currently supports only 32-bit versions of Office 2010 and 2013.
And this is the end of our printing labels tutorial. Thanks a lot to everyone who has read to the
end! If you have any questions or run into problems when printing labels from Excel, do not
hesitate to leave a comment here, we will be happy to help!

Excel: How to add a hyperlink to another sheet


In this article I'll show you 3 ways how you can add hyperlinks into your Excel workbook to
easily navigate between numerous worksheets. You'll also learn how to change a link
destination and modify its format. If you don't need a hyperlink any more, you'll see how to
quickly remove it.
If you are a real Internet surfer, you know firsthand about the bright sides of hyperlinks. Clicking
on hyperlinks you instantly get access to other information no matter where it is located. But do
you know the benefits of spreadsheet hyperlinks in Excel workbooks? The time has come to
discover them and start using this great Excel feature.
One of the ways you can put spreadsheet hyperlinks to good use is to create a table of contents
of your workbook. Excel internal hyperlinks will help you to quickly jump to the necessary part of
the workbook without hunting through multiple worksheets.

o
o
o

o
o

Insert a hyperlink in Excel


Add a hyperlink from the context menu
Excel HYPERLINK function
Insert a link by cell drag-and-drop
Edit a hyperlink
Change link destination
Modify hyperlink format
Remove a hyperlink
Insert a hyperlink in Excel
If you need to add a hyperlink in Excel 2010 or 2013, you can choose one of the
followinghyperlink types: a link to an existing or new file, to a web page or e-mail address.
Since the subject of this article is creating a hyperlink to another worksheet in the same
workbook, below you'll find out three ways to do that.
Add a hyperlink from the context menu
The first method of creating a hyperlink within one workbook is to use the Hyperlink command.
1. Select a cell where you want to insert a hyperlink.
2. Right-click on the cell and choose the Hyperlink option from the context menu.

The Insert Hyperlink dialog window appears on the screen.


3. Choose Place in This Document in the Link to section if your task is to link the cell to a
specific location in the same workbook.
4. Select the worksheet that you want to link to in the Or select a place in this document field.
5. Enter the cell address in the Type the cell reference box if you want to link to a certain cell of
another worksheet.
6. Enter a value or name into the Text to display box to represent the hyperlink in the cell.

7. Click OK.

The cell content becomes underlined and highlighted in blue. It means that the cell contains the
hyperlink. To check if the link works, just hover the pointer over the underlined text and click on
it to go to the specified location.
Excel HYPERLINK function
Excel has a function named HYPERLINK that you can also use for creating links between
spreadsheets in the workbook. If you are not good at entering Excel formulas immediately in the
Formula bar, do the following:
1. Select the cell to which you want to add a hyperlink.

2. Go to Function Library on the FORMULAS tab.


3. Open the Lookup & Reference drop-down list and choose HYPERLINK.

Now you can see the function name in the Formula bar. Just enter the following two
HYPERLINK function arguments in the dialog window: link_location and friendly_name.
In our case link_location refers to a specific cell in another Excel worksheet
and friendly_name is the jump text to display in the cell.

Note. It's not a must to enter friendly_name. But if you want the hyperlink to look neat and clear,
I'd recommend to do it. If you don't type in friendly_name, the cell will display the link_location
as the jump text.
4. Fill in the Link_location text box.
Tip. If you don't know what address to enter, just use the Select range icon to pick the
destination cell.

The address displays in the Link_location text box.

5. Add the number sign (#) before the specified location.


Note. It is crucial to type the number sign. It indicates that the location is within the current
workbook. If you forget to enter it, the link won't work and an error will appear when you click on
it.

When you move to the Friendly_name text box, you see the formula result in the bottom-left
corner of the Function Arguments dialog.
6. Enter Friendly_name that you want to display in the cell.

7. Click OK.

Here you are! Everything is as it should be: the formula is in the Formula bar, the link is in the
cell. Click on the link to check where it follows.
Insert a link by cell drag-and-drop
The quickest way of creating hyperlinks within one workbook is using the drag-and-drop
technique. Let me show you how it works.
As an example, I'll take a workbook of two sheets and create a hyperlink in Sheet 1 to a cell in
Sheet 2.
Note. Make sure that the workbook is saved because this method doesn't work in new
workbooks.
1. Select the hyperlink destination cell in Sheet 2.
2. Point to one of the cell borders and right-click.

3. Hold the button and go down to the sheet tabs.

4. Press the Alt key and mouse over the Sheet 1 tab.
Having the Alt key pressed automatically takes you to the other sheet. Once Sheet 1 is
activated, you can stop holding the key.
5. Keep dragging to the place where you want to insert a hyperlink.

6. Release the right mouse button for the popup menu to appear.
7. Choose Create Hyperlink Here from the menu.

After you do that, the hyperlink appears in the cell. When you click on it, you'll switch to the
destination cell in Sheet 2.
No doubt that dragging is the fastest way to insert a hyperlink into an Excel worksheet. It
combines several operations into a single action. It takes you less time, but a bit more attention
concentration than two other methods. So it's up to you which way
to go.
Edit a hyperlink
You can edit an existing hyperlink in your workbook by changing its destination, its appearance,
or the text that is used to represent it.
Change link destination
As this article deals with hyperlinks between spreadsheets of the same workbook, the hyperlink
destination in this case is a specific cell from another spreadsheet. If you want to change the
hyperlink destination, you need to modify the cell reference or choose another sheet. You can
do both, if necessary.

1. Right-click the hyperlink you want to edit.


2. Choose Edit Hyperlink from the popup menu.

The Edit Hyperlink dialog box appears on the screen. You see that it looks the same as
the Insert Hyperlink dialog and has the identical fields and layout.

Note. There are, at least, two more ways to open the Edit Hyperlink dialog. You can press Ctrl +
K or click on Hyperlink in the Links group on the INSERT tab. But don't forget to select the
necessary cell before doing it.
3. Update the information in the appropriate fields of the Edit Hyperlink dialog.
4. Click OK and check where the hyperlink jumps to now.
Note. In case you used Method 2 to add a hyperlink in Excel, you need to edit the formula to
change the hyperlink destination. Select the cell that contains the link, and then place the cursor
in the Formula bar to edit it.
Modify hyperlink format
Most of the time hyperlinks are shown as an underlined text of blue color. If the typical
appearance of hyperlink text seems to you boring and you'd like to stand out of the crowd, go
ahead and read below how to do it:
1. Go to the Styles group on the HOME tab.
2. Open the Cell Styles list.
3. Right-click on Hyperlink to change the appearance of the hyperlink that was not clicked. Or
right-click Followed Hyperlink if the hyperlink was activated.
4. Choose the Modify option from the context menu.

5. Click on Format in the Styles dialog box.


6. Make the necessary changes in the Format Cells dialog window. Here you can change the
hyperlink alignment and font or add fill color.
7. When you are done, click OK.
8. Make sure that all the changes are marked under Style includes in the Style dialog box.
9. Press OK.

Now you can enjoy a new individual style of the hyperlinks in your workbook. Pay attention that
the changes you made affect all the hyperlinks in the current workbook. You can't change the
appearance of a single hyperlink.
Remove a hyperlink
It will take you a few seconds and no efforts to delete a hyperlink from the worksheet.
1. Right-click the hyperlink you want to remove.
2. Choose the Remove Hyperlink option from the popup menu.

The text remains in the cell, but it is no longer a hyperlink.


Note. If you want to delete a hyperlink and the text that represents it, right-click the cell that
contains the link and choose the Clear Contents option from the menu.
This trick helps you to delete a single hyperlink. If you want to know how to remove multiple (all)
hyperlinks from Excel worksheets at a time, follow the link to our previous blog post.
I hope that in this article you saw the simplicity and effectiveness of using internal hyperlinks in
a workbook. Just a few clicks to create, jump and discover the massive content of complex
Excel documents.

How to fill empty cells with 0, with value above/below in Excel


In this article you'll learn a trick to select all empty cells in an Excel spreadsheet at once and fill in
blanks with value above / below, with zero or any other value.
To fill or not to fill? This question often touches blank cells in Excel tables. On the one hand, your
table looks neater and more readable when you don't clutter it up with repeating values. On the other
hand, Excel empty cells can get you into trouble when you sort, filter the data or create a pivot table.
In this case you need to fill in all the blanks. There are different methods to solve this problem. I will
show you one quick and one VERY quick way to fill empty cells with different values in Excel 2010
and 2013.
Thus my answer is "To Fill". And now let's see how to do it.

How to select empty cells in Excel worksheets


Excel formula to fill in blank cells with value above / below
Use the Fill Blank Cells add-in by Ablebits
Fill empty cells with 0 or another specific value

How to select empty cells in Excel worksheets


Before filling in blanks in Excel, you need to select them. If you have a large table with dozens of
blank blocks scattered throughout the table, it will take you ages to do it manually. Here is a quick
trick for selecting empty cells.
1. Pick the columns or rows where you want to fill in blanks.

2. Press Ctrl + G or F5 to display the Go To dialog box.


3. Click on the Special button.

Note. If you happen to forget the keyboard shortcuts, go to the Editing group on the HOME tab and
choose the Go To Special command from the Find & Select drop-down menu. The same dialog
window will appear on the screen.

The Go To Special command allows you to select certain types of cells such as ones containing
formulas, comments, constants, blanks and so on.
4. Select the Blanks radio button and click OK.

Now only the empty cells from the selected range are highlighted and ready for the next step.

Excel formula to fill in blank cells with value


above / below
After you select the empty cells in your table, you can fill them with the value from the cell above or
below or insert specific content.
If you're going to fill blanks with the value from the first populated cell above or below, you need to
enter a very simple formula into one of the empty cells. Then just copy it across all other blank cells.
Go ahead and read below how to do it.
1. Leave all the unfilled cells selected.
2. Press F2 or just place the cursor in the Formula bar to start entering the formula in the active cell.
As you can see in the screenshot above, the active cell is C4.
3. Enter the equal sign (=).
4. Point to the cell above or below with the up or down arrow key or just click on it.

The formula (=C3) shows that cell C4 will get the value from cell C3.
5. Press Ctrl + Enter to copy the formula to all the selected cells.

Here you are! Now each selected cell has a reference to the cell over it.
Note. You should remember that all cells that used to be blank contain formulas now. And if you
want to keep your table in order, it's better to change these formulas to values. Otherwise, you'll end
up with a mess while sorting or updating the table. Read our previous blog post and find out two
fastest ways to replace formulas in Excel cells with their values.

Use the Fill Blank Cells add-in by Ablebits


If you don't want to deal with formulas every time you fill in blanks with cell above or below, you can
use a very helpful add-in for Excel created by Ablebits developers. The Fill Blank Cells utility
automatically copies the value from the first populated cell downwards or upwards. Keep on reading
and find out how it works.
0. Download the add-in and install it on your computer.
After the installation the new Ablebits Utilities tab appears in your Excel.
1. Select the range in your table where you need to fill empty cells.

2. Click the Fill Blank Cells icon on the Ablebits Utilities tab.

The add-in window displays on the screen with all the selected columns checked.

3. Uncheck the columns that don't have empty cells.


4. Select the action from the drop-down list in the bottom-right corner of the window.
If you want to fill the blanks with the value from the cell above, choose the Fill cells
downwardsoption. If you want to copy the content from the cell below, then select Fill cells upwards.
5. Press Fill.

Done! :)

Besides filling empty cells, this tool will also split merged cells if there are any in your worksheet and
indicate table headers.
Check it out! Download the fully-functional trial version of the Fill Blank Cells add-in and see how it
can save you much time and effort.

Fill empty cells with 0 or another specific value


What if you need to fill all the blanks in your table with zero, or any other number or a specific text?
Here are two ways to solve this problem.

Method 1
1. Select the empty cells.
2. Press F2 to enter a value in the active cell.

3. Type in the number or text you want.

4. Press Ctrl + Enter.

A few seconds and you have all the empty cells filled with the value you entered.

Method 2
1. Select the range with empty cells.

2. Press Ctrl + H to display the Find & Replace dialog box.


3. Move to the Replace tab in the dialog.
4. Leave the Find what field blank and enter the necessary value in the Replace with text box.

5. Click Replace All.


It will automatically fill in the blank cells with the value you entered in the Replace with text box.

Whichever way you choose, it will take you a minute to complete your Excel table.
Now you know the tricks for filling in blanks with different values in Excel 2013. I am sure it will be no
sweat for you to do it using a simple formula, Excel's Find & Replace feature or user-friendly Ablebits
add-in.

Convert CSV to Excel: how to import CSV files into Excel spreadsheets
In this article you will find 3 quick ways to convert CSV to Excel. You will also learn how to
import multiple CSV files in a single workbook and how to handle the cases when some data
from a CSV file isn't correctly displayed in an Excel sheet.
Last week we started to investigate the specificities of the comma-separated values format
(CSV)and different ways of converting Excel files to CSV. Today, we are going to do the
opposite - import CSV to Excel.
This article will show you how to open CSV in Excel and import multiple CSV files at a time. We
will also red-flag possible pitfalls along the way and suggest the most effective solutions.

How to convert CSV to Excel


Converting CSV to Excel: problems and solutions
Import multiple CSV files into Excel
How to convert CSV to Excel
If you need to transfer some data from your company's database to an Excel spreadsheet,
exporting the database to a CSV file and then importing the CSV file to Excel is the first option
that comes to mind.
There exist 3 ways of converting CSV to Excel: you can open a .csv file directly in Excel,
double-click on the file in Windows Explorer, or import CSV into Excel as external data. Below I
will provide the detailed guidance on these methods and point out the strengths and limitations
of each:

Method 1: Open a CSV file in Excel


Method 2: Open a CSV file in Excel using Windows Explorer
Method 3: Import CSV to Excel
How to open CSV file in Excel
If you created a CSV file in another program, you can still open it as an Excel workbook in the
usual way by using the Open command.
Note. Opening the CSV file in Excel does not change the file format. In other words, this
won't convert your CSV file to Excel's .xls or .xlsx , the file will retain the original .csv (or .txt)
extension.
1. With your Microsoft Excel open, head over to the File tab and click Open.
2. The Open dialog box appears and you select Text Files (*.prn,*.txt,*.csv) from the dropdown list in the lower right-hand corner.

3. Browse for the CSV file and open it as usual by double-click.


If you are opening a .csv file, Excel will open it straight away and display the data in a new
workbook.
If you have selected a text file (.txt), Excel will start the Import Text Wizard. See Importing CSV
to Excel for full details.
Note. When Microsoft Excel opens a .csv file, it uses your default data format settings to
understand how exactly to import each column of the text data. If your data contains one of the
below characters or entries, then use the Import Text Wizard instead:

different delimiters are used in your csv file;


the csv file contains different date formats;
you convert numbers with leading zeroes and want to preserve leading zeroes in an
Excel sheet;
you want to see a preview of how your CSV data will be imported into Excel;
you are looking for more flexibility in general.

To get Excel to launch the Import Text Wizard, you can either change the file extension from
.csv to .txt before opening the file, or import CSV to Excel as explained further.
How to open a CSV file using Windows Explorer
This is the quickest way to open CSV in Excel. In Windows Explorer, just double click a .csv file
and have it open as a new workbook.
However, this method works only if you have Microsoft Excel set as the default program for
.csv files. If so, then you will see the familiar green Excel icon
displayed next to the .csv
file's name in Windows Explorer.
If Excel is not the default program, you can set it as such in this way:
1. Right-click any .csv file in Windows Explorer, and select Open with... > Choose default
programfrom the context menu.
2. Click Excel (desktop) under Recommended Programs, make sure the "Always use the
selected program to open this kind of file" is selected and click OK.

How to import CSV to Excel


Using this method you can import data from a csv file into the existing or a new Excel
worksheet. Unlike the previous two methods, it does not simply open CSV in Excel but really
converts a .csv file to .xlsx (if you use Excel 2007, 2010 or 2013) or .xls (in case of Excel 2003
and lower).
1. With the needed spreadsheet open, click the cell where you want to import the data from a
.csv or .txt file.
2. On the Data tab, in the Get External Data group, click From Text.

3. Browse for the csv file you want to import, select it and click the Import button (or simply
double click the .csv file).

4. The Text Import Wizard will appear and you follow its steps.

Before we move further, please have a quick look at the screenshot below that shows the
original CSV file and the desired result in Excel. Hopefully, this will help you better understand
why we choose this or that setting in the example that follows.

Step 1. Choose the file type and the row number to start importing the data. Typically,
you choose Delimited and row 1, respectively. The preview window in the lower part of the

wizard shows the first few entries of your CSV file.

Step 2. In this step, you select a delimiter(s) and text qualifier.Delimiter is the character
that separates values in your .csv file. If your CSV file uses some character other than available
in the pre-defined list, select the Other check box and then type your custom character. In our
example, we specify Tab and Comma since we want each product (separated by tabs) to start
with a new row and the product details such as IDs and sales numbers (separated by commas)
to be imported in separate cells.
Text qualifier is the character that wraps the values in your text file. All text enclosed in the text
qualifier symbols, e.g. "text1, text2" will be imported as one value, even if the text contains a
delimiter you specified.In this example, we have chosen a comma as the delimiter and a
quotation mark as the text qualifier. As the result, all of the numbers with a decimal separator
(which is also a comma in our case!) will be imported in one cell, as you can see in the preview
section below. If we did not specify the quotation mark as the text qualifier, then all the numbers
with decimal separators would be imported into two adjacent cells.

Step 3. If you are happy with the Data preview, then click the Finish button.
Tip. If more than one consecutive comma or other delimiter characters may occur in your CSV
file, then check Treat consecutive delimiters as one check box to prevent empty cells.
4. Choose the destination for the imported data, either an existing or a new worksheet, and
clickOK to finish importing your CSV file to Excel.

Tip. You can click Properties... to set some advanced options such as refresh, layout and
formatting for the imported data.

Note. If your CSV file contains some numerical data or dates, Excel may not convert these
values correctly. To change the format of the imported data, select the problematic column(s) in
Excel, right click and choose Format cells from the context menu.
Convert CSV to Excel: problems and solutions
The CSV format has been around for over 30 years, but notwithstanding its long history it has
never been officially documented. The name CSV (comma-separated values) implies the use of
comma to separate data fields. But this is in theory. De facto, many so-called "CSV" files use
other characters to separate data, such as:

Tabs - TSV files (tab-separated values)


Semicolon - SCSV files (semicolon separated values)
Some implementations of CSV files wrap data fields in single or double quotation marks, while
others require a Unicode byte order mark (BOM), e.g. UTF-8, for correct Unicode interpretation.
This lack of standard spawns various problems you may be faced with when trying to convert an
Excel file to CSV and especially when importing a .csv file to Excel. Let's investigate these
issues beginning with the most common one.

CSV file is incorrectly displayed in Excel (all data is displayed in the 1st column)
Leading zeros are lost when you open a CSV file in Excel
Values are changed to dates when converting CSV to Excel
CSV file is incorrectly displayed in Excel
Symptoms. You are trying to open a .csv file in Excel and all of the data is displayed in the first
column.
Cause. The root of the problem is different separators set in your Windows regional and
language settings and the csv file. In North America and some other countries, the default List
Separator is a comma. While in European countries the comma (,) is reserved as the Decimal
Symbol and the List Separator is set to semicolon (;).
Solutions. There are several possible solutions for this problem, you can quickly look through
the recommendations below and choose the one most suited for your particular task.
1. Specify the right separator directly in the CSV file. Open the CSV file with any text editor
(even the usual Notepad will do) and add the below text in the first line. Note, it should be a
separate line before any data:

To separate with coma: sep=,


To separate with semicolon: sep=;
As you can guess, you can set any other custom separator in the same way, simply type it after
the equality sign.
2. Choose the needed separator in Excel. In Excel 2013 or 2010, go to the Data tab > Data
Toolsgroup > Text To Columns.

The Convert Text to Column wizard, choose the Delimited file type ad click Next. Then select
the needed separator in the next step and click Finish.

3. Change the .csv extension to .txt. Opening a .txt file in Excel will start the Text Import
Wizardand you can choose any delimiter as discussed in importing a csv file to Excel.
4. Open a semicolon delimited CSV file with VBA.
Here is a sample VBA code to open a semicolon delimited CSV file in Excel. Though the code
was written a few years ago for older Excel versions (2000 and 2003), if you are pretty
comfortable with VBA, you won't have problems with updating it or modifying for comma
delimited CSV files.
Note. All of the solutions above change the separator for a given CSV file only. If you'd rather
change the default separator once and for all, proceed with solution 5.
5. Change separators in Region and Language settings.
Click the Start button and open the Control Panel, then click Region and Language > Additional
Settings. The customize Format dialog window will open and you choose a dot (.) as
the Decimal symbol and a coma (,) as the List separator.

Click OK twice to close two dialog windows and you are finished. From now Microsoft Excel will
open and display all CSV (comma separated) files correctly.
Note. Setting new decimal and list separators in Control Panel changes the default separator
characters for all programs on your computer, not only Microsoft Excel.
Leading zeros are lost when opening a CSV file in Excel
Symptom. Your .csv file contains values with leading zeros and those zeros are lost when you
open the CSV file in Excel.
Cause. By default, Microsoft Excel displays SCV files in the General format, which cuts off
leading zeros.
Solution. Instead of opening a .csv file in Excel, run the Text Import Wizard as explained
inImporting CSV to Excel in order to convert CSV to Excel.

In step 3 of the wizard, select the column(s) that contains values with leading zeros and change
the column's format to Text. This will covert your CSV file to Excel keeping all zeros in place.

Excel converts some values to dates when opening a CSV file


Symptom. Some values in your .csv file look like dates and Excel automatically converts such
values from text to a date.
Cause. As mentioned above, Excel opens CSV files in the General format and converts values
that happen to resemble dates from text to a date. For example, if you are opening a .CSV file
containing user logins, the entries similar to apr23 will be converted to dates in Excel.
Solution. Convert CSV to an Excel file by running the Text Import Wizard (Data tab > From
Text). In step 3, select the column(s) with records that look enough like dates and change the
column's format to Text.

If you are looking for the opposite, i.e. you want the values in a certain column to be converted
to dates in Excel, then set the format of that column to Date and choose the desired date format
from the drop-down list.
How to import multiple csv files into Excel
As you probably know, Microsoft Excel allows opening several CSV files using
the Open command.
1. You click File > Open and select Text Files (*.prn, *.txt, *.csv) from the drop down list in the
lower right-hand corner.
2. To select adjacent files, click the 1st file, hold down the Shift key, and then click the last file.
Both of the clicked files as well as all the files in-between will get selected.
To select multiple non-adjacent files, hold down the Ctrl and click each .csv file you want to
open.

3. With multiple CSV files selected, click the Open button.

This method is straightforward and quick and we could call it perfect but for one small thing - it
opens each CSV file as a separate Excel workbook. In practice, switching back and forth
between several Excel files might be quite inconvenient and burdensome.
Now let me show you how you can import multiple CSV files into one Excel workbook, placing
each .csv file on a separate sheet or consolidating all the files in a single spreadsheet.
Importing multiple CSV files in a single Excel workbook
To import several .csv files into one workbook, we are going to use the Consolidate Worksheets
Wizard. This add-in works with all versions of Excel 2013, 2010, 2007 and 2003. The evaluation
version is also available and you can download it right now to follow this example more closely.
The installation will take you just a couple of minutes.
1. Go to the Ablebits Data tab on the Excel ribbon and click the Consolidate Worksheets icon.

2. Select the CSV files you want to import in Excel. If you have the files open, the wizard will
display their names in the dialog window. Otherwise, click the Add files... button in the lower
right-hand corner.

Select the files as you usually do in Windows Explorer (hold Shift to select contiguous files
or Ctrl to select non-contiguous files). The result will look similar to what you see the screenshot
below, and you click Next.

3. Choose how exactly you want to import the selected CSV files to Excel. As you can see in the
screenshot below, you have several choices. Typically, you click the last open that imports all of

the selected CSV files into a single workbook, each file on a separate sheet.

Tip. If you are unsure which option to choose, click the i icon
right to the option in question
and you will see a mockup of the imported files. For example, to consolidate data from multiple
CSV files in a single worksheet, choose the second option - "Copy data from the selected
ranges to one worksheet".

4. In the next step, you decide whether you want to import all the data or values only. When
importing .csv files, you typically go ahead with the default setting "Paste all" and simply

clickNext.

5. The last thing for you to do is to choose the destination for the imported CSV files. And again,
you proceed with the default setting since the New workbook is the only available option.

6. Click Finish, wait for a few seconds and get the desired result - multiple CSV files imported
into one Excel workbook. Fast and painless, isn't it?
As you understand, this was just one of the many possible applications of the Consolidate
Worksheets Wizard. You can find more about this Excel add-in on its homepage.
Hopefully, now you are able to convert any CSV files to Excel with ease. If you have any
questions or have run into any issues, don't hesitate to drop me a comment. And thanks for your
patience everyone who has read this long tutorial to the end! : )

How to convert Excel to CSV and export Excel files to CSV UTF-8 format
Comma-separated values (CSV) is a widely used file format that stores tabular data (numbers
and text) as plain text. Its popularity and viability are due to the fact that a great deal of
programs and applications support csv files, at least as an alternative import / export format.
Moreover, the csv format allows users to glance at the file and immediately diagnose the
problems with data, if any, change the CSV delimiter, quoting rules, etc. All this is possible
because a CSV file is plain text and an average user or even a novice can easily understand it
without any learning curve.
In this article, we will try to investigate quick and efficient ways to export data from Excel to CSV
and learn how to convert Excel to CSV keeping all special characters and foreign symbols
intact. The below methods work for all versions of Excel 2013, 2010 and 2007.

Convert Excel data to CSV file


Export Excel to CSV UTF-8 or UTF-16
Other ways to convert Excel to CSV (keeping special characters)
How to convert Excel file to CSV
If you need to export an Excel file to some other application, e.g. to the Outlook Address book or
Access database, you can convert your Excel worksheet to CSV first and then import a .csv file
in another program. Below you will find the step-by-step instructions to export an Excel
workbook to the CSV format by using Excel's Save As command.
1. In your Excel workbook, switch to the File tab, and then click Save As. Alternatively, you can
press F12 to open the same Save As dialog.

2. In the Save as type box, choose to save your Excel file as CSV (Comma delimited).

Besides CSV (comma delimited), a few other csv formats are available to you:

CSV (comma delimited). This format saves an Excel file as a comma-separated text
that can be used in another Windows program or another version of Windows operating system.
CSV (Macintosh). This format saves your Excel workbook as a comma-separated file
for use on Mac operating system.
CSV (MS-DOS). Saves your Excel file as a comma-separated file for use on the MSDOS operating system.
Unicode Text (*txt). This is a computing industry standard supported by almost all
current operating systems including Windows, Macintosh, Linux and Solaris Unix. It can handle
characters of almost all modern languages and even some ancient ones. So, if you Excel file
contains data in a foreign language, save it in the Unicode Text format first and then convert to
CSV, as explained in Exporting Excel to CSV UTF-8 or UTF-16.
Note. All of the above mentioned formats save only the active Excel sheet.
3. Choose the destination folder where you want to save your Excel file in the CSV format, and
then click Save.
After you click Save, Excel will display two dialogs. Don't worry, these are not error messages
and everything is going right.

4. The first dialog reminds you that only the active Excel spreadsheet will be saved to the CSV
file format. If this is what you are looking for, click OK.

If you need to save the contents of all the sheets your workbook contains, click Cancel and
then save each spreadsheet individually as a separate Excel file (workbook). After that save
each Excel file as CSV.
5. Clicking OK in the first dialog will display a second message informing you that your
worksheet may contain features unsupported by the CSV encoding. This is Okay, so simply
click Yes.

This is how you convert Excel to CSV. The process is quick and straightforward, and you are
unlikely to run into any hurdles along the way.
Export Excel to CSV with UTF-8 or UTF-16 encoding
If your Excel spreadsheets contain some special symbols, foreign characters (tildes, accent
etc.) or hieroglyphs, then converting Excel to CSV in the way described above won't work.
The point is the Save As CSV command distorts any characters other than ASCII (American
Standard Code for Information Interchange). And if your Excel file has smart quotes or long
dashes (e.g. inherited from the original Word document that was copied /pasted to Excel), these
characters would be mangled too.
An easy alternative is saving an Excel workbook as a Unicode(.txt) file and then converting it to
CSV. In this way you will keep all non-ASCII characters undamaged.
Before we proceed further, let me briefly point out the main differences between UTF-8 and
UTF-16 encodings so that you can choose the right format in each particular case.
UTF-8 is a more compact encoding since it uses 1 to 4 bytes for each symbol. Generally, this
format is recommended if ASCII characters are most prevalent in your file because most such

characters are stored in one byte each. Another advantage is that a UTF-8 file containing only
ASCII characters has absolutely the same encoding as an ASCII file.
UTF-16 uses 2 to 4 bytes to store each symbol. However, a UTF-16 file does not always require
more storage than UTF-8. For example, Japanese characters take 3 to 4 bytes in UTF-8 and 2
to 4 bytes in UTF-16. So, you may want to use UTF-16 if your Excel data contains any Asian
characters, including Japanese, Chinese or Korean. A noticeable disadvantage of this format is
that it's not fully compatible with ASCII files and requires some Unicode-aware programs to
display them. Please keep this in mind if you are going to import the resulting file somewhere
outside of Excel.
How to convert Excel to CSV UTF-8
Suppose you have an Excel worksheet with some foreign characters, Japanese names in our
case:

To export this Excel file to CSV keeping all the hieroglyphs intact, follow the steps below:
1. In your Excel worksheet, go to File > Save As.
2. Name the file and choose Unicode Text (*.txt) from the drop-down list next to "Save as type",
and then click Save.

3. Open the unicode .txt file using your preferred text editor, for example Notepad.
Note. Some simple text editors do not fully support all Unicode characters, therefore certain
characters may display as boxes. In most cases this won't affect the resulting file in any way
and you can simply ignore this or use a more advanced text editor such as Notepad++.
4. Since our unicode text file is a tab-delimited file and we want to convert Excel to CSV
(comma-separated) file, we need to replace all tabs with commas.
Note. If you do not need exactly the comma-separated file, just any CSV file that Excel can
understand, you can skip this step because Microsoft Excel handles tab-separated files fine.
If you do want a comma-delimited CSV file, proceed with Notepad in the following way:

Select a tab character, right click it and choose Copy from the context menu, or simply
press CTRL+C as shown in the screenshot below.

Press CTRL+H to open the Replace dialog and paste the copied tab (CTRL+V) in
the Find whatfield. When you do this, the cursor will move rightwards indicating that the tab was
pasted. Type a comma in the Replace with field and click Replace All.

In Notepad, the resulting file should look similar to this:

5. Click File > Save As, enter a file name and change the encoding to UTF-8. Then click
the Savebutton.

6. Open the Windows Explorer and change the file extension from .txt to .csv.

An alternative way is to change the .txt extension to .csv directly in Notepad's Save as dialog
and choose All files (*.*) next to Save as type, as shown in the screenshot below.

7. Open the CSV file from Excel by clicking File > Open > Text files (.prn, .txt, .csv) and verify if
the data is Okay.
Note. If your file is intended for use outside of Excel and the UTF-8 format is a must, do not
make any edits in the worksheet, nor should you save a CSV file in Excel, because this may
cause encoding problems. If some of the data does not appear right in Excel, open the file in
Notepad and fix the data there. Remember to save the file in the UTF-8 format again.
How to convert an Excel file to CSV UTF-16
Exporting an Excel file as CSV UTF-16 is much quicker and easier than converting to UTF-8.
This is because Excel automatically employs the UTF-16 format when saving a file as Unicode
(.txt).
So, what you do is simply click File > Save As in Excel, select the Unicode Text (*.txt) file
format, and then change the file extension to .csv in Windows Explorer. Done!
If you need a comma-separated or semicolon-separated CSV file, replace all tabs with commas
or semicolons, respectively, in a Notepad or any other text editor of your choosing (see Step 6
above for full details).

Other ways to convert Excel files to CSV


The methods of exporting Excel to CSV (UTF-8 and UTf-16) we have just described are
universal, meaning they work for all special characters and in any Excel version, from 2003 to
Excel 2010 and 2013.
There exist a handful of other ways to convert Excel data to CVS. Unlike the previous solutions,
they won't produce a pure UTF-8 CSV file (except for OpenOffice that allows exporting Excel
files to several UTF encodings), but in most cases they will contain the correct characters which
you can painlessly convert to the UTF-8 format later using any text editor.
Convert Excel to CSV using Google spreadsheets
The use of Google Spreadsheet to export an Excel file to CSV seems to be a very simple
workaround. Assuming that you already have Google Drive installed, perform the following 5
easy steps.
1. On the Google Drive, click the Create button and choose Spreadsheet.
2. Click Import from the File menu.

3. Click Upload and choose a file from your computer.


4. Choose Replace spreadsheet and then click Import.

Tip. If you have a relatively small Excel file, then you can simply copy / paste the data to a
Google sheet to save time.

5. Go to the File menu > Download as, select Comma separated values (CSV, current
sheet) and save the SCV file to your computer.

Finally, open the CSV file in some text editor to make sure all of the characters are saved
correctly. Regrettably, the CSV files converted in this way do not always correctly display in
Excel. Kudos to Google and shame to Microsoft : )
Save .xlsx to .xls and then convert to .csv file
This method of converting Excel to CSV hardly needs any further explanations because the
heading says it all.
I have come across this solution on one of Excel forums, cannot remember now which exactly.
To be honest, this method has never worked for me, but many users reported that special
characters, which got lost when saving .xlsx directly to .csv, were preserved if to save a .xlsx file
to .xls first, and then save .xls as .csv in Excel, as explained in How to convert Excel to CSV.

Anyway, you can try this method of exporting Excel to CSV on your side and if it works, this can
be a real time-saver.
Save Excel as CSV using OpenOffice
OpenOffice, an open-source suite of applications, includes a spreadsheet application
named Calcthat is really good at exporting Excel data to CSV format. In fact, it provides more
options to convert spreadsheets to CSV files (encodings, delimiters etc.) than Excel and Google
Sheets combined.
You simply open your Excel file with OpenOffic Calc, click File > Save as and save the file
as Text CSV (.scv) type.
In the next step, you will have a choice of various Character sets (encodings) and Field
delimiters. Naturally, you select Unicode (UTF-8) and comma if your goal is a CVS UTF-8 file
(or whatever encoding and separator character you need) and click OK. Typically, the Text
delimiter will remain the default quotation mark (").

You can also use another application of the same kind, LibreOffice, to perform fast and painless
Excel to CSV conversions. It would be really nice if Microsoft Excel provided similar options with
regard to CSV encodings, agree?
These are the ways of converting Excel to CSV I am aware of. If you know other more efficient
methods to export an Excel file to CSV, please do share in comments. Thank you for reading!

How to show and hide gridlines in Excel 2010, 2013


In the previous blog post we successfully solved the problem of Excel not printing gridlines.
Today I'd like to dwell on another issue related to Excel grid lines. In this article you'll learn how
to show gridlines in an entire worksheet or in certain cells only, and how to hide lines by
changing cells background or borders' color.
When you open an Excel document, you can see the horizontal and vertical faint lines that
divide the worksheet into cells. These lines are called gridlines. It is very convenient to show
gridlines in Excel spreadsheets as the key idea of the application is to organize the data in rows
and columns. And you don't need to draw cell borders to make your data-table more readable.
All Excel spreadsheets have gridlines by default, but sometimes you can receive a sheet without
cell lines from another person. In this case you may want them to become visible again.
Removing lines is also a very common task. If you think that your spreadsheet will look more
accurate and presentable without them, you can make Excel hide gridlines.

Whether you decide to show gridlines in your worksheet or hide them, go ahead and find below
different ways to fulfil these tasks in Excel 2010 and 2013.

Show gridlines in an entire worksheet or workbook


Show / hide gridlines in Excel by changing the fill color
Make Excel hide gridlines only in specific cells
Remove gridlines by changing their color
Show gridlines in Excel
Suppose you want to see gridlines in the entire worksheet or workbook, but they are just turned
off. In this case you need to check one of the following options in the Excel 2010 or 2013
Ribbon.
Start with opening the worksheet where cell lines are invisible.

Note: If you'd like to make Excel show gridlines in two or more sheets, hold down the Ctrlkey
and click the necessary sheet tabs at the bottom of the Excel window. Now any changes will be
applied to every selected worksheet.
When you are done with the selection, just navigate to the VIEW tab on the Ribbon and check
theGridlines box in the Show group.

Alternatively, you can go to the Sheet Options group on the PAGE LAYOUT tab and select
the Viewcheckbox under Gridlines.

Whichever option you choose gridlines will instantly appear in all the selected worksheets.
Note: If you want to hide gridlines in the entire spreadsheet, just uncheck
the Gridlines or Viewoptions.
Show / hide gridlines in Excel by changing the fill color
One more way to display / remove gridlines in your spreadsheet is to use the Fill Color feature.
Excel will hide gridlines if the background is white. If the cells have no fill, gridlines will be
visible. You can apply this method for an entire worksheet as well as for a specific range. Let's
see how it works.
1. Select the necessary range or the entire spreadsheet.
Tip: The easiest way to highlight the whole worksheet is to click on the Select All button in the
top-left corner of the sheet.

You can also use the Ctrl + A keyboard shortcut to select all the cells in the spreadsheet. You'll
need to press the key combination twice or three times if your data is organized as Table.
2. Go to the Font group on the HOME tab and open the Fill Color drop-down list.
3. Choose the white color from the list to remove gridlines.
Note: If you want to show lines in Excel, pick the No Fill option.

As you can see in the screenshot above, applying the white background will give an effect of
hidden gridlines in your worksheet.
Make Excel hide gridlines only in specific cells
In case you want Excel to hide gridlines only in a certain block of cells, you can use the white
cells background or apply white borders. Since you already know how to change the
background color, let me show you how to remove gridlines by coloring the borders.
1. Select the range where you want to remove lines.

2. Right-click on the selection and choose Format Cells from the context menu.

Note: You can also use the Ctrl + 1 keyboard shortcut to display the Format Cells dialog.
3. Make sure that you are on the Border tab in the Format Cells window.

4. Choose the white color and press the Outline and Inside buttons under Presets.

5. Click OK to see the changes.


Here you go. Now you have an eye-catching "white crow" in your worksheet.

Note: To bring gridlines back to the block of cells, choose None under Presets in the Format
Cellsdialog window.
Remove gridlines by changing their color
There is one more way to make Excel hide gridlines. If you change the default gridline color into
white, gridlines will disappear in the whole worksheet. If you're interested in this method, feel
free to find out how to change the default gridline color and print gridlines in Excel 2010 / 2013.
You see there are different ways to show and hide gridlines in Excel. Just choose the one that
will work best for you. If you know any other methods of showing and removing cell lines, you
are welcome to share them with me and other users! :)

How to make Excel print gridlines


One of the most common complaints about gridlines is that they are not printed by default. In
this article you'll learn how to print gridlines in Excel and get these faint lines brighter on a hard
copy by changing the default gridline color.
It's a good idea to preview your worksheet before getting it on paper to make sure that it looks
the way you want. Luckily, Excel 2010 and 2013 allow you to preview and print your files in one
location on the Print tab in the Backstage view. When you go there, you may find that Excel
won't print gridlines in your sheet. As the result, you will get a stack of papers with the data that
can be difficult to separate visually.
To cope with this problem, you can use the Borders option or just make Excel print gridlines.
The first way will take you a good deal of time. So if you, as many other users, want to do it
faster, read this article and find out how to print lines in Excel without drawing cell borders.

Turn on the Print Gridlines option in the Excel Ribbon


Specify the Page Setup settings to print lines in Excel
Change the printed gridlines color
Turn on the Print Gridlines option in the Excel Ribbon
It really takes you a few seconds to instruct Excel to print gridlines. Just go to the Sheets
Optionsgroup on the PAGE LAYOUT tab and check the Print box under Gridlines.

It's that simple! Now you can leisurely keep working on your worksheet.
If you want to make sure that the document will be printed with gridlines, just navigate to FILE
-> Print or press the Ctrl + P keyboard shortcut. In the Print Preview pane you will see how your
worksheet will look like on the printouts.

Specify the Page Setup settings to print lines in Excel


If you forget to enable the Print Gridlines option in the Ribbon, you can do it just before getting a
paper copy of your spreadsheet. Here are easy-to-follow steps to print gridlines in Excel keeping
the Print Preview pane open.
Note:If you've already got out of the Backstage view, you can either go to FILE -> Print or
press Ctrl + P to come back.

1. Click on the Page Setup link under the Print Settings list.

2. Move to the Sheet tab of the Page Setup dialog box.

3. Select the Gridlines checkbox in the Print group.

4. Click OK.
You will immediately see your spreadsheet with lines in the Print Preview pane.
Note:Excel does not print gridlines around empty cells in a worksheet. If you want to include
blank rows and columns into printing as well, just use the Print Area icon to set the range.

Change the printed gridlines color


By default, gridlines in Excel spreadsheets are light gray. If you're printing your sheet with grid
on a color printer, you can change the lines color for something more attention-getting.

1. Click the FILE tab in the Ribbon.


2. Choose Options from the FILE menu to open the Excel Options dialog.

>
3. Select the Advanced category on the left pane of the Excel Options window.
4. Scroll down to Display options for this worksheet.

5. Pick the sheet from the drop-down list where you want to change the grid lines color.

6. Make sure that the Show gridlines checkbox is selected.

7. Click on the small arrow next to Gridline color.

8. Choose the color you want and click OK.

You will see that the cell boundaries are accurately outlined by colored lines. They will help you
read information on the paper copy of your spreadsheet, keeping rows and columns with data
visually organized.
Alongside with grid lines, you can also improve readability of your Excel document by printing
row and column headers on every page.
Now you know how to print gridlines in Excel 2010 2013 and change the default gridline color.
I hope you'll find these simple tricks helpful, and your colleagues will appreciate your friendly
way of printing out data.

How to convert Excel tables to HTML


If you created a pretty Excel table and now want to publish it online as a web page, the simplest
way is to export it to an old good html file. In this article, we are going to explore several ways of
converting Excel data to HTML, determine pros and cons of each, and walk you through the
conversion process step-by-step.

Convert Excel table to HTML by saving as web page


Excel to HTML converters
Excel web viewers
Convert Excel tables to HTML using "Save as Web Page" option
Using this method you can save an entire workbook or any portion of it, such as a selected
range of cells or chart, to a static web page (.htm or .html) so that anyone can view your Excel
data on the web.
For example, you have created a feature-rich report in Excel and now want to export all the
figures along with a pivot table and chart to your company's web-site, so that your workmates
can view it online in their web-browsers without opening Excel.

To convert your Excel data to HTML, perform the following steps. These instructions apply to all
"ribboned" versions of Excel 2013, 2010 and 2007:

1. On the workbook, go to the File tab and click Save As.


If you want to export some portion of data only, e.g. a range of cells, pivot table or graph, select
it first.
2. In the Save As dialog, choose one of the following:

Web Page (.htm; .html). This will save your workbook or the selection to a web page and
create a supporting folder that will store all of the page's supporting files such as images, bullets
and background textures.
Single File Web Page (.mht; .mhl). This will save your workbook or the selection to a
single file with supporting files embedded into the web page.

3. If you selected a range of cells, a table or a chart before clicking Save as, then select
theSelection radio button, click Save and you are close to finished.

If you have not selected anything yet, continue with the following steps.

To save the entire workbook, including all the worksheets, graphics and tabs for
navigating between sheets, select Entire Workbook.
To save the current worksheet, choose Selection: Sheet. In the next step you will be
given a choice whether to publish the whole worksheet or some of the items.

You can also set a title for your web-page now by clicking the Change Title... button in the righthand part of the dialog window. You will also be able to set or change it later, as described in
step 6 below.
4. Click the Publish button and this will open the Publish as Web Page dialog window. Let's
briefly go through each of the available options, from top to bottom.
5. Items to publish. Here you choose what portion(s) of your Excel workbook you want to
export to a web-page.
In the drop-down list next to Choose, you have the following choices:

Entire workbook. The whole workbook will be published, including all of the worksheets
and tabs to navigate between sheets.
Entire worksheet or certain items on a worksheet, such as pivot tables, charts, filtered
ranges and External data ranges. You select "Items on SheetName", and then choose either

"All contents" or particular items.

Ranges of cells. Select Range of cells in the drop-down list and then click the range
selection icon to select the cells you want to publish.
Previously published items. Select this option if you want to republish a worksheet or
items you have already published. If you'd rather not republish a certain item, select the item in
the list and click the Remove button.
6. Title of the web-page. To add a title that will be displayed in the title bar of the browser, click
the Change button next to Title: and type in the title you want.

7. Click the Browse button next to File name and choose the hard drive, folder, web folder, web
server, HTTP site, or FTP location where you want to save your web page.

Tips: If you are converting an Excel workbook to an HML file for the first time, it makes sense to
save the web page onto your local hard drive first so that you can make the needed corrections
before publishing the page on the web or your local network.
You can also choose to export your Excel file to an existing web page provided that you have
permissions to modify it. In this case, upon clicking the Publish button, you will see a message
prompting you to choose whether you want to overwrite the content of the existing web-page or
append your data to the end of the web page. If the former, click Replace; if the latter, clickAdd
to file.
8. Select "AutoRepublish every time this workbook is saved" if you want to have the
workbook or selected items automatically republished after each saving of the workbook. I'll
explain theAutoRepublish feature in more detail further on in the article.
9. Select the "Open published Web page in browser" check box in case you want to view the
web page right after saving.
10. Click the Publish button and you are done!
As you can see in the screenshot below, our Excel table looks fairly nice online, though the
design of the original Excel file is a bit distorted.

Note: The HTML code created by Excel is not very clean and if you are converting a large
spreadsheet with a sophisticated design, it may be a good idea to use some HTML editor to
clean up the code before publishing so that it will load more quickly onto your web site.
5 things you should be aware of when converting an Excel file to HTML
When you use Excel's Save as Web Page function, it is important that you understand how its
main features work in order to avoid most typical mistakes and prevent common error
messages. This section provides a quick overview of the options you should pay special
attention to when exporting your Excel spreadsheet to HTML.
1. Supporting files and hyperlinks
As you know, web pages often contain images and other supporting files as well as hyperlinks
to other web-sites. When you convert an Excel file to a web page, Excel automatically manages
the related files and hyperlinks for you and saves them to the supporting files folder,
namedWorkbookName_files.
When you save the supporting files such as bullets, graphics and background textures to the
same web server, Excel maintains all the links as relative links. A relative link (URL) points to a
file within the same web site; it specifies the file name or a root folder only rather than the full
website address (e.g. href="/images/001.png"). When you delete any item saved as a relative
link, Microsoft Excel automatically removes the corresponding file from the supporting folder.
So, the main rule is to always keep the web page and supporting files in the same location,
otherwise your web page may no longer display properly. If you move or copy your web page to
another location, be sure to move the supporting folder to the same location to maintain the
links. If you re-save the web page to another location, Microsoft Excel will copy the supporting
folder for you automatically.
When you save your web pages to different locations or if your Excel files contain hyperlinks to
external web sites, absolute links are created. An absolute link specifies the full path to a file or
a web-page that can be accessed from anywhere, e.g. www.yourdomain/products/product1.htm.
2. Making changes and re-saving a Web page
In theory, you can save your Excel workbook as a Web page, then open the resulting web page
in Excel, make edits and re-save the file. However, in this case some Excel features will no
longer be working. For example, any charts contained in your workbook will become separate
images and you won't be able to modify them in Excel as usual.
So, the best practice is to maintain your original Excel workbook up to date, make changes in
the workbook, always save it as a workbook (.xlsx) first and then save as a Web page file (.htm
or .html).
3. AutoRepublishing a Web page
If you selected the AutoRepublish checkbox in the Publish As Web Page dialog discussed in
step 8 above, then your web page will get updated automatically every time you save your Excel

workbook. This is a really helpful option that lets you always maintain an up-to-date online copy
of your Excel table.
If you have turned on the AutoRepublish feature, a message will appear each time you save the
workbook asking you to confirm whether you want to enable or disable AutoRepublish. If you
want to have your Excel spreadsheet republished automatically, then naturally
select Enable...and click OK.

However, there are some circumstances when you may not want to republish your spreadsheet
or selected items automatically, e.g. if your Excel file contains confidential info or has been
edited by someone who is not a trusted source. In this case, you can make AutoRepublish
temporarily or permanently unavailable.
To temporarily disable AutoRepublish, select the first option "Disable the AutoRepublish
feature while this workbook is open" in the above-mentioned message. This will turn off autorepublishing for the current session, but it will be enabled again the next time you open the
workbook.
To permanently disable AutoRepublish for all or selected items, open your Excel workbook,
choose to save it as Web page and then click the Publish button. In the Choose list, under
"Items to publish", select the item you do not want to republish and click the Remove button.

4. Excel features not supported in web pages

Regrettably, a couple of very useful and popular Excel features are not supported when you
convert your Excel worksheets to HTML:

Conditional formatting is not supported when saving an Excel spreadsheet as a Single


File Web Page (.mht, .mhtml), so make sure you save it in the Web Page (.htm, .html) format
instead. Data bars, color scales, and icon sets are not supported in either web page format.
Rotated or vertical text in not supported either when you export Excel data online as a
Web page. Any rotated or vertical text in your workbook will be converted to horizontal text.
5. Most common issues when converting Excel files to HTML
When converting your Excel workbook to a web page, you may run into the following known
issues:

Cell's content (text) is truncated or not completely displayed. To prevent text from
being cut off, you can either turn off the wrapped text option, or shorten the text, or widen the
column width, also make sure the text is aligned to the left.
The items you save to an existing Web page always appear at the bottom of the
page while you want them at the top or in the middle of the page. This is a normal behavior
when you choose to save your Excel file as an existing web page. To move your Excel data to
another position, either edit the resulting web-page in some HTML editor or rearrange the items
in your Excel workbook and save it as a web page anew.
Links on the web page are broken. The most obvious reason is that you have moved
either the web page or the supporting folder to another location. See supporting files and
hyperlinksfor more details.
A red cross (X) is displayed on the Web page. A red X indicates a missing image or
other graphic. It may get broken for the same reason as hyperlinks. Just make sure you always
keep the web-page and supporting folder in the same location.
Excel to HTML converters
If you often need to export your Excel tables to HTML, the standard Excel means we have just
covered may seem a bit too long way. A faster method is to use an Excel to HTML converter,
either online or desktop. There are a handful of online converters on the Internet both free and
paid and we are going to try a few right now.
TABLEIZER - free and simple Excel to HTML online converter
This one-click online converter handles simple Excel tables with ease. All you need to do is to
paste the contents of your Excel table to the window and click the Tableize It! button. Some
basic formatting options such as font size, font type, header color, and even CSS styles are

available.

After that you just copy the HTML code generated by the Tableizer converter and paste it to your
webpage. The best thing when using this tool (apart from speed, simplicity and no cost : ) is the
preview window that shows how your Excel table is going to look like online.

However, the formatting of your original Excel table will not be automatically converted to HTML
as you see in the screenshot below, which is a very significant drawback in my judgment.

If you are interested to try this online converter, you can find it
here:http://tableizer.journalistopia.com/
Another free Excel to HTML converter is available at pressbin.com, though it yields to Tableizer
in many respects - no format options, no CSS and even no preview.
Advanced Excel to HTML converter (paid)
Unlike the two previous tools, the SpreadsheetConverter works as an Excel add-in and
requires installation. I've downloaded a trial version (as you understand from the heading, this is
commercial software) to see if it is in any respect better than either free online converter we've
just experimented with.

I must say I was impressed! The conversion process is as easy as clicking the Convert button
on the Excel ribbon.

And here is the result - as you can see, the Excel table exported to a web-page looks very close
to the source data:

For the sake of experiment, I've also tried to convert a more complex workbook containing
several sheets, a pivot table and a chart (the one we saved as web page in Excel in the first part
of the article) but to my disappointment the result was much inferior to what Microsoft Excel
produced. Maybe this is just because of the trial version's limitations.

Anyway, if you are willing to explore all the capabilities of this Excel to HTML converter, you can
download an evaluation version of the SpreadsheetConverter add-in here.
Excel web viewers
If you are not happy with the performance of Excel to HTML converters and are looking for
alternatives, some web viewer may work a treat. Below you will find a quick overview of several
Excel Web Viewers so that you can get a feel of what they are capable of.
Zoho Sheet online viewer allows viewing Excel spreadsheets online by either uploading a file or
entering the URL. It also provide an option to create and manage Excel spreadsheets online.
This is probably one of the most powerful free online Excel viewers. It supports some basic
formulas, formats and conditional formatting, allows you to sort and filter the data and convert it
to a number of popular formats such as .xlsx, .xls, .ods, .csv, .pdf, .html and others, as you see
in the screenshot below.

Its main weakness is that it does not keep the format of the original Excel file. I also have to
admit that Zoho Sheet web viewer was not able to cope with a sophisticated spreadsheet
containing a custom table style, complex formulas and a pivot table.
You can also check out a couple of other Excel web viewers, e.g. XML Grid.net and EditGrid,
but these are much inferior in terms of features and supported formats.
Well, we have explored a few options to convert Excel spreadsheets to HTML. Hopefully, this
will help you choose the technique in accordance with your priorities - speed, cost or quality?
The choice is always yours : )

In the next article we are going to continue this topic and investigate how you can move your
Excel data online using Excel Web App and Excel Online.

Alternating row color and column shading in Excel (banded rows and columns)
This tutorial explains how you can alternate row colors in Excel to automatically highlight every
other row or column in your worksheets. You will also learn how to apply Excel banded rows
and columns and find a few smart formulas to alternate row shading based on a value change.
It is a common practice to add shading to alternate rows in an Excel worksheet to make it easier
to read. While it is a relatively easy job to highlight rows of data manually in a small table, it
could be an arduous task in larger ones. A better way is to have row or column colors alternated
automatically and this article is going to show you how you can quickly do this.

o
o

o
o

Alternate row colors in Excel


Shade every other row using table styles (Excel banded rows)
Alternate row shading with conditional formatting
Alternate column shading in Excel
Shade every other column using table styles (banded columns)
Highlight alternate columns with conditional formatting
Alternating row color in Excel
When it comes to shading every other row in Excel, most gurus will immediately point you to
conditional formatting, where you will have to invest some time in figuring out an ingenious mix
of MOD and ROW functions.
If you'd rather not use a sledge-hammer to crack nuts, meaning you don't want to waste your
time and creativity on such a trifle as zebra striping Excel tables, consider applying the built-in
table styles as a quick alternative.
Highlight every other row using table styles (Excel banded rows)
The fastest and easiest way to apply row shading in Excel is by using predefined Excel table
styles. Along with other benefits of tables such as automatic filtering, color banding is applied to
rows by default. All you need to do is convert a range of data to table.
1. Select the range of cells where you want to alternate color rows.
2. Navigate to the Insert tab on the Excel ribbon and click Table, or press Ctrl+T.

3. Done! The odd and even rows in your table are shaded with different colors. The best thing is
that automatic banding will continue as you sort, delete or add new rows to your table.

If you'd rather have alternate row shading only, without the table functionality, you can easily
convert the table back to a usual range. To do this, select any cell within your table, right click
and choose Convert to Range from the context menu.

Note: If you opt to convert a table to range, you won't get the automatic color banding when you
add new rows to the range. Another disadvantage is that as you sort the data, i.e. move certain
cells or entire rows within the range, your color bands will travel with the original rows and your
nice zebra stripe pattern will get distorted.
As you can see, converting a range to table is a very easy and quick way of highlighting
alternate rows in Excel. But what if you want a bit more?
How to choose your own colors of row stripes
If you are not happy with the default blue and white pattern of an Excel table, you have plenty
more patterns and colors to choose from. Just select your table or any cell within the table,
switch to the Design tab > Table Styles group and select the colors of your liking.
You can use the arrow buttons to scroll through the available table styles or click
the More button

to view them all. When you hover the mouse cursor over any style, it is

immediately reflected to your table and you can see how your banded rows would look like.

How to highlight a different number of rows in each zebra line


In case you want to highlight a different number of rows in each stripe, e.g. shade 2 rows in one
color and 3 in another, then you will need to create a custom table style. Assuming that you
have already converted a range to table, perform the following steps:
1. Navigate to the Design tab, right click on the table style you want to apply and
chooseDuplicate.

2. In the Name box, enter a name of your table style.


3. Select "First Row Stripe" and set the Stripe Size to 2, or to some other number you want.

4. Select "Second row stripe" and repeat the process.


5. Click OK to save your custom style.

6. Apply the newly created style to your table by selecting it from the Table Styles gallery. Your
custom styles are always available at the top of the gallery under Custom.

Note: Custom table styles are stored only in the current workbook and therefore are not
available in your other workbooks. To use your custom table style as the default table style in
the current workbook, select the "Set as default table style for this document" check box
when creating or modifying the style.

If you are not happy with the style you created, you can easily modify it by right-clicking your
custom style in the Styles Gallery and choosing Modify from the context menu. And here you
have plenty of room for your creativity! You can set any Font, Border, and Fill styles on the
corresponding tabs, even choose gradient stripe colors, as you see in the screenshot below : )

Delete alternate rows shading in Excel with a click


If you no longer want to have color banding in your Excel table, you can remove them literally in
a single click. Select any cell in your table, go to the Design tab and uncheck the Banded
rowsoption.

As you see, Excel's predefined table styles provide a wealth of features to alternate color rows
in your worksheets and create custom banded rows styles. I believe they will suffice in many
situations, though if you want something special, e.g. shading entire rows based on a change of
value, then you will need to use conditional formatting.
Alternate row shading using Excel conditional formatting
It goes without saying that conditional formatting is a bit trickier that Excel table styles we have
just discussed. But it has one undisputable benefit - it allows more room for your imagination
and lets you zebra stripe your worksheet exactly as you want it is each particular case. Further
on in this article, you will find a few examples of Excel formulas for alternating row colors:

Simple Excel formula to shade every other row


Create color bands of a fixed number of rows
Highlight rows using 3 colors
Shade groups of rows based on value change
Highlight every other row in Excel using conditional formatting
We are going to start with a very simple MOD formula that highlights every other row in Excel. In
fact, you can achieve exactly the same result using Excel Table styles, but the main benefit of
conditional formatting is that it works for ranges as well, meaning that your color banding will
remain intact as you sort, insert or delete rows in a range of data to which your formula applies.
You create a conditional formatting rule in this way:
1. Select the cells you want to shade. To apply the color banding to the entire worksheet, click
theSelect All button in the top left-hand corner of your spreadsheet.

2. Switch to the Home tab > Styles group and click Conditional Formatting > New Rule...

3. In the New Formatting Rule window, choose "Use formula to determine which cells to
format" option and enter this formula: =MOD(ROW(),2)=0

4. Then click the Format button, switch to the Fill tab and select the background color that you
want to use for the banded rows.

At this point, the selected color will appear under Sample. If you are happy with the color,
click OK.

5. This will bring you back to the New Formatting Rule window, and you click OK one more time
to apply to color to every other of the selected rows.
And here's how the result looks like in my Excel 2013:

If you'd rather have 2 different colors instead of white lines, then create a second rule using this
formula: =MOD(ROW(),2)=1

And now you have odd and even rows highlighted with different colours:

That was pretty easy, wasn't it? And now I'd like to briefly explain the syntax of the MOD function
because we are going to use it in other a bit more complex examples.
The MOD function - MOD(number, divisor) - returns the remainder rounded to the nearest
integer after the number is divided by the divisor.
For example, =MOD(4,2) returns 0, because 4 is divided by 2 evenly (without remainder).
Now, let's see what exactly our MOD function, one that we've used in the above example, does.
As you remember we used a combination of the MOD and ROW functions: =MOD(ROW(),2)
The syntax is simple and straightforward: the ROW function returns the row number, then the
MOD function divides it by 2 and returns the remainder rounded to the integer. When applied to
our table, the formula returns the following results:
Row No.

Formula

Result

Row 2

=MOD(2,2)

Row 3

=MOD(3,2)

Row 4

=MOD(4,2)

Row 5

=MOD(5,2)

Do you see the pattern? It's always 0 for even rows and 1 for odd rows. And then we create
the conditional formatting rules telling Excel to shade odd rows (where the MOD function returns
0) in one color and even rows (that have 1) in another color.
Now that you know the basics, let's look into more sophisticated examples.
How to alternate groups of rows with different colors
You can use the following formulas to shade a fixed number of rows, regardless of their content:
Odd row shading, i.e. highlight the 1st group and every other group:
=MOD(ROW()-RowNum,N*2)+1<=N
Even row shading, i.e. highlight the 2nd group and all even groups:

=MOD(ROW()-RowNum,N*2)>=N
Where RowNum is a reference to your first cell with data and N is the number of rows in each
banded group.
Tip: If you want to highlight both even and odd groups, then simply create 2 conditional
formatting rules with both of the above formulas.
You can find a few examples of formula usage and the resulting color banding in the following
table.
To color every 2
rows, starting from
the 1stgroupThe data
starts in row 2.

=MOD(ROW()2,4)+1<=2

To color every 2
rows, starting from
the 2ndgroupThe data
starts in row 2.

=MOD(ROW()-2,4)>=2

To color every 3
rows, starting from
the 2ndgroupThe data
starts in row 3.

=MOD(ROW()-3,6)>=3

How to shade rows with 3 different colors


If you think your data will look better with rows shaded in three different colors, then create 3
conditional formatting rules with these formulas:
To highlight 1st and every 3rd row =MOD(ROW($A2)+3-1,3)=1
To highlight 2nd, 6th, 9th etc. =MOD(ROW($A2)+3-1,3)=2

To highlight 3rd, 7th, 10th etc. =MOD(ROW($A2)+3-1,3)=0


Remember to replace A2 with a reference to your first cell with data.
The resulting table will look similar to this in your Excel:

How to alternate row colors based on a value change


This task is similar to the one we discussed a moment ago - shading groups of rows, with the
difference that there may be a different number of rows in each group. I believe, this will be
easier to understand from an example.
Suppose, you have a table containing data from different sources, e.g. regional sales reports.
What you want is shade the first group of rows related to the first product in Color 1, the next
group related to the second product in Color 2 and so on. Column A listing the product names
may serve as the key column or unique identifier.

To alternate row shading based on value, you'd need a bit more complex formula and an
additional column:
1. Create an additional column over the right side of your worksheet, say column F. You will be
able to hide this column later.
2. Enter the following formula in cell F2 (assuming that row 2 is your first row with data) and
then copy it across the entire column:
=MOD(IF(ROW()=2,0,IF(A2=A1,F1, F1+1)), 2)

The formula will fill down column F with blocks of 0 and 1, every new block staring with the
Product name change.

3. And finally, create a conditional formatting rule using the formula =$F2=1. You can add a
second rule =$F2=0 if you want a second color to alternate blocks of rows, as shown in the
screenshot:

Alternating column colors in Excel (banded columns)


In fact, shading columns in Excel is pretty much similar to alternating rows. If you have
understood all of the above, this part is going to be a piece of pie for you : )
You can apply shading to columns in Excel by using either:

Excel table styles


Conditional formatting rules
Alternate column colors in Excel with table styles
1. You start with converting a range to a table (Ctrl+T).

2. Then switch to the Design tab, remove a tick from Banded rows and select Banded
columnsinstead.

3. Voila! Your columns are shaded with the default table colors.

In case you'd like prettier colors, you are free to choose any other pattern from the Table Styles
Gallery.
If you want to shade a different number of columns in each stripe, then create a duplicate of
an existing table style of your choosing, exactly as described here. The only difference is that
you choose "First Colum Stripe" and "Second Colum Stripe" instead of the corresponding

row stripes.

And this is how your custom column bands may look like in Excel:

Alternating column colors with conditional formatting


The formulas to apply color banding to alternate columns in Excel are very similar to the ones
we've used for shading alternate rows. You just need to use the MOD function in conjunction
with the COLUMN function rather than ROW. I will name but a few in the table below and I'm
sure you will easily convert other "row formulas" to "column formulas" by analogy.

To color every
other column

=MOD(COLUMN(),2)=0
and/or
=MOD(COLUMN(),2)=1

To color every 2
columns, starting
from the 1st group

=MOD(COLUMN()1,4)+1<=2

To shade columns
with 3 different
colors

=MOD(COLUMN()
+3,3)=1
=MOD(COLUMN()
+3,3)=2
=MOD(COLUMN()
+3,3)=0

Hopefully, now you won't have any problems with applying color banding in Excel to make your
worksheets handsome and more readable. If you want to alternate row or column colors in
some other way, don't hesitate to leave me a comment and we will figure this out together.
Thank you for reading!

How to transpose in Excel - convert row to column and vice versa


Transposing data in Excel is a problem familiar to many users. Quite often after building a
complex table it becomes evident that it would be more efficient to rotate it for better analysis or
transformation of data into graphs.
In this article, you will find several ways to convert rows to columns (or columns to rows) in
Excel, whichever you call it, it's the same thing : ) These solutions work in all versions of Excel
2013, 2010, 2007 and lower, cover many possible scenarios, explain most typical mistakes and
provide good examples of using Excel's Transpose function and formulas.

Convert row to column by copying / pasting


Transpose a table by copy /paste linked to the original data
Transpose data in Excel using formulas
Extract rows in Excel based on a certain column
Convert rows to columns in Excel using Paste Special (Transpose)
Suppose you have created an Excel spreadsheet similar to what you see in the upper part of
the graphics below. The country names are organized in columns, but the list of countries may
be too long, so we'd better change columns to rows for the table to fit within the screen:

1. Select the rows and columns you want to switch. If you want to rotate the entire table, i.e. all
the cells with data in a spreadsheet, press Ctrl+Home and then Ctrl+Shift+End.
2. Copy the selected cells either by right clicking the selection and choosing Copy from the
context menu, or pressing Ctrl+C, or clicking the Copy button on the Home tab > Clipboard
group.
3. Select the first cell of the destination range into which you want to copy the transposed data.
Note: It's important that you select a cell that falls outside of the range containing your original
data, so that the copy areas and paste areas do not overlap. For example, if you currently have
4 columns and 10 rows, once you transpose the table it will be 10 columns and 4 rows.
4. Paste the copied data using Paste Special > Transpose feature. You can open the Paste
Specialdialog in 3 ways:

On the Home tab > Clipboard group, click the little black arrow below the Paste button,
and selectTranspose.
Right click the destination cell and choose Paste Special from the context menu, then
selectTranspose.
And finally, the fastest way is to press CTRL+ALT+V, select Transpose and click OK.

Note: If you transpose cells that contain formulas, make sure that absolute references (with $
sign) are used in all cells. This is necessary because your formulas will also be transposed and
cell references automatically adjusted.
As, you have just seen, Excel's Transpose feature lets you perform row to column (or column to
row) transformations literally in a few seconds. I believe this solution is a really good way to go if

transposing a table is a one-time process. This method also copies the formatting of your
original data, which adds one more argument in its favor.
However, the above mentioned approach has two drawbacks that prevent it from being called
a perfect solution for transposing data in Excel:

The transpose option is not available when copying/pasting a fully-functional Excel table,
as opposed to a simple range. In this case, you need either to copy the table without column
headers, or convert it to range (right click any cell in the table and choose Table > Convert to
Range from the context menu).
A more serious limitation of this method is that it creates a copy of your original data and
whenever the source data change, you'd need to repeat the process and rotate the table anew.
No one would want to waste their precious time on converting the same rows and columns over
and over again, right?
How to transpose a table linked to the original data
Let's see how you can switch rows to columns in Excel using the familiar copy / paste technique
that would link the transposed cells to the original data. The best thing with using this approach
is that whenever you change the data in the source table, the transposed table will reflect the
changes and update accordingly.
1. Copy the rows you want to convert to columns (or columns to be converted to rows).
2. Select an empty cell in the same or another worksheet.
3. Open the Paste Special dialog, as explained in the previous solution and select Paste Link in
the lower left-hand corner of the dialog window.

You will have a result similar to this:

4. Select this new data and open Excel's Find and Replace dialog (you can press CTRL+H to
get to the Replace tab straight away).
5. Replace all "=" characters with "xxx" (you can actually replace it with any other character(s)
that do not exist anywhere in your real data).

This will turn your table into something a bit scary, as you see in the screenshot below, but don't
be afraid, just 2 more steps, and you'll achieve the desired result.

6. Copy the table with "xxx" values, and then apply Paste Special > Transpose to convert the
columns to rows, or rows to columns, depending on your needs.
7. And finally, open the Find and Replace dialog one more time to reverse the change, i.e.
replace all "xxx" with "=" to restore the links to the original cells. Done!

This is a quick, stress-free and elegant solution, isn't it? The only drawback of this approach is
that the original table's formatting gets lost in the process and you will need to restore it
manually (I'll show you a quick way to do this further on in this tutorial).
Transpose data in Excel using formulas
If you are not looking for easy ways, then you can utilize formulas to convert columns to rows in
your Excel tables and vice versa.

Convert rows to columns in Excel using TRANSPOSE function


As its name suggests, the Transpose function is specially designed for transposing data in
Excel. If you don't have much experience with Excel formulas in general, and array functions in
particular, please make sure you follow the below steps closely.
In this example, we are going to convert another table that lists U.S. states by population:

First off, you need to determine the exact number of rows and columns in your table. Our
sample table has 7 columns and 6 rows, including headings. Keeping these numbers in mind,
let's start rotating rows to columns.
1. Count the cells you want to transpose. In our case it is 7 columns and 6 rows.
2. Select an empty range of cells. Since the TRANSPOSE function shifts the vertical and
horizontal orientation of a selected range, you need to select the same number of rows and
columns as your source table has columns and rows, respectively. In our example, we are
selecting 6 columns and 7 rows.
3. Press F2 to enter the edit mode.
4. Write the TRANSPOSE function and enter the data range you want to transpose in
brackets:=TRANSPOSE(array). In our case, we enter =TRANSPOSE($A$1:$G$6).
Note: You always need to use absolute references in the Transpose function.

5. Press CTRL+SHIFT+ENTER.
Note: You do need to hit Ctrl+Shift+Enter because this is an array formula, pressing
simplyEnter won't work.
Done! Our data is transposed and we have 7 columns changed into 6 columns, exactly as we
wanted:

Advantages of TRANSPOSE function:


The main benefit of using the TRANSPOSE function is that the rotated table retains the
connection to the source table and whenever you change the source data, the transposed table
will also change accordingly.
Weaknesses of TRANSPOSE function:

The original table formatting is not saved in the converted table, as you see in the
screenshot above.
If there are any empty cells in the sores table, the transposed cells will contain 0 instead.

You cannot edit any cells in the converted table because the TRANSPOSE function is
very much dependent on the source data. If you try to change some cell's value, you will end up
having "You cannot change part of an array" error.
Wrapping up, whatever good and easy-to-use the TRANSPOSE function is, it certainly lacks
flexibility and therefore may not be the best way to go in many situations.
Row to column / column to row transformation using INDIRECT function
This method of converting column to row and vice versa is pretty much similar to the previous
one. Its main benefit over the Transpose function is that it allows making changes in the
transposed table, at the same time keeping the connection to the original table.
We will use a small table in this example so that you can focus on the transpose process rather
than on the data because we will be using a combination of INDIRECT and ADDRESS
functions, which is a little bit tricky.
Suppose, you have data in 4 columns (A - D) and 5 rows (1 - 5):

1. Enter the below formula in the left most cell of the destination range, let's say A7, and press
theEnter key:
=INDIRECT(ADDRESS(COLUMN(A1),ROW(A1)))
If your data starts in some row other than 1 and column other than A, you will have to use a bit
more complex formula:
=INDIRECT(ADDRESS(COLUMN(A1) - COLUMN($A$1) + ROW($A$1), ROW(A1) ROW($A$1) + COLUMN($A$1)))
Where A1 is the top-right-most cell of your source table. Also, please mind the use of absolute
and relative cell references.
2. Copy the formula through the range where you want to put the transposed data as usual by
dragging a small black cross in the lower right hand corner of a selected cell or range of cells.

That's it! In your newly created table, all of the columns are switched to rows.
However, the transposed cells do look very plain and dull, compared to the original data.

But don't get disappointed, this is not a problem at all. You can easily restore the source
formatting in this way:

Copy the original table;


Select the transposed table;
Right click the transposed table and choose Formatting under Paste Options.

Summing up, INDIRECT seems to be a more flexible way to turn rows to columns in Excel than
the TRANSPOSE function.
Advantages: you can easily edit any cell(s) in the transposed table, at the same time it stays
linked to the original table and gets updated automatically whenever you make changes in the
source data.
Shortcomings: in fact, I can see only one - the formatting of the ordinal data is not saved.
Though, you can quickly restore it, as shown above.
Now that you've got a feel how the INDIRECT function works, you may want to get the insight of
what the formula is actually doing and why we use it in combination with the ADDRESS
function. If you are not interested in tech details, you can skip directly to the next (the easiest!)
way ofextracting certain rows and converting them to columns.
INDIRECT and ADDRESS functions - syntax and logic
INDIRECT function, as its name suggests, is used to indirectly reference a cell. For example, if
you want to have the value of cell B1 in cell A8, then you enter this formula in A8

=INDIRECT("B1").

But the real power of the INDIRECT function is that it can turn any string into a reference,
including a string that you build up using other functions and the values of other cells. And this is
exactly what we are going to do next. If you are following up to this, you will understand all the
rest with ease : )
As you remember, we have used 3 more functions in the formula - ADDRESS, COLUMN and
ROW.
The ADDRESS function is used to obtain the address of a cell by the row and column numbers
you specify, respectively. Please remember this: first - row, second - column. For example,
ADDRESS(8,1) returns $A$8.
The COLUMN function returns the column number of the given cell reference. For example,
=COLUMN(A3) returns 1, because column A is the 1st column. As you can easily guess, the
ROW function works exactly in the same way for rows.
And now, let me remind you the entire formula that we've used to convert rows to columns in
our Excel worksheet: =INDIRECT(ADDRESS(COLUMN(A1),ROW(A1)))
As you see, in the ADDRESS function, we specify first COLUMN(A1) and then ROW(A1), and
this is what actually does the trick! Remember, the ADDRESS function interprets the first
number as a row number, and the second as a column number. In other words, the ADDRESS
function takes a column number returned by the COLUMN function and changes it to a row
number, then takes a row number and turns it to column, i.e. swaps rows to columns.
Now that you know what each function does, let's sum up the entire logic: COLUMN and ROW
functions return the column and row numbers, respectively -> ADDRESS function converts
column to row and row to column - > INDIRECT function outputs the rotated data to another cell
in your Excel spreadsheet. Nothing dreadful at all, is it?

Transpose data in Excel using VBA macro


It's not a big problem to write a script that transposes rows to columns, given that you have
good knowledge of VBA. If you don't, you can find plenty of ready-to-use macros on the
Internet. But if you are working with large tables, please keep in mind that VBA's Transpose
method has a limitation of 65536 elements. In case your array exceeds this limit, the extra data
will be silentlycast away.
Extract rows in Excel based on a certain column
When you a huge data set in Excel, you may often need to extract some rows based on a
certain column or pull data from selected columns only. At that, you may want to change a table
in vertical orientation into a horizontal style placing the headings in the left most column and
having the data in subsequent columns.
For example, we have a large employee database and want to extract the entries of all project
managers from company's regional offices.

The task sounds trickier than everything else we have done so far, right? But the solution is very
simple! You won't need any complex functions or formulas, just a few clicks in the Extract Data's
wizard.

Extract Data is an add-in for Microsoft Excel 2013 - 2003 specially designed for extracting rows
of data from Excel worksheets and converting rows to columns. I will give you a quick example
demonstrating how it works.
1. Select the table from which you want to extract the rows and click on the Extract Data icon on
the Excel Ribbon > Ablebits Data tab. You can actually click on any cell in your table and the
add-in will select the entire table automatically.

2. Select the rows you want to retrieve. You can choose to extract data from all the columns by
checking the Columns check box or from some of the columns, as show in the screenshot
below.

2. In this step, you specify the column by which you want to group the extracted data, it's
thePosition column in our case. Also, you choose whether to place the extracted and rotated
rows in one spreadsheet or separate sheets, in the same or a different worksheet.

If you are not sure which exactly layout suits you better, hover the mouse over the i icon to
the right of the option you choose and you will see a mockup of how the data will be transposed.

3. Finally, you choose the destination for extracted and converted rows - the same workbook or
a new workbook. You may also choose whether to add headers and auto fit column width.

4. Click the Finish button and you are done!


If you think this tool may prove to be useful in your work, go ahead with a free download (15day trial version). If you like it, the price will come as a pleasant surprise.
And this is all I have to say about converting row to column and column to row in Excel.
Hopefully, you've found a solution you have been looking for, if not then don't hesitate to let me
know in comments; if yes - please drop me a line too : ) Thank you for reading!

How to split cells in Excel: Text to Columns, Flash Fill and formulas
In this article you will find several options to split cells and entire columns in Excel 2010 and
2013. Examples and screenshots illustrating the use of Text to Columns and Flash Fill features
as well as a handful of formulas to separate names, text and numerical values will help you
choose the best approach for splitting your data in Excel.
Generally, you may need to split cells in Excel in two cases. Firstly, when you import data from
some external database or a web-page and all of the entries get copied into one column while
you want them in separate columns. Another scenario is splitting data from an existing table for
better filtering, sorting or a detailed analysis.

Split cells using Text to Columns feature


How to split merged cells in Excel
Separate data with Flash Fill in Excel 2013
Formulas to split columns (names and other text data)
Splitting names in Excel
Split cells using Excel's Text to Columns feature
This Text to Columns option comes in really handy when you need to separate data in one
column to several columns in Excel 2013, 2010, 2007 or 2003.
The Text to Columns function allows splitting cells' values separated with delimiters as well as
fixed width data type (when all values contain a certain number of characters). Let's see how
each scenario works:

How to split delimited text to columns


How to separate text data of fixed width
Split delimited text data to columns in Excel
Suppose, you have a list participants invited to a conference or some other event. As you can
see in the screenshot below, the first column A lists the participants' names, country and
expected arrival date:

What we want is to split this text into individual columns so that our table has the following
columns from left to right: First Name, Last Name, Country, Arrival Date and Status.
1. If your table has one or more columns next to the column you want to split, you start
bycreating new empty columns into which you want to divide cells. This step is needed in
order for your existing data won't get overwritten.
In our example, we have the Status column right after the Participants column and we want to
add new columns such as Last Name, Country and Arrival Date before the Status column.
If someone has forgotten, I'll remind you a quick way to insert multiple columns in Excel.
Select one column by clicking its header and drag to the right or left to select the number of
columns you want to insert. Then right click on the selected columns and choose Inset from the
context menu.

The result will be similar to what you see in the screenshot below (new columns added to the
left of the selected ones):

Note: If you don't have any adjacent columns next to the column you want to separate, this step
is not actually needed and you can skip it.

2. Select the column you want to split, navigate go to Data Tools tab and click the Text to
Columns button.

3. The Convert Text to Columns wizard opens and in the first step of the wizard, you choose the
type of data. Since our entries are delimited with spaces and commas, we
choose Delimited type (Fixed width type is explained a bit later). When done, click Next to
continue.

4. On the next step you specify the delimiters your data contain and the text qualifier.
Setting the delimiters. If your data is separated with one or more delimiters, you select all
appropriate options available under the Delimiters section or enter your own delimiter in
the Otherbox.
In our example, we set Space and Comma as the delimiters and check the "Treat consecutive
delimiters as one" option. This option would help to prevent excess parsing of data, e.g. if there

are 2 or more successive spaces between words.

Specifying the text qualifier. You may need this option if the column you want to split contains
some values enclosed in quotation marks or apostrophes and you'd rather not split such
portions of text and treat them as a single value. For example, if you choose a comma as the
delimiter and a quotation mark (") as your text qualifier, then any words enclosed in "",
e.g. "California, USA", will be put into one cell as California, USA. If you select {none} as the text
qualifier, then "California will be imported into one column and USA" into another.
Near the bottom of the dialog window, you can see the Data preview section. Before you
clickNext, it stands to reason to quickly scroll down to make sure Excel has properly converted
all of your text data to columns.
5. Just two more things are left for you to do - choose the data format and select the destination
for split cells.
You can choose the data format for each of the columns into which the data is separated. By
default, the General format is set for all columns. We leave it as is for the first 3 columns and
switch to the Data format for the 4th column, which seems quite logical because it lists the arrival
dates :)
To change the data format for a particular column, click on the column in the Data
preview section to highlight it and then set the wanted format under the "Column data format"

section.

In the same step of the wizard, you can choose the destination column for the separated data.
To do this, click the range selection icon
(in Microsoft terms, it's called Collapse Dialog icon)
to the right of the Destination box and select the far left-hand column where you want the split
cells to appear. Regrettably, you are not able to import the separated columns to another
spreadsheet or workbook, you would get the invalid destination error if you try to do this.
Tip: If you do not want to import some column(s) you see in the data preview, select it and
check Do not import column (skip) radio button.
6. Click Finish and you are done!

Separate text of fixed width into several columns


If your data consists of text or numeric values with a certain number of characters, you can
divide such cells into several columns in the following way.
For example, we have a table listing the Product IDs and Product names, each product ID
consisting of 9 characters comes first, before the product name.

Here's what you do to split such a column into two columns in Excel.
1. Start the Convert Text to Columns wizard as explained in the above example. In the first step
of the wizard, choose Fixed width and click Next.

2. Set the columns' widths using the data preview section. As you see in the screenshot below,
a vertical line represents a column break and to create a new break line, you simply click at the
needed position. Double-clicking a break line removes the break, and if you want to have a
break in some other position, click the line and drag it with the mouse. In fact, you can see the
same instructions in the upper part of the dialog window :)

Since our product IDs contain 9 characters each, I've set the break line exactly at this point, as
shown in the image above.
3. In the next step, choose the data format and destination for the split cells as explained in
theprevious example, and then click the Finish button to complete the process.
Splitting merged cells in Excel
If you've merged some cells in your Excel sheet and now you want to have them in separate
columns again, go to the Home tab > Alignment group, click a little black arrow next to

the Merge & Center button and choose Unmerge Cells from the drop-down list.

This will unmerge cells, but won't work a treat since all of your values will remain in the left-hand
column. Alas, you'd need to use the Text to Columns feature again to split data from one column
into two or more columns.
Separate data in one column to several columns with Excel 2013 Flash Fill
If you have already upgraded to Excel 2013, you can benefit from the new Flash Fill feature
and have Excel to automatically fill (in our case - split) your data when it detects a pattern.
If you are not familiar with this feature, I'll try to briefly explain the concept. This tool analyzes
the data you are entering in a worksheet and tries to figure out where you take the data from
and how exactly you want it to appear in a new column. Once Flash Fill recognizes what you're
doing and detects a pattern in your initial data, it will make suggestions and a series of entries
will appear across the new column, literally in a flash. Thus, you can use this tool to take some
part of the data residing in one or several columns and enter only that data in a new column. I
think you'll better understand what I'm talking about from the example that comes below.

First off, make sure the Flash Fill option in enabled. You can find it on the File tab > Options >
Advanced > Automatically Flash Fill.

Well, now let's see how you can have parts of cell values automatically copied to other cells.
Once you've turned the Flash Fill feature on, start typing the parts of the data you want to have
in other cells. As you type, Excel will try to detect a pattern in the new values you are entering
and as soon as it senses the pattern, it will populate similar data into other cells automatically.
To get a feel how it works, have a look at the screenshot below:

As you can see, I've typed just a couple of names in column B, and Excel's Flash Fill pulled the
other names from column A. If you are happy with what you see, simply press Enter and you will
have the entire column populated with text parts (or numeric values). This is a really smart
feature, isn't it?
If Flash Fill is turned on in your Excel but it doesn't make any suggestions when you are typing
data that matches a certain pattern, you can start it manually by clicking Data > Flash Fill, or
press Ctrl+E.

How to split cells in Excel using formulas


There exists an array of formulas that may prove really useful when it comes to splitting cells or
columns of data in Excel. In fact, the following five functions will suffice in most cases - LEFT,
MID, RIGHT, FIND (or SEARCH) and LEN. Further on in this section I'll briefly explain what
each of the functions is purposed for and provide examples that you can copy to your
worksheets.
The most typical scenario when you may need these formulas is to separate names in one
column to several columns. The screenshot below illustrates what we are trying to achieve:

And you can easily split such "simple" names to 2 columns using the following formulas:
A

Full name

First name

Last name

FirstName LastName

=LEFT(A2,
SEARCH(" ",A2,1))

=RIGHT(A2,LEN(A2)SEARCH(" ",A2,1))

Resul
t:

Ronnie Anderson

Ronnie

Anderson

Feel free to copy these formulas and paste them across the entire columns in your Excel sheet,
just remember to replace A2 with the address of your first cell with data.
For those who are interested to know what the formulas actually mean, I'll try to explain in more
detail:

SEARCH or FIND function. These are absolutely identical functions that look for a text
value in a specified cell.
Formula Syntax: =SEARCH(find_text,within_text,start_num) means (what you are
looking for, where you want to search, character position to start).
In our example, SEARCH(" ",A2,1) says that we want to find a space " " in cell A2 and the
search starts from the 1st character.

Note: If your search starts from the first character, you may actually omit start_num in a formula
and simplify it to =LEFT(A2, SEARCH(" ",A2)).
LEFT and RIGHT functions - pull the left or right part of the text in the specified cell,
respectively.
Formula Syntax: =LEFT(text, num_chars) means (what text to take, number of characters
to extract).
In our example, =LEFT(A2, SEARCH(" ",A2,1)) pulls the left part of the text from cell A2 until the
first found space.

LEN function - counts the length of a string, i.e. the number of characters in the specified
cell.
Formula Syntax: =LEN(text).
In our example, LEN(A2) counts the number of characters in A2.
If the names in your table contain Middle names or suffixes, you will need a bit more complex
formulas that include the MID function.
Here are the formulas to use when the names to be split include either a middle name or one
middle initial.

Full name

First name

Middle
name

Last name

FirstName
MiddleName
LastName

=LEFT(A2,
FIND(" ",A2,1))

=MID(A2,
FIND("
",A2,1)+1,
FIND(" ",A2,
FIND("
",A2,1)+1)FIND("
",A2,1))

=RIGHT(A2,LEN(A2)FIND(" ",A2, FIND("


",A2,1)+1))

Resul
t:

Sally K. Brooke

Sally

K.

Brooke

MID function - extracts a substring (i.e. a specified number of characters) from a text
string.Formula Syntax: = MID(Text, Start_num, Num_chars) means (the piece of data
you want to take, starting character, the number of characters to extract).
You can use a similar MID formula to split names with suffixes:
A

Full name

First name

Last name

Suffix

FirstName LastName
Suffix

=LEFT(A2,
FIND(" ",A2,1))

=MID(A2,
FIND("
",A2,1)+1,
FIND(" ",A2,
FIND("
",A2,1)+1)( FIND("
",A2,1)+1))

=RIGHT(A2,LEN(A2)FIND(" ",A2, FIND("


",A2,1)+1))

Resul
t:

Robert Furlan Jr.

Robert

Furlan

Jr.

And here come the formulas to split last names that come first with comma, and the middle
names appear at the end:
A

Full name

First name

Middle name

Last Name

LastName,
FirstName
MiddleName

=MID(A2,SEARC
H(" ",A2,1)+1,
FIND(" ",A2,
FIND("
",A2,1)+1)FIND(" ",A2,1))

=RIGHT(A2,LEN(
A2)- FIND(" ",A2,
FIND("
",A2,1)+1))

=LEFT(A2, FIND("
",A2,1)-2)

Resul

White, David Mark

David

Mark

White

t:
As you understand, these formulas work not only for separating names in Excel. You can use
them to split any other data from one column into several columns. For example, you use the
following formulas to split text data separated with commas.
A

State,
Abbr.,
Capital

State

Abbr.

Capital

FirstWord,
SecondWor
d,
ThirdWord

=LEFT(A2,
SEARCH(",",
A2)-1)

=MID(A2, SEARCH(",",A2) +
2,
SEARCH(",",A2,SEARCH(",",
A2)+2) - SEARCH(",",A2) 2)

=RIGHT(A2,LEN(
A2) SEARCH(",", A2,
SEARCH(",", A2)
+ 1))

Re
s.

Alabama,
AL,
Montgome
ry

Alabama

AL

Montgomery

And here you can see the real example in Excel 2010, the data from the first column is split into
three columns.

How to split names in Excel


How that you've read this heading, I can nearly see a smirk on your face :) "What have we been
doing in the last few minutes if not splitting names in Excel?!" you can ask me.

Of course, all of the above mentioned formulas will help you separate the names from one
column into several columns... provided that you have a homogeneous set of data. I mean the
formulas will work fine when all names are of the same pattern, e.g. the first name and the last
name; or the first name, middle name and last name etc. But in real tables, you may often have
names in different formats and in this case the formulas will only mess up your worksheet like
this:

If you want to separate such names into several columns, you'd better go with Excel's Text to
Columns feature. And yet even a better alternative is to use the Split Names add-in. This tool is
specially designed for splitting names in Excel 2013, 2010, 2007 and 2003 and it perfectly
recognizes multi-part names, over 80 salutations and about 30 different suffixes.
I've added a few salutations and suffixes to my original data, as you'll notice in the screenshot
below, and now let's see how the Split Names add-in will cope with it:
1. Select the cells with names you want to separate and click the Split Names icon on the Excel
Ribbon > Ablebits Data group. In fact, you can select the entire column for the sake of time and
the add-in will pick cells with data only.

2. Choose the parts into which you want to divide names in your Excel spreadsheet. The
following options are available to you: First name, Middle name, Last name, Salutation /
Title, and Name suffix / post-nominal letters.

3. Click Split and you are done! The new columns with separated names will be inserted to the
right of your original column.

No formulas, no fiddling with delimiters or line breaks, no pain at all. Just a couple of clicks is all
it takes.
Wrapping up, if splitting names in Excel is not a one-time task for you and you need to perform
this operation on a regular basis, you can go ahead and download a trial of the Split Names
add-in. This tool works with all versions of Microsoft Excel 2013, 2010, 2007 and 2003. And if
you find that the Split Names add-in is well suited for your needs, grab this coupon code AB14BlogSpothat we provide especially for our blog readers and get your license with 15% discount.
Alternatively, you can use this direct order link: get Split Names for Excel with 15% off.
Thank you for taking time for reading!

How to print row and column headers of Excel spreadsheets on every page
Today I'd like to tell you about a small but important feature tucked away in Excel 2013 and its
previous versions. In this article you'll learn how to make header rows and column headers print
on each page.
If you often have to print large and complex Excel worksheets, I am sure that you face this
problem as often as I do. I can easily scroll up and down through the document without losing
sight of the column titles because I have the header row frozen. However, when I print the
document, the top row is printed only on the first page. If you are sick and tired of turning the
printouts back and forth to see what kind of data is in each column or row, feel free to find out
the solution to the issue in this article.

Repeat Excel header rows on every page


Get a header column on every printout
Print row numbers and column letters
Repeat Excel header rows on every page
Your Excel document turns out to be long and you need to print it. You go to the print preview
and find out that only the first page has the column titles at the top. Take it easy! You can specify
the Page Setup settings to repeat the top row on every printed page.
1. Open the worksheet that you're going to print.
2. Switch to the PAGE LAYOUT tab.
3. Click on Print Titles in the Page Setup group.

4. Make sure that you're on the Sheet tab of the Page Setup dialog box.
5. Find Rows to repeat at top in the Print titles section.

6. Click the Collapse Dialog icon

next to "Rows to repeat at top" field.

The Page Setup dialog window is minimized and you get back to the worksheet.
You can notice that the cursor changes to the black arrow. It helps to choose an entire row with
one click.

7. Select a row or several rows that you want to print on every page.

Note: To select several rows, click on the first row, press and hold the mouse button and drag to
the last row you want to select.
8. Click Enter or the Collapse Dialog button again to return to the Page Setup dialog box.

Now your selection displays in the Rows to repeat at top field.

Note: You can skip steps 6-8 and enter the range using the keyboard. However, pay attention to
the way you enter it you need to use the absolute reference (with the dollar sign $). For
example, if you want to see the first row on every printed page, the reference should look like
this: $1:$1.
9. Click on Print Preview to see the result.

There you go! Now you know exactly what the columns mean on every page.
Get a header column on every printout
When your worksheet is too wide, you'll have the header column on the left only on the first
printed page. If you want to make your document more readable, follow the steps below to print
the column with row titles on the left side of every page.
1. Open the worksheet that you want to print.
2. Go through steps 2-4 as described in Repeat Excel header rows on every page.
3. Click the Collapse Dialog button to the right of the Columns to repeat at left box.

4. Pick a column or columns that you want to see on every printed page.

5. Click Enter or the Collapse Dialog button again to check if the selected range is displayed in
the Columns to repeat at left field.
6. Press the Print Preview button in the Page Setup dialog box to look at your document
before printing.

Now you don't have to turn the pages back and forth to find what the values in each row mean.
Print row numbers and column letters
Excel normally refers to worksheet columns as letters (A, B, C) and to rows as numbers (1, 2,
3). These letters and numbers are called row and column headings. As opposed to row and
column titles that are printed only on the first page by default, the headings are not printed at all.
If you want to see these letters and numbers on your printouts, do the following:
1. Open the worksheet that you want to print with the row and column headings.
2. Go to the Sheet Options group on the PAGE LAYOUT tab.
3. Check the Print box under Headings.

Note: In case you still have the Page Setup window opened on the Sheet tab, just check
theRow and column headings box in the Print section. It also makes the row and column
headings visible on every printed page.

4. Open the Print Preview pane (FILE -> Print or Ctrl+F2) to check the changes.

Does it look as you desired now? :)


The Print Titles command can really simplify your life. Having header rows and columns printed
on every page allows you to understand the information in the document more easily. You won't
lose your way in the printouts if there are row and column titles on each page. Try it out and you
can only benefit from it!

How to merge rows in Excel 2010 and 2013 without losing data
This tutorial provides solutions for 4 different scenarios of merging rows in Excel. See how you
can quickly merge multiple rows without losing data; combine duplicate rows, repeatedly merge
blocks of rows and consolidate matching rows from two different spreadsheets.
Merging rows in Excel is one of the most common tasks that all of us need to perform every now
and then. The problem is that Microsoft Excel does not provide any decent tool to do this. For
example, if you try to combine two or more rows in your worksheet using the Merge &
Centerbutton (Home tab > Alignment group), all you'll get is the following error message:
"The selection contains multiple data values. Merging into one cell will keep the upper-left most
data only."

If you click OK, the merged cells will contain only the value of the top-left cell, all other data will
be gone. So, obviously we need to come up with some other solution. And further on this this
article you will find several methods that will let you merge multiple rows in Excel without losing
any data.

How to merge rows in Excel 2010 and 2013


How to combine duplicate rows (with unique data only)
How to repeatedly merge blocks of rows in Excel
How to combine matching rows from 2 spreadsheets
How to merge rows in Excel without losing data
The task: you have a customer database where each row contains certain details such as the
product name, product key, customer name and so on. What we want is to combine all the rows
related to a particular order, so that the result would look similar to this:

When it comes to merging Excel rows, there are two ways to achieve the desired result:

Merge Excel rows using a formula


Combine multiple rows using the Merge Cells add-in
How to merge multiple rows using Excel formulas
Microsoft Excel provides several formulas that can help you combine data from different rows.
Probably the easiest one to remember is the CONCATENATE formula. Here are a few
examples to concatenate several rows into one:

",A3)

Merge rows and separate the values with comma: =CONCATENATE(A1,", ",A2,",
Merge rows with spaces between the data: =CONCATENATE(A1," ",A2," ",A3)
Combine rows without spaces between the values: =CONCATENATE(A1,A2,A3)

I believe you have already deduced the general rule to write such a formula - simply enter all
cells to be merged separated with commas, and then type the separator in between, e.g. ", " is a
comma with a space; " " is only a space.
So, let's see how the CONCATENATE formula will work on the real data.

1. Select an empty cell on the sheet and enter the formula into it. We have 9 rows of data, so
the formula is going to be pretty large: =CONCATENATE(A1,", ",A2,", ",A3,", ",A4,", ",A5,",
",A6,", ",A7,", ",A8)
2. Copy the formula across all other cells in the row, the result should look similar to this:

3. Now you have several rows of data merged into one row. But your combined rows are, in fact,
formulas and if you want to convert them to values, you can simply copy / paste the merged
rows to some other row in your spreadsheet. The following tutorial explains how to do this in
detail:How to replace formulas with their values in Excel.
How to combine rows in Excel using the Merge Cells add-in
The Merge Cells add-in is purposed for combining various types of cells in Excel. It merges
individual cells as well as combines data from entire rows or columns. This is how the Merge
Cells button looks like on the Excel Ribbon:

To merge two or more rows in your table, proceed with the following 4 steps:
1. Select the rows you want to merge and click on the Merge Cells icon.
2. The Merge Cells dialog window will open with your table or range already selected, as you
can see in the screenshot below. In the upper part of the window, you specify three basic things:

How you want to join cells. To merge rows of data, select "column by column".
How to separate the merged values. There is an array of standard separators to choose
from: comma, space, semicolon and even line break! If you want to use some other separator,
merely type it directly in this field.

Where to place the merged cells. This can be either the top cell or bottom cell.

3. Now let's have a quick look at the lower part of the window to see if you need any aditional
options:

Clear the content of selected cells. Select it if you want the data to remain in the merged
cells only.
Merge all areas in the selection. This option will let you merge rows in two or more nonadjacent ranges.
Skip empty cells and Wrap text. These two are self-explanatory, aren't they?
And finally, you see the "Create a backup copy of the worksheet" option, checked by
default. This is just a precaution that will keep you on the safe side and ensure that you won't
lose your data in any case.

4. Now let us click the Merge button and see what we get as a result - perfectly merged rows of
data separated with line breaks!

You can download a fully-functional trial version of Merge Cells addin now, try it on your own
data and see if it's the right tool for you. The add-in works with all versions of Excel 2013, 2010,
2007and 2003.
How to combine duplicate rows into one (keeping unique values only)
The task: you have some Excel database with a few thousand entries. A bunch of values in one
of the columns are essentially the same while data in other columns are different. What you'd
like to have is combine data from duplicate rows based on a certain column, making it a comma
separated list. Additionally, you may want to merge unique values only, omitting duplicates and
skipping empty cells.

The screenshot below illustrates what we are trying to achieve.

Finding and merging duplicate rows in Excel may be a real nightmare and obviously everyone
would like to avoid doing this work manually. In this case, another add-in, Combine Rows
Wizard, may come in truly handy.

As I've said, combining duplicate rows in Excel seems to be a pretty tricky task, but the
Combine Rows Wizard will walk you through the process making it really simple. And again,
you'll need just 4 quick steps:
1. Select the duplicate rows you want to merge and click the Combine Rows Wizard icon on
the ribbon. Make sure the "Create a backup copy" option is checked, especially if you are using

this add-in for the first time.

2. Select the key column. In our example, we're selecting the "Customer" column (A) because
we want to combine rows based on customer name. If you want to skip empty cells, be sure to

select this option in the upper-right corner and click Next.

3. Choose the columns to merge. On this step you select the columns whose data that you
want to combine and specify the delimiter: semicolon, comma, space, line break or any other
character(s) of your choosing. Two additional options in the upper part of the window let you:

Delete duplicate values while combining the rows, and


Skip empty cells.

4. Click the Finish button and you'll see the result in a moment.

That was pretty easy, isn't it? To make sure of this, go ahead and download the trial version of
Combine Rows add-in. You can use it with any version of Excel 2013, 2010, 2007 and 2003.

Repeatedly merge blocks of rows into one row


The task: you have an Excel file with information about the recent orders and each order takes
3 lines: product name, customer name and date of purchase. What you need is to merge every
three rows into one, i.e. repeatedly merge the blocks of three rows in an Excel sheet.
This is what we are looking for:

If you have a fairly few entries to be combined, you can select each 3 rows and merge each
block individually using the Merge Cells Wizard as we discussed in How to merge Excel rows
without losing data. But if you have hundreds and thousands of records in your database, this is
definitely not a very elegant solution. There is a quicker way to achieve the needed result:
1. Create an additional column in your worksheet; it is column C in our example. Let's name
itBlock Id, or maybe you can come up with a more meaningful name : )
2. Write the following formula to the 2nd cell of that column (C2) because most likely your table
has headers: =INT((ROW(C2)-2)/3). And then copy it across the entire column.

Now, what does this formula actually do? It adds a unique number to each block of rows to be
merged, as shown in the screenshot:

In more detail, the INT function in Excel is used to round a number downwards to the next
lowest integer. (C2)-2 deducts the row number where your data start, for the formula to start
counting from zero. For example, our data start from the 2nd row, so we deduct 2. If your data
(actual data, not table headers) start, say, from row 5 and you enter the formula in cell D5, then
you put (D5)-5. And finally, we divide by the number of rows to be merged in each block (since
we are combining the blocks of three rows, we add /3 at the end of the formula). Phew, I do
hope my explanation makes sense. If not, don't hesitate to ask in comments and I'll try to come
up with something easier to comprehend : )
3. Well, the previous step actually did the main part of the work. Now you just need to merge the
rows based on column Block Id using the Combine Rows Wizard, exactly in the same way as

we did in the previous example when combining duplicate rows.

And here's what we have as the result:

4. Delete the Block ID column since you don't need it any longer and you are done! Funny
enough, that we've needed 4 steps again, like in two previous examples : )
Merge matching rows from 2 Excel worksheets without copying / pasting
Task: you need to merge rows from 2 tables based on a common column. The tables may be
located in the same sheet, in two different spreadsheets or even in two different workbooks. For
example, you have sales reports for January and February in two different worksheets and you

want to combine them into one.

Mind you, each workbook may have a different number of records and different order of
products name, so you cannot simply copy and paste the "Feb Sales" column to the first
workbook because the products won't match.
Another add-in from AbleBits will work a treat in this case - Merge Tables Wizard. This tool will
find, match and merge rows from two Excel worksheets in seconds, no matter how many rows
each spreadsheet contains. The design of the wizard is pretty much similar to the Combine
Rows Wizard we've used in two previous examples, so it should already look familiar to you : )
Okay, to combine matching rows from 2 spreadsheets, do as follows:

1. Select the 1st table, this is the main table that you want to update, and click the Merge
Tables button on the Ribbon (Ablebits Data > Merge).

This will open the Merge Tables Wizard's dialog with your first table already selected, so simply
click Next.

2. Select the second worksheet, i.e. a lookup table where you want to search for matching rows.

3. Choose the column with unique values that exists in both tables, it will be used as a unique
identifier. It our example, it can be either Product Name or Product ID, or both.

You can also click the Auto Detect button at the bottom left-hand corner and the wizard will find
the key column(s) automatically.
4. Choose which column(s) you want to update and which add to the end of the 1st table. Since
we want to add only the "Feb sales" column, let's select it and click Next.

5. On the next step, the Merge Tables Wizard provides a few additional options, such as:

Add non-matching rows to the end of the table


Update only empty cells in the main table
Highlight updated rows in a color of your choosing

Actually, there are some more options, as you can see in the screenshot below:

If you don't need any of these options for now, you can skip this step and click the Finish button.
However, if your second worksheet may contain some rows that do not exist in the first
spreadsheet and you do want to add them, select Add non-matching rows to the end of the
table.

Now click Finish, wait for a couple of seconds and as the result you have all matching rows from
two Excel worksheets merged into a single table:

If you are interested to try the Merge Tables Wizard, go ahead and download a trial
version here. As well as the two previous tools, it support Microsoft Excel 2013 - 2003.
How do I get these merging tools for Excel?
First off, you can download 15-day fully-functional trial versions to make sure the add-ins really
suite your needs, here is the download page.
If you like any of the merging tools described in this article, you have several options to get
them:
1. Buy any of the add-ins as a separate product using the order page.
2. Get 3 merging tools in a bundle and safe over 25% off their individual prices. In other
words, you pay only for 2 add-ins and get a 3rd one for free! The bundle includes Merge
Cells, Combine Rows Wizard and Merge Table Wizard, and here's the order form.
3. Have these 3 merging tools + 20 more add-ins as part of Ultimate Suite for Excel.

Note: This is a really important note, don't disregard it : ) Before you proceed to the order page,
be sure to copy the coupon code that we provide especially for our blog readers: AB14BlogSpo. It will give you an additional 15% discount on any Ablebits product.
Hopefully, now you can merge rows in your Excel sheets exactly as you want them. If you are
looking for something different and have not found the solution in this article, just leave a
comment and we will try to figure out a way together. Thank you for reading!

How to swap columns in Excel by drag-n-drop and other ways to move columns
In this article you will learn a few methods to swap columns in Excel tables. You will see how to
drag columns with a mouse and how to move a few non-contiguous columns at a time. The
latter is often considered unfeasible, but in fact there's a tool that allows moving several nonadjacent columns in Excel 2013, 2010 and lower.
If you extensively use Excel tables in your daily work, you know that whatever logical and well
thought-out a table's structure is, you have to reorder the columns every now and then. For
example, you might need to swap a couple of columns to view their data side-by-side. Of
course, you can try to hide the neighboring columns for a while, however this is not always the
best approach because you may need to see data in those columns as well.
Surprisingly, Microsoft Excel does not provide any straightforward way to perform this common
operation. If you try to simply drag a column name, which appears to be the most obvious way
to move columns, you might be confused to find that it does not work, even in Excel 2013.
All in all, there are four possible ways to switch columns in Excel, namely:

Swap columns in Excel by drag-n-drop


Move columns by copy / paste
Reorder columns using a macro
Re-arrange columns using Quick Tools
How to drag columns in Excel
As I mentioned in the beginning of this article, dragging columns in Excel is a bit more complex
procedure than one could expect. In fact, it's one of those cases that can be classified as
"easier said than done". But maybe it's just my lack of sleight of hand ability : ) Nevertheless,
with some practice, I was able to get it to work, so you will definitely manage it too.
Suppose, you have a worksheet with information about your company's products and you want
to quickly swap a couple of columns there. I will use the AbleBits price list for this example.
What I want is to switch the "License type" and "Product ID" columns so that a product ID
comes right after the product name.

1. Select the column you want to move.


2. Move the mouse pointer to the edge of the selection until it changes from a regular cross to a
4-sided arrow cursor . You'd better not do this anywhere around the column heading because
the cursor can have too many different shapes in that area, which may be very confusing. But it
works just fine on the right or left edge of the selected column, as shown in the screenshot.

3. Press and hold down the Shift key, and then drag the column to a new location. You will see
a faint "I" bar along the entire length of the column and a box indicating where the new column
will be moved.

4. That's it! Release the mouse button, then leave the SHIFT key and find the column moved to
a new position.
You can use the same technique to drag several columns in your Excel table. To select
several columns, click the heading of the first column you need to move, press and hold Shift,
and then click the heading of the last column. Then follow steps 2 4 described above to move
the columns, as shown in the screenshot.

Note: It is not possible to drag non-adjacent columns and rows in Excel sheets, even in Excel
2013.

The drag and drop method works in Microsoft Excel 2013, 2010 and 2007 and can be used for
moving the table's rows as well. It might require some practice, but once mastered it could be a
real time saver. Though, I guess the Microsoft Excel team will hardly ever win an award for the
most user friendly interface on this feature : )
Swap Excel columns by cut /paste
If manipulating the mouse pointer is not your technique of choice, then you can change the
columns order by copying and pasting them. Please keep in mind that there're a few
specificities here depending on whether you want to move a single column or several columns
at a time:

Moving one column


Switching several columns
How to move one column in an Excel table
1. Select the entire column by clicking on the column header.
2. Cut the selected column by pressing Ctlr+X, or right click the column and choose Cut from
the context menu. You can actually skip step 1 and simply right click the column's heading to
chooseCut.
3. Select the column before which you want to insert the cut column, right click it and
chooseInsert Cut Cells from the pop-up menu.

If you are more comfortable with Excel shortcuts and keyboard, then you may like the following
way better:

Select any cell in the column and press CTRL+SPACE to select the whole column.

Hit Ctrl+X to cut the column.


Select the column before which you what to paste the cut column.
Press Ctrl together with the Plus sign (+) on the numeric keypad to insert the column.
How to move several columns in Excel
The cut / paste method that works just fine for a single column does not allow switching several
columns at a time. If you try to do this, you will end up with the follows error asking you to select
a single range: The command you chose cannot be performed with multiple selections.
If you need to reorder a few columns in your worksheet, then you have the following options to
choose from:

Drag several columns using the mouse (in my opinion, this is the fastest way)
Cut and paste each column individually (probably not the best approach if you have to
move a lot of columns)
Copy, paste and delete (allows moving several adjacent columns at a time)
Swap multiple columns by copying, pasting and deleting
If dragging columns with a mouse does not work for you for some reason, then you can try to rearrange several columns in an Excel table is this way:
1. Select the columns you want to switch (click the first column's heading, press Shift and then
click the last column heading).
An alternative way is to select only the headings of the columns to be moved and then press
Ctr+Space. This way will select only cells with data rather than entire columns, as shown in the
screenshot below.

Note:. If you are re-arranging columns in a range, either way will do. If you need to swap a few
columns in a fully-functional Excel table, then select the columns using the second way (cells

with data only), otherwise you may get the error "The operation is not allowed. The operation is
attempting to shift cells in a table of your worksheet".
2. Copy selected columns by pressing Ctrl+C or right click the columns and choose Copy.
3. Select the column before which you want to insert the copied columns and either right click it
and choose Insert copies cells, or simultaneously press Ctrl and the plus sign (+) on the
numeric keypad.

4. Delete the original columns.


Of course, this is a bit longer process compared to dragging columns, but it may work for those
who prefer shortcuts to fiddling with the mouse. Regrettably, it does not work for non-contingent
columns either.
Change the columns order in Excel using a VBA macro
If you have some knowledge of VBA, you can try to write a macro that would automate moving
columns in your Excel sheets. This is in theory. In practice, most likely you would end up
spending more time on specifying which exactly columns to swap and defining their new
placements than dragging the columns manually. Besides, there is no guarantee that the macro
will always work as expected and each time you would need to verify the result anyways. All in
all, a VBA macro does not seem to be a tool well-suited for this task.
Arrange columns using Quick Tools for Excel
If you want a fast and reliable tool to switch columns in your Excel sheets, then Quick Tools for
Excel from AbleBits is definitely worth your attention. Quick Tools for Excel is a set of 10 oneclick utilities, each purposed to automate one frequent operation that is a bit too cumbersome to
perform using the standard Excel means.

Among other utilities, the Quick Tools include Column Manager that lets you change the order
of columns on the fly, without manual copying / pasting or learning a handful of shortcuts. This is
how the Column Manager would look like on your Excel ribbon:

Clicking the Column Manager's icon opens a special pane that displays a list of columns in your
worksheet, like this:

And now you can easily move a single column or swap several columns in your table either
bydragging the columns' names on the pane or by using the up and down arrow buttons on

the toolbar. You select multiple columns in the usual way by pressing the Shift or Ctrl key, for
adjacent and non-adjacent columns respectively. As you can see in the screenshot, even noncontiguouscolumns can be moved in one fell swoop!

When working with the Column Manager, a really nice thing is that all your manipulations are
simultaneously performed on your worksheet. For example, when you select a few columns on
the pane, they automatically get selected in the sheet, which lets you visually see all the
changes and have full control over the process.

Another, a truly wonderful feature, is the ability to move a column or several columns to the end
or to the beginning of the table in a button click.

And finally, as a nice bonus, comes the ability to auto fit the width of selected columns.

I have to admit, that I really love this little smart add-in. Together with the other 9 quick tools
included in the package, it makes common operations in Excel not only faster and easier, but
actually enjoyable. Of course, you should not take my words for granted because I've got used
to them and therefore am sort of biased : )
So, go ahead and download a 15-day trial of Quick tools to see for yourself. The add-ins work
with all versions of Excel 2013, 2010, 2007 and 2003. If you like the tools, please do come back
and request a special 15% off coupon code that we provide especially for our blog readers.
And thank you for reading!

How to view, change and remove document properties in Excel 2010 and 2013
The time has come to tell you about different types of document properties, the ways of viewing
and changing them in Excel 2010 and 2013. In this article you'll also learn how to protect your
document from any modifications and remove personal information from your Excel worksheet.
Do you remember your feelings when you just started to use Excel 2010 or 2013? Personally I
sometimes felt angry when I couldn't find the necessary tool or option at the place where they
were in the previous Excel versions. This is what happened to the document properties in Excel
2010 / 2013. In these last two versions they are hidden deeper, but it won't take you much time
to dig them out.
In this article you will find a detailed guide how to view and change the document properties,
protect your document from any modifications and remove personal information from your Excel
worksheet. Let's get it started! :)

o
o
o
o

Types of document properties


View document properties
Modify document properties
The quickest way to add an author
Change the default author name
Define custom properties
Change other document properties
Remove document properties
Protect document properties
Types of document properties
Before starting to learn how to view, change and remove document properties (metadata) in
Excel 2010 and 2013, let's clear up what kinds of properties an Office document can have.
Type 1. Standard properties are common to all Office 2010 applications. They contain basic
information about the document such as title, subject, author, category, etc. You can assign your
own text values for these properties to make it easier to find the document on your PC.
Type 2. Automatically updated properties include the data about your file that are controlled
and changed by the system such as the file size and the time the document was created and
modified. Some properties that are unique to the document at the application level such as the
number of pages, words or characters in the document or the version of the application are
automatically updated by the document content.
Type 3. Custom properties are user-defined properties. They allow you to add other properties
to your Office document.
Type 4. Properties for your organization are properties specific to the organization.
Type 5. Document library properties refer to documents in a document library on a Web site
or in a public folder. A person who creates a document library can set some document library
properties and rules for their values. So when you want to add a file to the document library, you

have to enter the values for any properties that are required, or correct any properties that are
wrong.
View document properties
If you don't know where to find the information about your document in Excel 2010 / 2013, here
are three ways to do it.
Method 1. Show the Document Panel
This method allows you to see the information about your document right in the worksheet.
1. Click on the File tab. You switch to the backstage view.
2. Choose Info from the File menu. The Properties pane is shown on the right-hand side.
Here you can already see some information about your document.

3. Click on Properties to open the drop-down menu.

4. Choose 'Show Document Panel' frm the menu.

It'll automatically take you back to your worksheet and you'll see the Document Panel placed
between the Ribbon and the working area as on the screenshot below.

As you see, the Document Panel shows a limited number of properties. If you're eager to know
more about the document, move to the second method.
Method 2. Open the Properties dialog box
If you can't find the necessary information in the Document Panel, take the Advanced
Properties into use.
The first way to display the Advanced Properties is right from the Document Panel.
1. Click on 'Document Properties' in the top-left corner of the Document Panel.

2. Choose the Advanced Properties option from the drop-down list.

3. The Properties dialog box will show up on the screen.

Here you can see general information about your document, some statistics and document
contents. You can also change the document summary or define additional custom properties.
Do you want to know how to do it? Be patient! I'll share it with you a bit later in this article.
There is one more way to open the Properties dialog box.
1. Go through the first three steps that are described in Method 1.

2. Choose 'Advanced Properties' from the Properties drop-down menu.

The same Properties dialog box will appear on the screen as on the screenshot above.
Method 3. Use Windows Explorer
One more easy way of displaying the metadata is to use Windows Explorer without opening the
worksheet itself.
1. Open the folder with Excel files in Windows Explorer.
2. Select the file you need.

3. Right-click and choose the Properties option in the context menu.

4. Move to the Details tab to view the title, subject, author of the document and other
comments.

Now you know different ways of viewing the document properties on your PC and I am sure
you'll find the necessary information without any problems.
Modify document properties
Earlier I promised to tell you how to change the document properties. So when you view
properties using Method 1 and Method 2 described above, you can immediately add the
necessary information or correct invalid data. As for Method 3, it's also possible if you don't have
Windows 8 installed on your computer.
The quickest way to add an author
If you need just to add an author, there is a very quick way to do it right up in Excel 2010 / 2013
backstage view.
1. Go to File -> Info

2. Move to the Related People section on the right side of the window.
3. Hover the pointer over the words 'Add an author' and click on them.

4. Type in an author's name in the field that appears.

5. Click anywhere in the Excel window and the name will be automatically saved.

You can add as many authors as there are working on the document. This quick method can be
also used for changing the title or adding a tag or a category to the document.
Change the default author name
By default, the document author name in Excel is your Windows username, but this might not
properly represent you. In this case you should change the default author name so that Excel
will use your proper name later on.
1. Click on the File tab in Excel.

2. Choose Options from the File menu.

3. Select General on the left pane of the Excel Options dialog window.
4. Move down to the Personalize your copy of Microsoft Office section.
5. Type in the proper name in the field next to User name.
6. Click 'OK'.

Define custom properties


I've already mentioned that you can define additional properties for your Excel document.
Follow the steps below to make it real.
1. Navigate to File -> Info
2. Click on Properties on the right side of the window.
3. Select 'Advanced Properties' from the drop-down list.

4. Click on the Custom tab in the Properties dialog box that appears on your screen.

5. Choose a name for the custom property from the suggested list or type in a unique one in
theName field.
6. Select the data type for the property from the Type drop-down list.
7. Type in a value for the property in the Value field.

8. Press the Add button as shown below.

Note: The value format must meet your choice in the Type list. It means if the chosen data type
is Number, you have to type in a number in the Value field. Values that don't match the property
type are saved as text.

9. After you add a custom property you can see it in the Properties field. Then click 'OK'.

If you click on the custom property in the Properties field and then press Delete -> OK, your
just-added custom property will disappear.
Change other document properties
If you need to change other metadata, except the author's name, title, tags and categories, you
have to do it either in the Document Panel or in the Properties dialog box.

In case the Document Panel is open in your worksheet,you just need to set the cursor
in the field you want to edit and enter the necessary information.
If you've already opened the Properties dialog box, switch to the Summary tab and add
or update the information in the fields, click OK.
When you get back to the spreadsheet, any changes you made will be automatically saved.
Remove document properties
If you need to cover up your traces left in the document so that nobody will see your name or
your organization name in the document properties later, you can hide any property or personal
information from the public using one of the following methods.

Make the Document Inspector work


The Document Inspector is actually used for checking the document for hidden data or
personal information, but it can help you to remove the properties that you aren't going to share
with others.
1. Navigate to File -> Info.
2. Find the Prepare for Sharing section. In Excel 2013 this section is called Inspect
Workbook.
3. Click on Check for Issues.
4. Choose the Ispect Document option from the drop-down menu.

5. The Document Inspector window will pop up and you can tick the issues you want to look
at. I'd leave them all selected though we're most interested in checking 'Document Properties
and Personal Information'.

6. When you make your choice, click Ispect at the bottom of the window.

Now you see the inspection results on your screen.

7. Click on Remove All in each category you're interested in. In my case it's Document
Properties and Personal Information.

8. Close the Document Inspector.


Then I'd recommend you to save the file with a new name if you want to keep an original
version with the metadata.
Remove metadata from several documents
If you want to remove properties from several documents at once, use Windows Explorer.
1. Open the folder with Excel files in Windows Explorer.
2. Highlight the files you need.
3. Right-click and choose the Properties option in the context menu.
4. Switch to the Details tab.

5. Click on 'Remove Properties and Personal Information' at the bottom of the dialog window.

6. Select 'Remove the following properties from this file'.


7. Tick the properties you want to remove or click Select All if you want to remove all of them.
8. Click OK.

Note: You can remove any document property from the file or several files using this method,
even if you have Windows 8 installed on your computer.
Protect document properties
Protection of document properties and personal information is used in case you don't want other
people to change any metadata or anything in your document.
1. Go to File -> Info.
2. Click on Protect Workbook in the Permissions section.
3. In Excel 2013 this section is named Protect Workbook.

4. Choose the Mark as Final option from the drop-down menu.

5. Then you'll be informed that this document version will be final so that other people won't be
allowed to make any changes to it. You need to agree or press Cancel.

If you want to let some people modify the worksheet after all, you can set a password for those
who want to change something in the document.
1. Stay in the backstage view. If you are out of the backstage view and back to the worksheet,
click on the File tab again.

2. Choose 'Save As' from the File menu.


3. Open the Tools drop-down list at the bottom of the Save As dialog window.
4. Select General Options.

5. Enter a password in the Password to modify field.

6. Click OK.

7. Reenter the password to confirm it.


8. Click OK.

9. Choose the folder where you'd like to save the document and press Save.
Now your document is secured from unwanted editing. But be careful! People who know the
password can easily remove it from the Password to modify box thus letting other readers
change the information in the worksheet.
Wow! This post has turned out to be long! I tried to cover all the bases that concern viewing,
changing and removing the document properties so I hope you'll find proper answers to the sore
points involving metadata.

How to replace formulas with their values in Excel


Here are good tips to save your time - 2 fastest ways to replace formulas in Excel cells with
their values. Both hints work for Excel 2013, 2010-2003.
You may have different reasons for converting formulas to values:

To be able to quickly insert values to other workbooks or sheets without wasting time on
copy/paste special.
To keep your original formulas unknown when you send a workbook to another person
(for example, your retail markup to the wholesale price).
To prevent the result from modifying when the numbers in the linking cells change.
Save the result of the rand() formula
If you have a lot of complex formulas in your workbook which make recalculating really
slow. And you cannot switch the "Workbook calculation" option to the manual mode.
Converting formulas to values using Excel shortcuts
Replacing formulas with values in 2 clicks
Converting formulas to values using Excel shortcuts
Suppose, you have the formula to extract domain names from URLs.
You need to replace its results with values.

Just follow the simple steps below:


1.
2.
3.

Select all the cells with formulas that you want to convert.
Press Ctrl + C or Ctrl + Ins to copy formulas and their results to clipboard.
3. Press Shift+F10 and then V to paste only values back to Excel cells.
Shift + F10 + V is the shortest way to use Excel "Paste special - values only" dialog.

That's it! If this way is still not fast enough for you, have a look at the next tip.

Replacing formulas with values in 2 mouse clicks


Have you ever had a feeling that some routine tasks in Excel that can be solved in 5-10 clicks,
take too much of your time? If so, you are welcome to use our Quick Tools add-in for Excel.
This is a collection of 1-click utilities that are of great help in everyday work with Excel
spreadsheets. It will help you remove all blank cells, rows and columns; move columns by dragn-dropping; filter by the selected value, apply any math operation to a range; copy cells'
addresses to clipboard, and much more.
These are the steps to get it working:
1.
2.

3.

Download Quick Tools setup and install it.


Select all the cells with formulas and cick on the Ablebits.com Quick Tools tab (the
1st click).

Click on the Convert to Values icon (the 2nd click).

Ready :)

PS Feel free to explore other Quick Tools features. I can assure you that it will save 4-5 minutes
on one Excel task, 5-10 minutes on another task, and by the end of your day it will save you an
hour or more of your precious time. How much does an hour of your work cost?

How to count and sum cells by color in Excel 2010 and 2013
I this article you will learn how to count cells by color in Excel and get the sum of colored cells.
These solutions work both for cells colored manually and with conditional formatting. You will
also learn how to filter cells by several colors in Excel 2010 and 2013.

If you actively use diverse fill and font colors in your Excel worksheets to differentiate between
various types of cells or values, you may want to know how many cells are highlighted in a
certain color. If your cells' values are numbers, you may also want to automatically calculate the
sum of cells shaded with the same color, e.g. the sum of all red cells.
As all of us know, Microsoft Excel provides a variety of formulas for different purposes, and it
would be logical to assume that there are some to count cells by color. But regrettably, there is
no formula that would let us sum by color or count by color in a usual Excel worksheet.
Apart from using third-party add-ins, there is only one possible solution - utilize User Defined
Functions. If you know very little about this technology or have never heard this term before,
don't be afraid, you will not have to write the code yourself. You will find the perfect code (written
by our Excel guru) here and all that you will have to do is copy / paste it into your workbook.

Count by color and sum by color (if cells are colored manually)
Sum by color and count by color across the entire workbook
Count and sum colored cells (if conditional formatting is used)
Fastest way to count and sum cells by color in Excel
How to count by color and sum by color in an Excel worksheet
Suppose you have a table listing your company's orders where the cells in the Delivery column
are colored based on their value - "Due in X Days" cells are orange, "Delivered" items are green
and "Past Due" orders are red.

What we want now is automatically count cells by color, i.e. calculate the number of red, green
and orange cells in the worksheet. As I explained above, there is no straightforward solution to
this task. But luckily we have very skilled and knowledgeable Excel gurus in our team and one

of them has written the faultless code for Excel 2010 and 2013. So, move on with the 5 quick
steps below and you will know the number and sum of your color cells in a few minutes.
1. Open your Excel workbook and press Alt+F11 to open Visual Basic Editor (VBE).
2. Right-click on your workbook name under "Project-VBAProject" in the right hand part of the
screen, and then choose Insert > Module from the context menu.

3. Add the following code to your worksheet:


?
Function GetCellColor(xlRange As Range)
Dim indRow, indColumn As Long
Dim arResults()
Application.Volatile
If xlRange Is Nothing Then
Set xlRange = Application.ThisCell
End If
If xlRange.Count > 1 Then
ReDim arResults(1 To xlRange.Rows.Count, 1 To
xlRange.Columns.Count)

For indRow = 1 To xlRange.Rows.Count


For indColumn = 1 To xlRange.Columns.Count
arResults(indRow, indColumn) = xlRange(indRow,
indColumn).Interior.Color
Next
Next
GetCellColor = arResults
Else
GetCellColor = xlRange.Interior.Color
End If
End Function
Function GetCellFontColor(xlRange As Range)
Dim indRow, indColumn As Long
Dim arResults()
Application.Volatile
If xlRange Is Nothing Then
Set xlRange = Application.ThisCell
End If
If xlRange.Count > 1 Then
ReDim arResults(1 To xlRange.Rows.Count, 1 To
xlRange.Columns.Count)
For indRow = 1 To xlRange.Rows.Count
For indColumn = 1 To xlRange.Columns.Count
arResults(indRow, indColumn) = xlRange(indRow,
indColumn).Font.Color
Next
Next
GetCellFontColor = arResults
Else
GetCellFontColor = xlRange.Font.Color
End If
End Function
Function CountCellsByColor(rData As Range, cellRefColor As Range) As
Long
Dim indRefColor As Long
Dim cellCurrent As Range
Dim cntRes As Long
Application.Volatile
cntRes = 0
indRefColor = cellRefColor.Cells(1, 1).Interior.Color
For Each cellCurrent In rData

If indRefColor = cellCurrent.Interior.Color Then


cntRes = cntRes + 1
End If
Next cellCurrent
CountCellsByColor = cntRes
End Function
Function SumCellsByColor(rData As Range, cellRefColor As Range)
Dim indRefColor As Long
Dim cellCurrent As Range
Dim sumRes
Application.Volatile
sumRes = 0
indRefColor = cellRefColor.Cells(1, 1).Interior.Color
For Each cellCurrent In rData
If indRefColor = cellCurrent.Interior.Color Then
sumRes = WorksheetFunction.Sum(cellCurrent, sumRes)
End If
Next cellCurrent
SumCellsByColor = sumRes
End Function
Function CountCellsByFontColor(rData As Range, cellRefColor As Range) As
Long
Dim indRefColor As Long
Dim cellCurrent As Range
Dim cntRes As Long
Application.Volatile
cntRes = 0
indRefColor = cellRefColor.Cells(1, 1).Font.Color
For Each cellCurrent In rData
If indRefColor = cellCurrent.Font.Color Then
cntRes = cntRes + 1
End If
Next cellCurrent
CountCellsByFontColor = cntRes
End Function
Function SumCellsByFontColor(rData As Range, cellRefColor As Range)
Dim indRefColor As Long
Dim cellCurrent As Range
Dim sumRes

Application.Volatile
sumRes = 0
indRefColor = cellRefColor.Cells(1, 1).Font.Color
For Each cellCurrent In rData
If indRefColor = cellCurrent.Font.Color Then
sumRes = WorksheetFunction.Sum(cellCurrent, sumRes)
End If
Next cellCurrent
SumCellsByFontColor = sumRes
End Function
4. Save your workbook as "Excel Macro-Enabled Workbook (.xlsm)".
If you are not very comfortable with VBA, you can find the detailed step-by-step instructions and
a handful of useful tips in this tutorial: How to insert and run VBA code in Excel.
5. Now that all "behind the scenes" work is done for you by the just added user-defined function,
choose the cell where you want to output the results and enter the CountCellsByColor function
into it:
CountCellsByColor(range, color code)
In this example, we use the formula =CountCellsByColor(F2:F14,A17) where F2:F14is
the range containing color-coded cells you want to count and A17 is the cell with a certain
background color, a red one in our case.

In a similar way, you write the formula for the other colors you want to count, yellow and green
in our table.

If you have numerical data in colored cells (e.g. the Qty. column in our table), you can add up
the values based on a certain color by using an analogous SumCellsByColor function:
SumCellsByColor(range, color code)

As demonstrated in the screenshot above, we used the


formula =SumCellsByColor(D2:D14,A17) where D2:D14 is the range and A17 is the cell
with a color pattern.
In a similar way you can count cells and sum cells' values by font color using
the CountCellsByFontColor and SumCellsByFontColor functions, respectively.

Note: If after applying the above mentioned VBA code you would need to color a few more cells
manually, the sum and count of the colored cells won't get recalculated automatically to reflect
the changes. Please don't be angry with us, this is not a bug of the code : )
In fact, it is the normal behavior of all Excel macros, VBA scripts and User-Defined Functions.
The point is that all such functions are called with a change of a worksheet's data only and
Excel does not perceive changing the font color or cell color as a data change. So, after coloring
cells manually, simply place the cursor to any cell and press F2 and Enter, the sum and count
will get updated. The same applies to the other macros you will find further in this article.
Sum by color and count by color across the entire workbook
The VB script below was written in response to Connor's comment (also by our Excel's
guru Alex) and does exactly what Connor requested, namely counts and sums the cells of a
certain color in all worksheets of the workbook. So, here comes the code:
?
Function WbkCountCellsByColor(cellRefColor As Range)

Dim vWbkRes
Dim wshCurrent As Worksheet
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
vWbkRes = 0
For Each wshCurrent In Worksheets
wshCurrent.Activate
vWbkRes = vWbkRes + CountCellsByColor(wshCurrent.UsedRange,
cellRefColor)
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
WbkCountCellsByColor = vWbkRes
End Function
Function WbkSumCellsByColor(cellRefColor As Range)
Dim vWbkRes
Dim wshCurrent As Worksheet
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
vWbkRes = 0
For Each wshCurrent In Worksheets
wshCurrent.Activate
vWbkRes = vWbkRes + SumCellsByColor(wshCurrent.UsedRange,
cellRefColor)
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
WbkSumCellsByColor = vWbkRes
End Function
You use this macro in the same manner as the previous code and output the count and sum of
the colored cells with the help of the following
formulas, =WbkCountCellsByColor() and =WbkSumCellsByColor(), respectively. Simply
enter either formula in any empty cell on any sheet without defining a range, specify the address
of any cell of the needed color in brackets, e.g. =WbkSumCellsByColor(A1), and the formula will
display the sum of all the cells shaded with the same color in your workbook.
Custom functions to get a cell's background color, font color and color code
Here you will find a summary of all the functions we've used in this example as well as a couple
of new ones that retrieve color codes.

Note: Please remember that all of these formulas will work only if you have added the userdefined function to your Excel workbook as demonstrated earlier in the article.
Functions to count by color:
CountCellsByColor(range, color code)- counts cells with the specified
background color.
In the above example, we used the following formula to count cells by
color=CountCellsByColor(F2:F14,A17) where F2:F14 is the selected range and A17 is the cell
with the needed background color. You can use all other formulas listed below in a similar way.

CountCellsByFontColor(range, color code) - counts cells with the specified


font color.
Formulas to sum by color:
SumCellsByColor(range, color code) - calculates the sum of cells with a certain
background color.
SumCellsByFontColor(range, color code) - calculates the sum of cells with a
certain font color.
Formulas to get the color code:
GetCellFontColor(cell) - returns the color code of the font color of a specified cell.
GetCellColor(cell) - returns the color code of the background color of a specified
cell.

Well, counting cells based on color and getting the sum of colored cells was pretty easy, wasn't
it? Of course if you have that little VBA gem that makes the magic happen : ) But what if you do
not color cells manually and rather use conditional formatting, as we discussed in these two
articlesHow to change the background color of cells and How to change a row's color based on
cell value?
How to count by color and sum cells colored using conditional formatting
If you have applied conditional formatting to color cells based on their values and now you want
to count cells by color or sum the values in colored cells, I have bad news - there is no universal
user-defined function that would sum by color or count color cells and output the resulting
numbers directly in the specified cells. At least, I am not aware of any such function, alas : (
Of course, you can find tons of VBA code on the Internet that attempts to do this, but all those
codes (at least the examples I've come across, do not process conditional formatting such as

"Format all cells based on their values", "Format only top or bottom ranked values", "Format
only values that are above or below average", "Format only unique or duplicate values". Besides
that nearly all those VBA codes have a number of specificities and limitations because of which
they may not work correctly with certain workbooks or data types. All in all, you can try your luck
and google for an ideal solution and if you happen to find one, please do come back and post
your finding here!
The VBA code below overcomes the above mentioned limitations and works in Microsoft Excel
2010 and Excel 2013 spreadsheets with all types of condition formatting (kudos
to Alex again!). As a result, it displays the number of colored cells and the sum of values in
those cells, no matter which type of conditional formats are used in a sheet.
?
Sub SumCountByConditionalFormat()
Dim indRefColor As Long
Dim cellCurrent As Range
Dim cntRes As Long
Dim sumRes
Dim cntCells As Long
Dim indCurCell As Long
cntRes = 0
sumRes = 0
cntCells = Selection.CountLarge
indRefColor = ActiveCell.DisplayFormat.Interior.Color
For indCurCell = 1 To (cntCells - 1)
If indRefColor =
Selection(indCurCell).DisplayFormat.Interior.Color Then
cntRes = cntRes + 1
sumRes = WorksheetFunction.Sum(Selection(indCurCell),
sumRes)
End If
Next
MsgBox "Count=" & cntRes & vbCrLf & "Sum= " & sumRes & vbCrLf &
vbCrLf & _
"Color=" & Left("000000", 6 - Len(Hex(indRefColor))) & _
Hex(indRefColor) & vbCrLf, , "Count & Sum by Conditional
Format color"
End Sub

How to use the code to count colored cells and sum their values
1. Add the above code to your worksheet as explained in the first example.

2. Select a range or ranges where you want to count colored cells or/and sum by color if you
have numerical data.
3. Press and hold Ctrl, select one cell with the needed color, and then release the Ctrl key.
4. Press Alt+F8 to open the list of macros in your workbook.
5. Select the SumCountByConditionalFormat macro and click Run.

As a result, you will see the following message:

For this example, we selected the Qty. column and got the following numbers:

Count is the number of the cells with a particular color, a reddish color in our case that
marks "Past Due" cells.
Sum is the sum of values of all red cells in the Qty. column, i.e. the total number of "Past
Due" items.
Color is the Hexadecimal color code of a selected cell, D2 in our case.
Sample workbook for download
If you have any difficulties with adding the scripts to your Excel workbooks, such as compilation
errors, formulas not working and so on, please download this sample workbook with
theCountCellsByColor and SumCellsByColor functions ready for use and try them on your data.
Fastest way to count and sum cells by color in Excel - new!
Updated on 1-Jul-2014.
When we published this article, we hoped it would be popular because we used to get a lot of
questions about how to count and sum cells by color in Excel. But even in our wildest
expectations, we did not think it was going to be that popular! What you see in comments on
this page is just a tiny portion of the enormous feedback we have received. So, our team
decided to take a step further and create an Excel add-in that would count and sum cells by the
color you specify or by all colors in the selected range.
Let me introduce you our brand new add-in - Count & Sum by Color for Excel 2013, Excel 2010,
2007 and 2003. Once installed, it will place 2 buttons onto the Ablebits Data tab on your Excel

ribbon - One Color and All Colors, as you can see in the screenshot below:

Count and sum cells by the selected color


You simply click the One Color button on the ribbon and have the Count & Sum by Color pane
open at the left of the worksheet. On the pane, you select:

The range where you want to count and sum the cells
Any color-coded cell
Color option - either background or font color
Once done, click Calculate and see the result in the lower part of the pane straight away! Apart
from the count and sum, the add-in calculates the average and finds the max and min values.
No macros, no formulas, no pain :)

Count and sum cells by all colors in the selected range


The All Colors option works basically in the same way, except that you do not have to choose
the color. In the "Show results for" section, you can select any of the following
options: Count, Sum,Average, Maximum or Minimum value.

If you want to copy the results to your worksheet, click the Paste results... button at the bottom
of the Count & Sum by Color pane.

And here is a list of the main features you will find in the Count & Sum by Color add-in:

Count and sum cells by color in all versions of Excel 2013, 2010, 2007 and 2003.
Handle cells color-coded manually and with conditional formatting.
Besides counting and calculating the sum, the following functions are available: Average,
Maximum and Mininum values.
An option to recalculate colored cells automatically when a new range is selected.
Copy and paste the results to any location on the current spreadsheet or to any other
sheet.
You can download a trial version of the Count & Sum by Color add-in here. Hopefully you will
like it, but we are keen to know your feedback, anyway : )
How can I get the Count & Sum by Color add-in?
Currently the add-in is available as part of the Ultimate Suite for Excel. This is a collection of our
best tools especially designed to deal with the most tedious, painstaking and error-prone tasks
in Excel.
In addition to the Count & Sum by Color add-in, the Ultimate Suite includes about 40 other
tools that can help you to:

Merge data from different tables

Remove duplicates
Combine duplicate rows into one
Merge cells, rows and columns
Find and replace in all workbooks
Clean data in worksheets
And much more!
If you like the tools, be sure to benefit from a special 15% off coupon code that we provide
especially for our blog readers: AB14-BlogSpo
Hopefully, in this article you have found the information you were looking for. If not, you are
welcome to post a comment and we will try to help!

How to insert and run VBA code in Excel 2010, 2013 - tutorial for beginners
This is a short step-by-step tutorial for beginners showing how to add VBA code (Visual Basic
for Applications code) to your Excel workbook and run this macro to solve your spreadsheet
tasks.
Most people like me and you are not real Microsoft Office gurus. So, we may not know all
specificities of calling this or that option, and we cannot tell the difference between VBA
execution speed in Excel 2010 and 2013. We use Excel as a tool for processing our applied
data.
Suppose you need to change your data in some way. You googled a lot and found a VBA macro
that solves your task. However, your knowledge of VBA leaves much to be desired. Feel free to
study this step-by-step guide to be able to use the code you found:

Insert VBA code to an Excel Workbook


How to run a VBA macro in Excel
Insert VBA code to Excel Workbook
For this example, we are going to use a VBA macro to remove line breaks from the current
worksheet.
1. Open your workbook in Excel.
2. Press Alt+F11 to open Visual Basic Editor (VBE).

2. Right-click on your workbook name in the "Project-VBAProject" pane (at the top left corner of
the editor window) and select Insert -> Module from the context menu.

3. Copy the VBA code (from a web-page etc.) and paste it to the right pane of the VBA editor
("Module1" window).

Tip: How to speed up macro execution.


If the code of your VBA macro does not contain the following lines in the beginning:
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Then add the following lines to get your macro to work faster (see the screenshots above):

To the very beginning of the code, after all code lines that start with Dim (if there are no
"Dim" lines, then add them right after the Sub line):
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
To the very of the code, before End Sub:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
These lines, as their names suggest, turn off screen refresh and recalculating the workbook's
formulas before running the macro.
After the code is executed, everything is turned back on. As a result, the performance is
increased from 10% to 500% (aha, the macro works 5 times faster if it continuously manipulates
the cells' contents).
4. Save your workbook as "Excel macro-enabled workbook". Press Crl+S, then click the "No"
button in the "The following features cannot be saved in macro-free workbook" warning dialog.

The "Save as" dialog will open. Choose "Excel macro-enabled workbook" from the "Save as
type" drop-down list and click the Save button.

5. Press Alt+Q to close the Editor window and switch back to your workbook.
How to run VBA macros in Excel
When you want to run the VBA code that you added as described in the section above:
press Alt+F8 to open the "Macro" dialog.

Then select the wanted macro from the "Macro Name" list and click the "Run" button.

How to remove carriage returns (line breaks) from cells in Excel 2010, 2013, 2007
In this tip you'll find 3 ways to remove carriage returns from Excel cells. You'll also learn how to
replace line breaks with other symbols. All solutions work for Excel 2013, 2010 - 2003

There can be different reasons for line breaks occurring in your text. Usually, carriage returns
appear when you copy text from a webpage, get a workbook that already contains line breaks
from a customer, or you add them yourself using Alt+Enter.
In any case, what you want to do now is delete carriage returns since they don't let you find a
phrase and make column contents look disorganized when you turn on the wrap text option.
All these 3 ways are really quick. Feel free to pick the one that suites you best:

Remove all carriage returns manually to quickly delete line breaks in 1 worksheet.
Delete line breaks using formulas to employ several formulas for a complex cell text
processing.
Use a VBA macro to get rid of line breaks in a number of workbooks.
Note:Initially the terms "Carriage return" and "Line feed" were used in a typewriter and meant
2 different actions, you can find more at Wiki.
Computers and text processing software were created taking into consideration the typewriter
specificities. That's why two different non-printable symbols are used now to indicate line break:
"Carriage return" (CR, ASCII code 13) and "Line Feed" (LF, ASCII code 10). Windows uses 2
symbols one by one: CR+LF, and LF for *NIX systems.
Be careful: in Excel you can find both variants. If you import data from a .txt or .csv file, you
are more likely to find Carriage Return + Line Feed. When you break a line using Alt+Enter ,
Excel inserts Line Feed only. In case you get .csv files from a person who uses Linux, Unix, etc.,
you'll find only Line Feeds again.
Remove Carriage Returns manually
Pros: the fastest way.
Cons: no any additional features :(.
Please find the steps for eliminating line breaks using Find and Replace:

1. Select all cells where you want to remove or replace carriage returns.

2. Press Ctrl+H to open the Find & Replace dialog box.


3. In the Find What field enter Ctrl+J. It will look empty, but you will see a tiny dot.
4. In the Replace With field, enter any value to replace carriage returns. Usually, it is space to
avoid 2 words join accidentally. If all you need is deleting the line breaks, leave the "Replace
With" field empty.

5. Press the Replace All button and enjoy the result!

Delete line breaks using Excel formulas


Pros: you can use a formula chain / nested formulas for complex cell text processing. For
example, it is possible to remove carriage returns and then eliminate excess leading and trailing
spaces and those between words.
Or you may need to delete carriage returns to use your text as an argument of another function
without changing the original cells. For example, if you want to be able to use the result as an
argument of the function =lookup ().
Cons: you'll need to create a helper column and follow many extra steps.
1. Add the helper column to the end of your data. You can name it "1 line".
2. In the first cell of the helper column (C2), enter the formula to remove / replace line breaks.
Here you can see several helpful formulas for different occasions:

Handle both Windows and UNIX carriage return/ line feeds combinations.
=SUBSTITUTE(SUBSTITUTE(B2,CHAR(13),""),CHAR(10),"")
The next formula will help you replace line break with any other symbol (comma+space).
In this case lines will not join and extra spaces will not appear.
=TRIM(SUBSTITUTE(SUBSTITUTE(B2,CHAR(13),""),CHAR(10),", ")
If you want to remove all nonprintable characters from text, including line breaks:
=CLEAN(B2)

3. Copy the formula across the other cells in the column.


4. Optionally, you can replace the original column with the one where the line breaks were
removed:

Select all cells in column C and press Ctrl + C to copy the data to clipboard.
Now pick the cell B2 and press the Shift + F10 shortcut. Then just press V.
Remove the helper column.
VBA macro to get rid of line breaks
Pros: Being created once, can be reused in any workbook.
Cons: you need to have the basic knowledge of VBA.
The VBA macro from the example below deletes carriage returns from all cells in the currently
opened worksheet (active worksheet).
?
Sub RemoveCarriageReturns()
Dim MyRange As Range
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For Each MyRange In ActiveSheet.UsedRange
If 0 < InStr(MyRange, Chr(10)) Then
MyRange = Replace(MyRange, Chr(10), "")
End If
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
If you don't know VBA really well, see How to insert and run VBA code in Excel

3 ways to remove spaces between words / numbers in Excel cells


3 quick ways to remove extra spaces between words or delete all spaces from Excel cells. You
can use trim formula, Excel Find & replace or special Excel add-in to clean up cells' content.
When you paste data from an external source to an Excel spreadsheet (plain text reports,
numbers from web pages, etc.), you are likely to get extra spaces along with important data.
There can be leading and trailing spaces, several blanks between words and thousand
separators for numbers.
Consequently, your table looks disorderly and becomes difficult to use. It may be a challenge to
find a customer in the Name column since you search for "John Doe" which has no excess
spaces between the names while the way it looks in your table is "John Doe". Or numbers can't
be summed up, and again extra blanks are the ones to blame.
In this article you'll find how to clean up your data.

o
o
o

Trim blanks between words to 1, remove trailing / leading spaces


Using trim formula
Employ the Find & Replace option
3 clicks to neat data with Cell Cleaner add-in
Remove All spaces between numbers or words
Trim blanks between words to 1, remove trailing / leading spaces
For example, you have a table with 2 columns. In the column Name, the first cell contains "John
Doe" written correctly without excess spaces. All other cells have extra blanks between the first
and the last names. At the same time these cells have irrelevant blanks before and after the full
names known as leading and trailing spaces. The second column is called Length and shows
the number of symbols in each name:

Use the Trim formula to remove extra spaces


Excel has the Trim formula to use for deleting extra spaces from text. Below you can find the
steps showing how to use this option:
1. Add the helper column to the end of your data. You can name it "Trim".

2. In the first cell of the helper column (C2), enter the formula to trim excess spaces =TRIM(A2)

3. Copy the formula across the other cells in the column. Feel free to use some tips from Enter
the same formula into all selected cells at a time.
4. Replace the original column with the one that has the cleaned data. Select all cells in the
helper column and press Ctrl + C to copy data to clipboard.
Now pick the first cell in the original column and press Shift + F10 or the menu button
just press V.

. Then

5. Remove the helper column.


That's it! We deleted all excess blanks with the help of the formula trim(). Unfortunately, it's a bit
time-consuming, especially if your spreadsheet is rather big.

Note: If after using the formula you still see extra spaces (the last cell on the screenshot),
please have a look at If the TRIM Function Doesn't Work

Using Find & Replace to remove extra spaces between words


This option needs fewer steps, but allows only deleting excess spaces between words. Leading
and trailing spaces will also be trimmed to 1, but will not be removed.
1. Select one or several columns with the data to delete spaces between words.
2. Press Ctrl + H to get the "Find and Replace" dialog box .
3. Press the Space bar twice in the Find What field and once in Replace With
4. Click on the "Replace all" button, and then press Ok to close Excel confirmation dialog.

5. Repeat step 4 until you see the message "We couldn't find anything to replace." :)
3 clicks to neat data with Cell Cleaner add-in
If you often import data to Excel from external sources and spend much time polishing up your
tables, check out Cell Cleaner add-in for Excel.
This helpful tool will clean data imported from web or any other external source. It removes
leading and trailing spaces, excess blanks between words, non-breaking spaces, line breaks,
non-printing symbols and other unwanted characters. This add-in also converts words to
UPPER, lower or Proper Case. And if you need to change text numbers back to number format
and delete apostrophes, this will not be a problem.
0. Download and install Cell Cleaner add-in for Excel.
1. Select the range in your table where you want to remove excess spaces. For new tables I
usually press Ctrl + A to process all columns in a go.

2. Go to Ablebits Data tab and click on the Trim Spaces icon

3. The Cell Cleaner pane will open on the left side of your worksheet. Just select the needed
checkboxes, click the Trim button and enjoy your perfectly cleaned table.

Isn't it faster than with the two previous tips? If you always deal with data processing, this tool
will save you hours of precious time.
Remove all spaces between numbers
Suppose, you have a workbook with numbers where the digits (thousands, millions, billions) are
separated with spaces. Thus Excel sees numbers as text and no math operation can be

performed.

The easiest way to get rid of excess spaces is using the standard Excel Find & Replace option:

Press Ctrl + Space to select all cells in a column.


Press Ctrl + H to open the "Find & Replace" dialog box.
Press Space bar in the Find What field and make sure the "Replace with" field is empty.
Click on the "Replace all" button, and then press Ok. Voila! All spaces are removed.

Using formula to remove all spaces


You may need to delete all blanks, like in a formula chain. To do this, you can create a helper
column and enter the formula: =SUBSTITUTE(A1," ","")
Here A1 is the first cell of the column with numbers or words where all spaces must be deleted.
Then follow the steps from the part using formula to remove extra spaces between words to 1

How to quickly extract domain names from URLs in Excel


A few tips and pieces of advice will help you get domain names from a list of URLs using Excel
formulas. Two variations of the formula let you extract the domain names with and without www.
regardless of the URL protocol (http, https, ftp etc. are supported). The solution works in all
modern versions of Excel, from 2003 through 2013.

If you are concerned with promoting your web-site (like I am) or doing SEO at the professional
level promoting clients' web-sites for money, you often have to process and analyze huge lists of
URLs: Google Analytics reports on traffic acquisition, Webmaster tools reports on new links,
reports on backlinks to your competitors' web-sites (which do contain a great lot of interesting
facts ;) ) and so on, and so forth.
To process such lists, from ten to a million links, Microsoft Excel makes an ideal tool. It is
powerful, agile, extendable, and lets you send a report to your client directly from an Excel
sheet.
"Why is it this range, from 10 to 1,000,000?" you may ask me. Because you definitely don't need
a tool to process fewer than 10 links; and you will hardly need any if you have over a million
inbound links. I'd wager that in this case you'd already had some custom software developed
especially for you, with a business logic specifically tailored for your needs. And it would be me
who would peruse your articles and not the other way round :)
When analyzing a list of URLs, you often need to perform the following tasks: get domain
names for further processing, group URLs by domain, remove links from already processed
domains, compare and merge two tables by domain names etc.

o
o
o
o

How to extract domain names in 5 easy steps


How to process a list of URLs by Domain name column
Group URLs by domain name
Highlight the 2nd and all subsequent URLs in the same domain
Compare two tables for duplicates
Match and merge two tables by domain name

5 easy steps to extract domain names from the list of URLs


As an example, let's take a snippet of ablebits.com's backlinks report generated by Google
Webmaster Tools.

Tip: I'd recommend using ahrefs.com to timely spot new links to your own site and your
competitors' web-sites.
1. Add the "Domain" column to the end of your table.
We have exported the data from a CSV file, which is why in terms of Excel our data are in a
simple range. Press Ctrl + T to convert them to an Excel table because it is far more convenient
to work with.

2. In the first cell of the "Domain" column (B2), enter the formula to extract a domain name:

Extract the domain with www. if it is present in a URL:


=MID(A2,FIND(":",A2,4)+3,FIND("/",A2,9)-FIND(":",A2,4)-3)

Omit www. and get a pure domain name:


=IF(ISERROR(FIND("//www.",A2)),
MID(A2,FIND(":",A2,4)+3,FIND("/",A2,9)-FIND(":",A2,4)-3),
MID(A2,FIND(":",A2,4)+7,FIND("/",A2,9)-FIND(":",A2,4)-7))

The second formula may seem too long and complex, but only if you didn't see truly long
formulas. It's not without reason that Microsoft has increased the maximum length of formulas
up to 8192 characters in new versions of Excel :)
The good thing is that we don't have to use either an additional column or VBA macro. In fact,
using VBA macros to automate your Excel tasks is not so difficult as it may seem, see a very
good article - Tutorial with Excel examples about Macros. But in this particular case, we do not
actually need them, it's quicker and easier to go with a formula.
Note: Technically, www is the 3rd level domain, though with all normal web-sites www. is just an
alias of the primary domain. In the early days of the Internet, you could say "double u, double u,
double u our cool name dot com" on the phone or in a radio advert, and everyone perfectly
understood and remembered where to look for you, of course unless your coolname
was http://www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com/ :)
You need to leave all other domain names of the 3rd level, otherwise you would mess up links
from different sites, e.g. with "co.uk" domain or from different accounts on blogspot.com etc.
3. Since we have a full-fledged table, Excel automatically copies the formula across all cells in
the column.

Done! We have a column with extracted domain names.

In the next section you will learn how you can process a list of URLs based on the Domain
column.

Tip: If you may need to edit the domain names manually at a later time or copy the results to
another Excel worksheet, replace the formula results with values. To do this, proceed with the
following steps:
Click on any cell in the Domain column and press Ctrl+Space to select all the cells in
that column.
Press Ctrl + C to copy the data to Clipboard, then go to the Home tab, click the "Paste"
button and select "Value" from the drop-down menu.

Processing a list of URLs using the Domain name column


Here you will find a few tips on further processing of the URL list, from on my own experience.
Group URLs by domain
1. Click on any cell in the Domain column.
2. Sort your table by Domain: go to the Data tab and click on the A-Z button.
3. Convert your table back to a range: click on any cell in the table, go to the Design tab and
click the "Convert to the range" button.
4. Go to the Data tab and click the "Subtotal" icon.
5. In the "Subtotal" dialog box, select the following options: At each change in: "Domain" use
function Count and Add subtotal to Domain.

6. Click OK.
Excel has created an outline of your data on the left hand side of the screen. There are 3 levels
of the outline and what you see now is the expanded view, or level 3 view. Click number 2 in the
upper left hand corner to display the final data by domains, and then you can click the plus and

minus signs (+ / -) in order to expand / collapse the details for each domain.

Highlight the second and all subsequent URLs in the same domain
In our previous section we showed how to group URLs by domain. Instead of grouping, you can
quickly color duplicate entries of the same domain name in your URLs.
For more details please see how to automatically highlight duplicates in Excel.

Compare your URLs from different tables by domain column


You may have one or several separate Excel worksheets where you keep a list of domain
names. Your tables may contain links that you don't want to work with, like spam or the domains
you already processed. You may also need to keep a list of domains with interesting links and
delete all other ones.

For example, my task is to color in red all domains that are in my spammer blacklist:

Not to waste much time, you can compare your tables to delete the unnecessary links. Please
read How to compare two columns in Excel and delete duplicates (highlight, color, move)
The best way is to merge two tables by domain name
This is the most advanced way and the one I personally prefer.
Suppose, you have a separate Excel worksheet with reference data for each domain you ever
worked with. This workbook keeps webmaster contacts for link exchange and the date when
your website was mentioned in this domain. There can also be types/subtypes of websites and
a separate column with your comments like on the screenshot below.

As soon as you get a new list of links you can match two tables by domain name and merge the
information from the domain lookup table and your new URLs sheet in just two minutes.
As a result you will get the domain name as well as the website category and your comments.
This will let you see the URLs from the list you need to delete and those you need to process.
Match two tables by domain name and merge data:
0. Download and install the latest version of Merge Tables Wizard for Microsoft Excel
This nifty tool will match and merge two Excel 2013-2003 worksheets in a flash. You can use
one or several columns as the unique identifier, update existing columns in the master

worksheet or add new from the lookup table. Feel free to read more about Merge Tables Wizard
on our website.
1. Open your URLs list in Excel and extract domain names as described above.
2. Select any cell in your table. Then go to the Ablebits Data tab and click on the Merge Two
Tablesicon to run the add-in.

3. Press the Next button twice and select your worksheet with the domains information as
theLookup Table.

4. Tick the checkbox next to Domain to identify it as the matching column.

5. Select what information about the domain you want to add to the URLs list and click Next.

6. Press the Finish button. When the processing is over, the add-in will show you a message
with the details of the merge.

Just a few seconds - and you get all information about each domain name at a glance.

You can download Merge Tables Wizard for Excel, run it on your data and see how useful it can
be.
If you are interested to get a free add-in for extracting domain names and subfolders of the root
domain (.com, .edu, .us etc.) from the URL list, simply drop us a comment. When doing this,
please specify your Excel version, e.g. Excel 2010 64-bit, and enter your email address in the
corresponding field (do not worry, it won't be displayed publically). If we have a decent number
of votes, we will create such and add-in and I let you know. Thank you in advance!

How to change the row color based on a cell's value in Excel


Learn how to quickly change the color of the entire row based on a single cell's value in your
Excel worksheets. Tips and formula examples for number and text values.
Last week we discussed how to change the background color of a cell based on its value. In this
article you will learn how to highlight entire rows in Excel 2010 and 2013 based on a value of
one cell, and also find a few tips and formula examples that will work with numerical and text
cell values.

Change a row color based on a number in a single cell


Apply several formatting rules with the specified priority
Change a row's background color based on a text value in a cell
Change a cell's color based on another cell value
Change the color of a row based on several conditions
How to change a row color based on a number in a single cell
Say, you have a table of your company orders like this:

You may want to shade the rows in different colors based on the cell value in the Qty. column to
see the most important orders at a glance. This can be easily done using Excel Conditional
Formatting.
1. Start with selecting the cells the background color of which you want to change.

2. Create a new formatting rule by clicking Conditional Formatting > New Rule... on
the Home tab.

3. In the "New Formatting Rule" dialog window that opens, choose the option "Use a formula to
determine which cells to format" and enter the following formula in the "Format values where

this formula is true" field: =$C2>4

Instead of C2, you enter a cell that contains the value you want to check in your table and put
the number you need instead of 4. And naturally, you can use the less (<) or equality (=) sign so
that your formulas will read =$C2<4 and =$C2=4, respectively.
Also, pay attention to the dollar sign $ before the cell's address, you need to use it to keep the
column letter the same when the formula gets copied across the row. Actually, it is what makes
the trick and applies formatting to the whole row based on a value in a given cell.
4. Click the "Format..." button and switch to Fill tab to choose the background color. If the
default colors do not suffice, click the "More Colors..." button to pick the one to your liking, and

then clickOK twice.

You can also use any other formatting options, such as the font color or cells border on the
other tabs of the Format Cells dialog.

4. The preview of your formatting rule will look similar to this:

5. If this is how you wanted it and you are happy with the color, click OK to see your new
formatting in effect.
Now, if the value in the Qty. column is greater than 4, the entire rows in your Excel table will turn
blue.

As you can see, changing the row's color based on a number in a single cell is pretty easy in
Excel. Further on, you will find more formula examples and a couple of tips for more complex
scenarios.
How to apply several rules with the priority you need
In the previous example, you may want to highlight the rows with different values in
the Qty.column in different colors. For example, you can add a rule to shade the rows with
quantity 10 or greater, say, in pink. In this case, use the formula =$C2>9, and after your second
formatting rule is created, set the rules priority so that both of your rules will work.
1. On the Home tab, in the Styles group, click Conditional Formatting > Manage Rules... .
2. Choose "This worksheet" in the "Show formatting rules for" field. If you want to manage the
rules that apply to your current selection only, choose "Current Selection".
3. Select the formatting rule you want to be applied first and move it to the top of the list using
the arrows. The result should resemble this:

Click the OK button and the corresponding rows will immediately change their background color
based on the cell values that you specified in both formulas.

How to change a row color based on a text value in a cell


In our sample table, to make follow-up on orders easier, you can shade the rows based on the
values in the Delivery column, so that:

If an order is "Due in X Days", the background color of such rows will turn orange;
If an item is "Delivered", the entire row will be colored in green;
If an order is "Past Due", the row will turn red.
Naturally, the row color will change if the order status gets updated.
While the formula from our first example could work for "Delivered" and "Past
Due"(=$E2="Delivered" and =$E2="Past Due"), the task sounds a bit trickier for "Due in..."
orders. As you see, different orders are due in 1, 3, 5 or more days and the above formula won't
work because it is purposed for exact match.
In this case, you'd better use the =SEARCH formula like this =SEARCH("Due in", $E2)>0 that
works for the partial match as well. In the formula, E2 is the address of the cell that you want to
base your formatting on, the dollar sign ($) is used to apply the formula to the entire row,
and >0means that the formatting will be applied if the specified text ("Due in" in our case) is
found.
Tip: If you use >0 in the above formula, it means that the row will be colored no matter where
the specified value or text is located in the key cell. For example, the Delivery column (F) may
contain the text "Urgent, Due in 6 Hours", and this row will be colored as well.
If you want to change the color of rows where the contents of the key cell starts with the
indicated value or text, then you need to use =1 in the formula, e.g. =SEARCH("Due in",
$E2)=1. However, be very careful when using this kind of formula and ensure that there are no

leading spaces in the key column, otherwise you might rack your brain trying to figure out why
the formula does not work :) You can use this free tool to find and remove leading and trailing
spaces in your worksheets - Trim Spaces add-in for Excel.
Create three such rules following the steps from the first example, and you will have the below
table, as the result:

How to change a cell's color based on a value of another cell


In fact, this is simply a variation of changing the background color of a row case. But instead of
the whole table, you select a column or a range where you want to change the cells color and
use the formulas described above.

For example, we could create three such rules to shade only the cells in the "Order number"
column based on another cell value (values in the Delivery column).

How to change a row's background color based on several conditions


If you want to shade the rows in the same color based on several values, then instead of
creating several formatting rules you can use the =OR or =AND formulas to set several
conditions.
For example, we can color the orders due in 1 and 3 days in the reddish color, and those that
are due in 5 and 7 days in the yellow color. The formulas are as follow:

=OR($F2="Due in 1 Days", $F2="Due in 3 Days")


=OR($F2="Due in 5 Days", $F2="Due in 7 Days")

And you can use the =AND formula, say, to change the background color of rows
with Qty. equal to or greater than 5 and equal to or less than 10: =AND($D2>=5, $D2<=10).

Naturally, you are not limited to using only 2 conditions in such formulas, you are free to use as
many as you need, e.g. =OR($F2="Due in 1 Days", $F2="Due in 3 Days", $F2="Due in 5
Days") and so on.
Tip: Now that you know how to color cells to differentiate between various types of values, you
may want to know how many cells are highlighted in a certain color and calculate the sum of
values in those cells. The good news is that you can automate this too and you will find the
solution in this article: How to count, sum and filter cells by color in Excel.
These are only a few of many possible ways to zebra stripe your Excel worksheets based on a
cell's value that will respond to change of data in that cell. If you need something different for
your data set, drop us a comment and we will try to figure this out.

How to prevent duplicates in a column in Excel


Today I'll tell you how to prevent duplicates from appearing in a column of your Excel
worksheet. This tip works in Microsoft Excel 2013, 2010, 2007 and lower.
We covered a similar topic in one of our previous articles. So you should know how to
automatically highlight duplicates in Excel once something has been typed.
This article will help you stop duplicates appearing in one or several columns in your Excel
worksheet. So you can have only unique data in the 1st column of your table be there invoice
numbers, stock keeping units, or dates, each mentioned only once.
How to stop duplication - 5 easy steps
Excel has Data Validation - one unfairly forgotten tool. With its help you can avoid errors
occurring in your records. We will be sure to devote some future articles to this helpful feature.
And now, as a warm-up, you will see a simple example of using this option. :)
Suppose, you have a worksheet named "Customers" that includes such columns as Names,
Phone numbers, and Emails you use for sending newsletters. Thus all email addresses must
be unique. Follow the steps below to avoid sending the same message to one client twice.

0. If necessary, find and delete all duplicates from the table. You can first highlight the dupes
and delete them manually after looking through the values. Or you can remove all duplicates
with the help of the Duplicate Remover add-in.
1. Select the entire column where you need to avoid duplicates. Click on the first cell with data
keeping the Shift keyboard button pressed and then select the last cell. Or simply use the
combination of Ctrl + Shift + End. It is important to select the 1st data cell first.

Note: If your data are in a simple Excel range as opposed to a full-fledged Excel table, you need
to select all the cells in your column, even the blank ones, from D2 to D1048576

2. Go to Excel "Data" tab and click on the Data Validation icon to open the dialog box.

3. On the Settings tab, choose "Custom" from the Allow drop down list and
enter=COUNTIF($D:$D,D2)=1 into the Formula box.

Here $D:$D are the addresses of the first and the last cells in your column. Please pay attention
to the dollar signs that are used to indicate absolute reference. D2 is the address of the first
selected cell, it is not an absolute reference.
With the help of this formula Excel counts the number of occurrences of the D2 value in the
range D1:D1048576. If it is mentioned just once, then everything is fine. When the same value
appears several times, Excel will show an alert message with the text you specify on the "Error
alert" tab.
Tip: You can compare your column with another column to find duplicates. The second column
can be on a different worksheet or event workbook. For example, you can compare the current
column with the one that contains the blacklisted emails of customers
you don't won't to work with any longer. :) I will give more details about this Data Validation
option in one of my future posts.
4. Switch to the "Error alert" tab, and enter your text into the fields Title and Error message.
Excel will show you this text as soon as you try to enter a duplicate entry into the column. Try to
type the details that will be accurate and clear for you or your colleagues. Otherwise, in a month
or so you can forget what it means.
For example:
Title: "Duplicate email entry"
Message: "You have entered an email address that already exists in this column. Only unique

emails are allowed."

5. Click OK to close the "Data validation" dialog.


Now when you try to paste an address that already exists in the column, you will see an error
message with your text. The rule will work both if you enter a new address into an empty cell for
a new customer and if you try to replace an email for the existing client:

If your "No duplicates allowed" rule can have exceptions :)


On the fourth step choose Warning or Information from the Style menu list. The alert message
behavior will change correspondingly:

Warning: The buttons on the dialog will turn as Yes / No / Cancel. If you click Yes, the value you
enter will be added. Press No or Cancel to get back to editing the cell. No is the default button.

Information: The buttons on the alert message will be Ok and Cancel. If you click Ok (the
default one), a duplicate will be added. Cancel will take you back to the editing mode.

Note: I'd like to pay your attention again to the fact that the alert about a duplicate entry will
appear only when you try to enter a value into a cell. Excel will not find existing
duplicateswhen you configure the Data Validation tool. It will not happen even if there are more
than 150 dupes in your column. :).

Two ways to change background color in Excel based on cell value


In this article, you will find two quick ways to change the background color of cells based on
value in Excel 2013, 2010 and 2007. Also, you will learn how to use Excel formulas to change
the color of blank cells or cells with formula errors.
Everyone knows that changing the background color of a single cell or a range of data in Excel
is easy as clicking the "Fill color"
button . But what if you want to change the background
color of all cells with a certain value? Moreover, what if you want the background color to
change automatically along with the cell value's changes? Further in this article you will find
answers to these questions and learn a couple of useful tips that will help you choose the right
method for each particular task.

Change the background color of cells based on value (dynamically) - The background
color will change automatically when the cell value changes.
Change a cell's color based on its current value (statically) - Once set, the background
color will not change no matter how the cell's value changes.
Change color of special cells (blanks / with errors / with formulas)
How to change a cell's color based on value in Excel dynamically
The background color will change dependent on the cell's value.
Task: You have a table or range of data, and you want to change the background color of cells
based on cell values. Also, you want the color to change dynamically reflecting the data
changes.
Solution: You need to use Excel conditional formatting to highlight the values greater than
X, less than Y or between X and Y.
Suppose you have a list of gasoline prices in different states and you want the prices greater
than USD 3.7 to be of the color red and equal to or less than USD 3.45 to be of the color green.

Note: The screenshots for this example were captured in Excel 2010, however the buttons,
dialogs and settings are the same or nearly the same in Excel 2007 and Excel 2013.

Okay, here is what you do step-by-step:


1. Select the table or range where you want to change the background color of cells. In this
example, we've selected $B$2:$H$10 (the column names and the first column listing the state
names are excluded from the selection).
2. Navigate to the Home tab, Styles group, and choose Conditional Formatting > New Rule....

3. In the New Formatting Rule dialog box, select "Format only cells that contain" under
"Select a Rule Type" box in the upper part of the dialog box.
4. In the lower part of the dialog box under "Format Only Cells with section", set the rule
conditions. We choose to format only cells with a Cell Value - greater than - 3.7, as you can

see in the screenshot below.

Then click the Format... button to choose what background color to apply when the above
condition is met.

5. In the Format Cells dialog box, switch to the Fill tab and select the color of your choice, the
reddish color in our case, and click OK.

6. Now you are back to the New Formatting Rule window and the preview of your format
changes is displayed in the Preview box. If everything is Okay, click the OK button.

The result of your formatting will look similar to this:

Since we need to apply one more condition, i.e. change the background of cells with values
equal to or less than 3.45 to the green color, click the New Rule button again and repeat steps 3

- 6 setting the required condition. Here is the Preview of our second conditional formatting rule:

When you are done, click the OK button. What you have now is a nicely formatted table that lets
you see the highest and lowest gas prices across different states at a glance. Lucky they are in
Texas :)

Tip: You can use the same method to change the font color based on the cell's value. To do
this, simply switch to the Font tab in the Format Cells dialog box that we discussed in step 5 and
choose your preferred font color.

How to permanently change a cell's color based on its current value


Once set, the background color will not change no matter how the cell's contents might change
in the future.
Task: You want to color a cell based on its current value and wish the background color to
remain the same even when the cell value's changes.
Solution: Find all cells with a certain value or values using Excel's Find All function or Select
Special Cells add-in, and then change the format of found cells using the Format Cells feature.
This is one of those rare tasks that are not covered in Excel help files, forums and blogs and for
which there is no straightforward solution. And this is understandable, because this task is not
typical. And still, if you need to change the background color of cells statically i.e. once and
forever unless you change it manually again, proceed with the following steps.
Find and select all cells that meet a certain condition
There may be several possible scenarios depending on what kind of values you are looking for.

If you need to color cells with a particular value, e.g. 50, 100 or 3.4, go to
the Home tab, Editinggroup, and click Find Select > Find....

Enter the needed values and click the Find All button.

Tip: Click the Options button in the right-hand part of the Find and Replace dialog to get a
number of advanced search options, such as "Match Case" and "Match entire cell content". You
can use wildcard characters, such as an asterisk (*) to find any string of characters or a
question mark (?) to find any single character.

In our previous example, if we needed to find all gas prices between 3.7 and 3.799, we would
specify the following search criteria:

Now select any of the found items in the lower part of the Find and Replace dialog window by
clicking on it and then press Ctrl+A to select all found entries. After that click the Close button.

This is how you select all cells with a certain value(s) using the Find All function in Excel.
However, what we actually need is to find all gas prices higher than 3.7 and regrettably
Excel's Find and Replace dialog does not allow for such things.
Luckily, there is another tool that can handle such complex conditions. The Select Special
Cellsadd-in lets you find all values in a specified range, e.g. between -1 and 45, get the
maximum / minimum value in a column, row or range, find cells by font color, fill color and much

more.

You click the Select by Value button on the ribbon and then specify your search criteria on the
add-in's pane, in our example we are looking for values greater than 3.7. Click the Select button
and in a second you will have a result like this:

If you are interested to try the Select Special Cells add-in, you can download an evaluation
version here.

Change the background color of selected cells using "Format Cells" dialog
Now that all cells with a specified value or values are selected (either by using Excel's Find and
Replace or Select Special Cells add-in) what is left for you to do is force the background color of
selected cells to change when a value changes.
Open the Format Cells dialog by pressing Ctrl+1 (you can also right click any of selected cells
and choose "Format Cells..." from the pop-up menu, or go to Home tab > Cells
group > Format > Format Cells...) and make all format changes you want. We will choose to
change the background color in orange this time, just for a change :)

If you want to alter the background color only without any other format changes, then you can
simply click the Fill color button and choose the color to your liking.

Here is the result of our format changes in Excel:

Unlike the previous technique with conditional formatting, the background color set in this way
will never change again without your notice, no matter how the values change.
Change background color for special cells (blanks, with formula errors)
Like in the previous example, you can change the background color of special cells in two ways,
dynamically and statically.
Use Excel formula to change background color of special cells
A cell's color will change automatically based on the cell's value.
This method provides a solution that you will most likely need in 99% of cases, i.e. the
background color of cells will change according to the conditions you set.
We are going to use the gas prices table again as an example, but this time a couple of more
states are included and some cells are empty. See how you can detect those blank cells and
change their background color.

1. On the Home tab, in the Styles group, click Conditional Formatting > New Rule... (see step 2
of How to dynamically change a cell color based on value for step-by-step guidance).
2. In the "New Formatting Rule" dialog, select the option "Use a formula to determine which
cells to format". Then enter one of the following formulas in the "Format values where this
formula is true" field:

=IsBlank()- to change the background color of blank cells.


=IsError() - to change the background color of cells with formulas that return errors.
Since we are interested in changing the color of empty cells, enter the formula =IsBlank(), then
place the cursor between parentheses and click a range selection icon
in the right-hand part
of the window to select a range of cells, or you can type the range manually, e.g.
=IsBlank(B2:H12).

3. Click the Format... button and choose the needed background color on the Fill tab (for
detailed instructions, see step 5 of "How to dynamically change a cell color based on value")
and then clickOK.

The preview of your conditional formatting rule will look similar to this:

4. If you are happy with the color, click the OK button and you'll see the changes immediately
applied to your table.

Change the background color of special cells statically


Once changed, the background color will remain the same, regardless of the cell values'
changes.
If you want to change the color of blank cells or cells with formula errors permanently, follow this
way.
1. Select your table or a range and press F5 to open the "Go To" dialog, and then click the
"Special..." button.

2. In the "Go to Special" dialog box, check the Blanks radio button to select all empty cells.

If you want to highlight cells containing formulas with errors, choose Formulas > Errors. As
you can see in the screenshot above, a handful of other options are available to you.

3. And finally, change the background of selected cells, or make any other format
customizations using the "Format Cells" dialog as described in Changing the background of
selected cells.
Just remember that formatting changes made in this way will persist even if your blank cells get
filled with data or formula errors are corrected. Of course, it's hard to imagine off the top of the
head why someone may want to have it this way, may be just for historical purposes :)
How to get the most of Excel and make challenging tasks easy
As an active user of Microsoft Excel, you know that it has plenty of features. Some of them we
know and love, others are a complete mystery for an average user and various blogs, including
this one, are trying to shed at least some light on them. But! There are a few very common tasks
that all of us have to perform daily and Excel simply does not provide any features or tools to
automate them or make an inch easier.
For example, if you need to check 2 worksheets for duplicates or merge rows from single or
different spreadsheets, it would take a bunch of arcane formulas or macros and still there is no
guarantee you would get the accurate results.
That was the reason why a team of our best Excel developers designed and created 20+ addins that we call the Ultimate Suite for Excel. These smart tools handle the most grueling,
painstaking and error-prone tasks in Excel and ensure quickly, neatly and flawless results.
Below is a short list of just some of the tasks the add-ins can help you with:

Remove duplicates and find unique values


Merge tables and combine data from different sources
Combine duplicate rows into one
Merge cells, rows and columns
Find and replacing in all data, in all workbooks
Generate random numbers, passwords and custom lists
And much, much more.
Just give these add-ins a try (a fully-functional trial version is here) and you will see that your
usual Excel routines will take only a fraction of time they formerly did and your productivity
will increase up to 50%, at the very least!
If you like any of these tools, be sure to make use of the coupon code that we provide especially
for our blog readers: AB14-BlogSpoIt will give you the 15% discount on the Ultimate Suite or
any separate product.
*****
That's all for now. In my next article we will continue to explore this topic further and you will see
how you can quickly change the background color of a row based on a cell value. Hope to see
you on our blog next week.

How to merge two columns in Excel without losing data


From this short article you will learn how to merge multiple Excel columns into one without
losing data.
You have a table in Excel and what you want is to combine two columns, row-by-row, into one.
For example, you want to merge the First Name & Last Name columns into one, or join several
columns such as Street, City, Zip, State into a single "Address" column, separating the values
with a comma so that you can print the addresses on envelops later.

Regrettably, Excel does not provide any built-in tool to achieve this. Of course, there is
the Mergebutton ("Merge & Center" etc.), but if you select 2 adjacent cells in order to combine
them, as shown in the screenshot:

You will get the error message "Merging cells only keeps the upper-left cell value, and discards
the other values." (Excel 2013) or "The selection contains multiple data values. Merging into one
cell will keep the upper-left most data only." (Excel 2010, 2007)

Further in this article, you will find 3 ways that will let you merge data from several columns into
one without losing data, and without using VBA macro. If you are looking for the fastest way,
skip the first two, and head over to the 3rd straight away.

Merge two columns using formulas

Combine columns data via NotePad

The fastest way to join multiple columns


Merge two columns using Excel formulas
Say, you have a table with your clients' information and you want to combine two
columns (First & Last names) into one (Full Name).
1. Insert a new column into your table. Place the mouse pointer in the column header (it is
columnD in our case), right click the mouse and choose "Insert" from the context menu. Let's
name the newly added column "Full Name".

2. In cell D2, write the following formula: =CONCATENATE(B2," ",C2)


B2 and C2 are the addresses of First Name and Last Name, respectively. Note that there is a
space between the quotation marks " " in the formula. It is a separator that will be inserted

between the merged names, you can use any other symbol as a separator, e.g. a comma.

In a similar fashion, you can join data from several cells into one, using any separator of your
choice. For instance, you can combine addresses from 3 columns (Street, City, Zip) into one.

3. Copy the formula to all other cells of the Full Name column. For step-by-step instructions
please see how to enter the same formula into all selected cells at a time.
4. Well, we have combined the names from 2 columns in to one, but this is still the formula. If
we delete the First name and /or the Last name, the corresponding data in the Full Name
column will also be gone.

5. Now we need to convert the formula to a value so that we can remove unneeded columns
form our Excel worksheet. Select all cells with data in the merged column (select the first cell in
the "Full Name" column, and then press
Ctrl+Shift+ArrowDown).
Copy the contents of the column to clipboard (Ctrl + C or Ctrl + Ins, whichever you prefer), then
right click on any cell in the same column ("Full Name" ) and select "Paste Special" from the

context menu. Select the "Values" radio button and click OK.

6. Remove the "First Name" & "Last Name" columns, which are not needed any longer. Click
the column B header, press and hold Ctrl and click the column C header (an alternative way is
to select any cell in column B, press Ctrl + Space to select the entire column B, then press Ctrl +
Shift + ArrowRight to select the whole column C).
After that right click on any of the selected columns and choose Delete from the context menu:

Fine, we have merged the names from 2 columns into one! Though, it required quite a lot of
effort and time :(

Combine columns data via Notepad


This way is faster than the previous one, it doesn't require formulas, but it is suitable only for
combining adjacent columns and using the same delimiter for all of them.
Here is an example: we want to combine 2 columns with the First Names and Last Names into
one
1. Select both columns we want to merge: click on B1, press Shift + ArrrowRight to select C1,
then press Ctrl + Shift + ArrowDown to select all the cells with data in two columns.

2. Copy data to clipboard (press Ctrl + C or Ctrl + Ins, whichever you prefer).
3. Open Notepad: Start-> All Programs -> Accessories -> Notepad.

4. Insert data from the clipboard to the Notepad (Press Ctrl + V or Shift + Ins)

5. Copy tab character to clipboard. Press Tab right in Notepad, press Ctrl + Shift + LeftArrow,
then press Ctrl + X.
6. Replace Tab characters in Notepad with the separator you need.
Press Ctrl + H to open the "Replace" dialog box, paste the Tab character from the clipboard in
the "Find what" field, type your separator, eg. Space, comma etc. in the "Replace with" field.
Press the "Replace All" button; then press "Cancel" to close the dialog box.

7. Press Ctr + A to select all the text in Notepad, then press Ctrl + C to copy it to Clipboard.

8. Switch back to your Excel worksheet (press Alt + Tab), select just B1 cell and paste text from
the Clipboard to your table.

9. Rename column B to "Full Name" and delete the "Last name" column.
There are more steps than in the previous option, but believe me or try it yourself, this way is
faster. The next way is even faster and easier :)
Join columns using the Merge Cells add-in for Excel
The quickest and easiest way to combine data from several Excel columns into one is to
useMerge Cells add-in for Excel.
With the Merge Cells add-in you can combine data from several cells using any separator you
like (e.g.: carriage return or line break). You can join values row by row, column by column or
merge data from the selected cells into one without losing it.
How to combine two columns in 3 simple steps
0. Download and install Merge Cells for Excel.

1. Select all cells from 2 columns that you want to merge, and go to the "Ablebits.com Data" tab.
Click the "Merge cells" button to run the add-in.

2. Select the following options on the Merge Cells dialog box:

Merge selected cells: row by row.

Separate values with: [Space].

Place the results to: Left cell.

Tick the "Clear the contents of selected cells" checkbox.

Now just click the "Merge" button.

3. Several simple clicks and we've got two columns merged without entering any formulas or
copy/pasting.

To finish up, rename column B to "Full Name" and delete column "C", which is not needed any
longer.
Much easier than the two previous ways, isn't it? :)
You may also be interested in:
How to merge rows in Excel 2010 and 2013 without losing data

You might also like