Fortunately Excel provides a variety of methods to group time depending on what you need. In this blog post we look at 4 ways to group times using PivotTables and Excel formulas.

PivotTables make it very easy to group numeric data such as dates and times including grouping time by the hour.

If you have a list of times, simply drag the time column into the Rows area of the PivotTable.

In Excel 2016, the PivotTable automatically groups it by the hour, minute and second. Previous versions do not, but have the same options.

Group a time field by right mouse clicking on a cell containing a time and select **Group**. Then choose the group options you want.

PivotTables are great, but they cannot help if you want to group time into specific intervals such as every 30 minutes, or every 4 hours.

In this video the FLOOR function is used to group time into 6 hour intervals, each quarter of the day.

We then create a PivotTable and use these intervals as a label in the report.

The FLOOR function will always round down to a multiple that you specify. If you need to round to the nearest multiple, it is not good enough.

Say for example that you want to round to the nearest 15 minutes. So a time of 00:18:30 should be rounded down to 00:15:00, but a time of 00:22:40 should round up to 00:30:00.

For this we can use the MROUND function of Excel. This function will round a value to the nearest multiple that you specify, which in this example is 15 minutes.

In the final example we look at using the VLOOKUP function to group time into irregular intervals.

In this video to day is split into morning, day, evening and night. However these parts of the day are not specific intervals such as every 6 hours. The morning is 5 hours between 06:00 and 11:00, then the daytime is 6 hours between 11:00 and 17:00 etc.

These intervals are set by creating a lookup table. A VLOOKUP is then set up to do an approximate match (range lookup) for each time within this table.

- Count how many times a specific character appears
- Formula to match records on different worksheets
- 5 awesome date functions
- Convert text into a date format

]]>

It is called the Immediate Window because you can ask questions about your code, run statements and get immediate results. This can help us to understand what our macro is doing, and why and where it may be going wrong.

Watch the video tutorial below, or continue reading the full tutorial.

First of all, we need to view the Immediate Window. From the Visual Basic Editor window, click the **View** menu and then **Immediate Window**, or press **Ctrl + G** on the keyboard.

The Immediate Window appears at the bottom of the screen, below the Code Window by default. This can however, be moved and resized as you wish.

Probably the most common way people use the Immediate Window, is to ask your macro questions.

To do this, you start the Immediate Window statement with a question mark (?).

For example, if you want to know how many worksheets in the active workbook you could enter.

?Activeworkbook.Worksheets.Count

The ability to question your macro is very useful in large macros and when stepping through the code.

At any point, asking a question to get feedback on the current status of an object such as how many sheets the currently active workbook has, or the name of the current sheet can help to diagnose issues and understand complicated sections of code.

To find the name of the current sheet you would enter.

?Activesheet.Name

The image below shows these statements being used in the Immediate Window.

Another reason to use the Immediate Window is to print information to it. So when the macro is running it writes into the Immediate Window.

This can help us see what is happening at specific points in the code.

In the example below we have a basic macro that is looping through the sheets of a workbook. And maybe we want to double check that the code works, and it is successfully activating each sheet of the workbook.

The following line of code is added into the appropriate point of the macro so that information is printed to the Immediate Window.

Debug.Print sht.Name

This information is printed when the macro is run, or when you step through the macro.

A lot of people use message boxes to report the current status of variables, and objects while the macro runs. But message boxes need to be closed each time and interfere with the running of the macro.

By printing into the Immediate Window you avoid that interference and can focus on debugging your code.

You even execute code statements within the Immediate Window.

This could be a helpful way of checking your syntax, without embedding it within your macro and having to step through it.

It also enables you to perform an action while you step through a macro. You could use this to test your macros reaction to a statement you enter.

For example, if you simply enter the line below into the Immediate window and press Enter it would protect the active worksheet.

Activesheet.Protect

And this statement would change the name of the active worksheet to the value of cell A1.

Activesheet.Name = Range("A1").value

One of the key fundamental skills in Excel VBA is to be able to work with variables. The Immediate Window can be a huge help here as it enables us to test, and even change, the variables during the execution of the macro.

When debugging a macro it is extremely useful to be able to see what our variables are doing at different stages of the code.

There are a few ways we can do this in Excel VBA including the brilliant Locals Window, but the Immediate Window takes it a step further by allowing us to change the variables value.

The macro in the image below is a simply one to remove the blank rows from a list. A variable named *r* is used to store the current row in the loop.

In the Immediate Window while stepping through the code we tested the current value of the *r* variable by typing the line below.

?r

We then entered the following line to change the value of *r* to 13. This was done so that we could skip rows that we did not want to test.

r=13

We saw that the Immediate Window can be used to execute code statements earlier. It can also be used to run other macros.

We can obviously run macros using buttons in the Excel environment, or by using the View Macros window to name just two ways.

However by running the macros using these methods you are not given the opportunity to provide the macro with the parameters it may need.

Take this basic macro example below. It changes the fill colour of a cell using the colour provided as a parameter (referred to as *lColour* here).

Sub ChangeColour(lColor As Long) ActiveCell.Interior.Color = lColor End Sub

Entering the line below in the Immediate Window will run the *ChangeColour* macro and use the index number for a shade of blue as the parameter.

ChangeColour(15123099)

This enables me to check the macro functionality independently before it is used within larger macro projects.

- 6 Ways to find the last row of a list in Excel VBA
- Email an Excel workbook as an attachment – Excel macro
- Macro to export all sheets as PDF

]]>

In this blog post we explore 4 Excel MOD function examples. Hopefully this will help to see how versatile this function can be.

To start we better have a quick introduction to how to use the MOD function. It looks like this;

=MOD(number, divisor)

You need to provide it first with the number you want to divide, and then the number you want to divide it by (divisor).

You can see some basic examples of this below.

Ok, lets get on with some more impressive **real-world MOD function examples**.

Here is the video tutorial of the examples explained below.

Excel stores dates and times as a number. The time is the fractional part of that number.

For example, the date and time 06/07/2017 10:15 is stored in Excel as 42922.42708.

Now this does not mean anything to us, but to extract the time part only of .42708 we could use the MOD function and then format the result as time to make sense to us.

The MOD function would be used to divide the number (date and time value) by 1. As this would leave the fractional part as the remainder.

In the example below the following formula was used to extract the time result.

=MOD(A2,1)

This calculation was used in my tutorial to calculate the time elapsed in days, hours and minutes.

Another clever example of the MOD function may be to stop the entry of odd numbers in a range.

If a number is an even number, a remainder of 0 would be returned when divided by 2.

It stands to reason then that odd numbers would return a different remainder. We could use this understanding to insert the MOD function into a Data Validation rule.

Select the range of cells you want to apply the validation rule to. Click **Data** > **Data Validation**.

Select **Custom** from the Allow list and enter the formula below into the box provided.

=MOD(A2,2)=0

In this formula, cell A2 is the first cell of the range that you selected. This formula ensures that only values that return a remainder of 0 when divided by 2 are allowed.

In my online course on how to create automated sports league tables and tournaments in Excel, I have a section on calculating cricket statistics and league tables.

This example comes from that course. We have cells containing the number of overs bowled, but we want to see how many balls is this.

For those who don’t follow cricket. There are 6 balls per over bowled. So if a bowler has made 6.2 overs. They have done 6 overs of 6 balls each and then 2 more balls.

In the spreadsheet below the number of overs is in column B and then the following formula was used in C.

=INT(B3)*6+MOD(B3,1)*10

This formula used the INT function to extract the integer part of column B and multiplies it by 6 to calculate the total balls bowled.

Then the MOD function is used to extract the fractional part (.2 in B3) by dividing it by 1. This is then multiplied by 10 to convert 0.2 to 2. The two parts of the formula are then added together.

For the final example, we will use the MOD function to help us sum every third cell in a range. This formula can be adapted to sum every other cell, or every fifth cell, or whatever you may need.

This formula uses the impressive SUMPRODUCT function, a favourite of mine.

The formula below uses the ROW function to return the row number of the cell reference starting with B3. A 2 is then subtracted from this because the range starts from row 3. So row 3 is actually row 1 of the range.

The MOD function is then used to divide this number by 3. If the number is divisible by 3 then it must be a multiple of 3.

The number that meet this test in range B3:B11 are then summed.

=SUMPRODUCT((MOD(ROW($B$3:$B$11)-2,3)=0)*($B$3:$B$11))

For this example we have a list of the Ballon d’or winners of all time. Column B contains 3 letters in uppercase (after the name) which identify the country that the player represented at the time of winning the award.

In cell E1 I have entered the 3 digits for a country. I would like to automatically change the colour of all the cells that contain the country written in E1.

There is a good chance that the 3 digits identifying a country could also occur in a players name. For example, the letters for France – FRA do occur in the name Franz Beckenbauer.

To prevent this happening we will match the case of the word we are searching for, as it is always written in upper case.

You can watch the video tutorial of this lesson below.

To achieve this we need to write a formula in a Conditional Formatting rule. The formula will identify if the country code occurs, then Conditional Formatting will highlight the cell.

Firstly we need to start a Conditional Formatting rule;

- Select the Cells that you wish to format.
- Click
**Home**>**Conditional Formatting**and then**New Rule**. - Select the
**Write a formula to determine which cells to format**option. - The formula below is then used in the box provided.

=ISNUMBER(FIND($E$1,B2))

- Click the
**Format**button and choose the formatting you want.

In this formula, the FIND function is used to search for the word in E1 in the cells of column B.

If a cell does contain the word, the FIND function returns a number specifying the position of the word in that cell. And if the word is not found #VALUE! is returned.

A number is not very helpful to us, so the ISNUMBER function is used to return TRUE if a number is returned and FALSE if not.

The Conditional Formatting rule will then run if TRUE.

- Two Essential Conditional Formatting Tricks
- Applying Conditional Formatting to Excel Charts
- Techniques to Separate Text into Different Cells
- Count the Occurrences of a Character in a Cell

]]>

The purpose of VLOOKUP is to look for a value and return some information about that value. Although quite specific in its role, this function can be used in some very clever and interesting ways.

For anyone reading this who may be quite new to VLOOKUP, lets have a quick look at its structure.

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

**Lookup Value** – The value you want to look for.

**Table Array** – The table containing the value to look for and value to return.

**Col Index Num** – The column number of the Table Array containing the value to return.

**Range Lookup** – Optional argument. To specify whether an approximate or exact match on the Lookup Value is needed.

For more information on how to use VLOOKUP, check out the Ultimate VLOOKUP guide.

If you would prefer to watch the video, or simply watch it whilst you refer to the formulas in this tutorial. You can do so below.

This is one of the more common reasons to use the VLOOKUP function. You can create a lookup table and automate data entry by getting VLOOKUP to fetch it for you.

In this simple example we have a travel expense spreadsheet. Someone regularly travels to five different offices. They enter where they went, and need VLOOKUP to return the miles for that office from a table.

The VLOOKUP formula below has been used in cell B3.

=VLOOKUP(A3,$F$2:$G$6,2,FALSE)

VLOOKUP can be a great alternative to complex nested IFS and formulas that contain IF and AND to handle their complex logic.

Take this example where the size of the discount increases the higher the quantity you order.

The quantity required and discount qualified for can be seen in columns F and G. Without VLOOKUP this could be a sizeable formula.

The following VLOOKUP formula is used in cell C2. It uses an approximate lookup, otherwise known as a range lookup, to return the correct discount depending on where the value sits in the ranges of column F.

The TRUE on the end of VLOOKUP is specifying to perform a range lookup.

=VLOOKUP(A2,$F$2:$G$7,2,TRUE)

A very impressive way to use VLOOKUP is on your reports and dashboards to make your charts and visualisations dynamic.

Lets say you had three tables of sales data like below. As you can see, these are sales of product categories in Canada, Denmark and France.

You have one chart and you would like the user to select which countries data to view from a drop down list.

Well in the image below the drop down list is in cell D2. When the user selects a country from the list, the VLOOKUP’s in column B return the correct data.

Here is the VLOOKUP formula from cell B3;

=VLOOKUP(A3,INDIRECT($D$2),2,FALSE)

The three tables of data have each been named using the countries name. The INDIRECT function has then been used in VLOOKUP to refer to that table from the users list selection.

A very common task for Excel users is to compare lists, and VLOOKUP can help here too.

In this basic example below we have two lists of fruit. A VLOOKUP function has been used in a Conditional Formatting rule to identify the fruit that appears in the first list, but not the second.

The formula below was used in the Conditional Formatting rule.

=ISNA(VLOOKUP($A2,$C$2:$C$8,1,FALSE))

It uses VLOOKUP to look for the item of fruit from the first list in the second. The ISNA function then reports TRUE if the fruit is not found.

To apply the Conditional Formatting rule;

- Select the range of cells to format. In this example it was A2:A7.
- Click
**Home**>**Conditional Formatting**>**New Rule**. - Select
**Use a formula to determine which cells to format**and then enter the formula in the box provided, and click the Format button to select your formatting options.

This blog post explores some examples of using **wildcard characters in formulas** to find, sum or count cells containing partial matches to what we are searching for.

If you prefer a video tutorial then check it out below, otherwise please continue for the written tutorial.

Before we look at some examples of wildcards in formulas, we should discuss the three types of wildcard characters you can use in Excel.

*** (asterisk)**– represents any number of characters. For example,*In**could mean India, Indonesia, Indianapolis, Innsbruck.**? (question mark)**– represents one single character. For example,*L?ndon*could mean London, or Landon.**~ (tilde)**– used to identify a wildcard character in the text. For example, if you wanted to find the exact phrase**London*in the text, you would enter*~*London*. Otherwise all entries ending with the word London would be returned because of the asterisk wildcard.

I assume we are all big fans of VLOOKUP. The most well known lookup function of Excel. But did you know that by using wildcard characters you can create a partial text match with VLOOKUP?

The following formula has been used in cell E3. The ampersand (&) has been used to concatenate the location in cell D3 with the asterisk wildcard. So this VLOOKUP will find the first value that begins with the text in D3.

Sometimes you do not know, or in this case do not need to know the full name of what you are looking for, and a partial match in itself is unique.

=VLOOKUP(D3&"*",$A$2:$B$10,2,FALSE)

Learn more in our Ultimate Guide to VLOOKUP.

The COUNTIF and SUMIF functions of Excel are also two of its most commonly used functions. It makes sense therefore that wildcards can be used with them.

In the example below we have a list of invoices and amounts. The first two characters of each invoice determine the sales rep involved.

We do not care about the exact invoice number right now. Just as long as the first two characters match the sales rep I am reporting on, then fantastic.

This COUNTIF function was used in cell E3 to calculate the number of orders by the sales rep SJ. In similar fashion to the preceding VLOOKUP example, cell D3 and the asterisk character are joined to create the criteria.

=COUNTIF(A2:A11,D3&"*")

This SUMIF function was then used in cell F3 to total the orders for SJ, or whatever sales rep is entered into D3.

=SUMIF(A2:A11,D3&"*",B2:B11)

In this example, we imagine a list of invoice numbers which should all be 6 characters in length. We want to test the range of invoice numbers to check if there are any inconsistencies.

The formula below uses a COUNTIF function and the question mark wildcard. By entering 6 question marks in a string we are counting the cells containing exactly 6 characters.

The answer in cell C2 is 7 indicating that there must be 3 that do not meet that criteria. Can you see them? Well in the next example we will get Conditional Formatting to highlight them.

=COUNTIF(A2:A11,"??????")

This formula can be added into a Conditional Formatting rule to identify the cells containing the incorrect text length.

The formula below has been used. It is slightly different to the COUNTIF in the previous example.

=COUNTIF(A2,"<>??????")

Because it is part of a Conditional Formatting rule, it only references the single cell (A2). This is the first cell of the range. The formatting is applied to the entire range of cells, but in the formula you reference just a single cell.

If you are not familiar with the “<>” symbol, that is the NOT operator. It has been included in the string with the six question marks. So this rule will format all the cells that do not have 6 characters.

Wildcard characters can be used in more functions that what I have demonstrated here. Using them with IF, FIND and SUBSTITUTE can be useful also.

If you can perform formulas on the full content of a cell that fantastic, but when you do not know the full content, wildcards do a great job of stepping up to the plate.

- Excel formula to display the sheet name in a cell
- Find the least frequent value in a list
- Prevent formulas from showing in the formula bar
- Pick a name at random from a list

]]>

The SUMPRODUCT function is powerful, versatile and expansive. It is the go to function when looking for an alternative to array formulas.

If you are a newbie – check out our SUMPRODUCT function guide to get an understanding of how it works.

**Ok, are you ready to rock on with these 5 awesome SUMPRODUCT examples?**

Let’s do this.

If you prefer to watch videos, check out this video covering the tutorials from this blog post.

In the first example, we will use the SUMPRODUCT function to return the count and sum of the values from a specific month.

In this example the formula below has been entered into cell E3 to count the values for the month specified in cell D3.

=SUMPRODUCT(--(MONTH($A$2:$A$12)=$D$3))

The MONTH function has been used to extract the month from the each date in the range. This is then tested to see if it is equal to the month we want to count.

The double hyphens ‘–‘ are used to convert the true and false responses of this logical test to 1 and 0. The SUMPRODUCT then sums these 1’s and 0’s to return the answer.

The formula below has then be entered into cell F3 to return the total sales value for that month.

=SUMPRODUCT(--(MONTH($A$2:$A$12)=$D$3),B2:B12)

For this we just needed to add a comma and then the range of cells containing the sales values.

This works because the SUMPRODUCT function multiplies the 1’s and 0’s from month test by these sales values. And then these results are all summed.

This example can be very useful if you have to analyse comments, feedback or SEO keyword data. In these situations you will have large volumes of text and you may be looking for the occurrence of specific words.

In this example, the SUMPRODUCT formula has been used in cell D2 to count all the occurrences of words entered in cell C2.

=SUMPRODUCT(--(ISNUMBER(FIND(C2,A2:A9))))

In this formula the FIND function searches for the words in each cell. If the words are found then FIND returns its starting position, and if not it returns and error value.

The ISNUMBER function will then return true if a number is returned, or false if not. The double hyphens are then used just like the previous example to convert the true and false to 1 and 0.

The 1’s and 0’s are then summed by SUMPRODUCT to return the final count.

The SUMPRODUCT function can also be used to perform a unique count of values in a range.

Being able to count how many orders and how many training sessions is great. But sometimes you need to know how many different customers placed orders, and how many different training sessions. Then you need a unique count.

The formula below performs a unique count on range A2:A10.

=SUMPRODUCT(1/COUNTIF(A2:A10,A2:A10))

For this to work the COUNTIF function counts the occurrences for each name in the list producing the below. This says that Robert occurs twice, James once and Sally three times etc.

=SUMPRODUCT(1/{2;1;3;2;1;1;3;1;3})

These values are then divided by the 1 producing the below.

=SUMPRODUCT({0.5;1;0.33;0.5;1;1;0.33;1;0.33})

And then SUMPRODUCT sums them all up delivering the unique count.

How about summing only the top values from a range. Yes SUMPRODUCT can do this.

In this example we sum only the top 3 values, but this can easily be adapted to top 5, top 10 or whatever you wish.

The formula below sums only the top 3 values in range B2:B12.

=SUMPRODUCT(LARGE(B2:B12,{1,2,3}))

This formula uses the LARGE function with SUMPRODUCT. The LARGE function is used to return kth largest value in a data set, such as the 5th largest.

In this example we have provided the LARGE function with an array of {1, 2, 3} so that it returns the top 3. The SUMPRODUCT then sums them.

This is all in the beauty of the SUMPRODUCT formula handling arrays of data.

If you need to sum the values from the bottom of the range you can use the SMALL function.

In the final example we see the SUMPRODUCT formula performing a two way lookup.

You may have created two way lookups before in the past. The most common way to do this is to use the INDEX and MATCH function combination.

The formula below performs a two way lookup. It looks for the value of cell B1 down column A, and the value in cell D1 along row 3. It returns the value at the intersection, which in the image is £246.

=SUMPRODUCT((A4:A13=B1)*(A3:M3=D1),A4:M13)

The asterisk (*) is used as an AND operator in this formula. And the second array is the range to return the value from i.e. A4:M13.

The SUMPRODUCT function is so incredibly versatile we could be listing far more examples in this tutorial. For example it can also sum the values from every nth row of a list.

What have you used it for?

- Use the MID and FIND functions to extract text
- 5 awesome uses of the INDIRECT function
- 4 amazing uses of CONCATENATE
- How to use the TEXT function of Excel

]]>

Prefer to watch the video? The video tutorial below will demonstrate all 5 INDIRECT function examples.

Before I delve into these different INDIRECT examples, I should quickly what it is for those of you who may be new to the function.

INDIRECT is one of the lookup functions of Excel. And it’s purpose is to return a reference which is specified by a piece of text (typically some text in the cell of a worksheet).

This become really useful when you concatenate that information together with others to form a reference to a different sheet, particular cell or named range. You will see these in the tutorials.

The INDIRECT function looks like below.

=INDIRECT(ref_text, [A1])

The *ref_text* is a reference to a cell that contains, or partially contains, an address.

The *A1* argument is optional. It determines the type of reference for INDIRECT to use. If you type True then the normal A1 style is used. If you type False then the R1C1 style is used.

Ok, lets get stuck into these tutorials.

A great use for INDIRECT is with named ranges. The concept of naming ranges for simpler referencing has huge benefits, and when you understand INDIRECT those benefits are amplified.

Check out this tutorial if you are new to naming ranges in Excel.

In the example below, cell G4 contains the total for the sales of the region mentioned in F4. In this image it is for Cardiff.

This total was achieved using the formula below.

=SUM(INDIRECT(F4))

Each range of values has been named after the region. For example range D3:D10 is named *Cardiff*, and range B3:B10 is named *Southampton*.

The INDIRECT function returns the value from F4. This value is then converted from text to a reference so that the SUM function can add the values from the named range.

Without INDIRECT the SUM function would not use the value in F4 as a reference to the named range.

In this example, we want to reference a different worksheet within a formula, which is another SUM function. The worksheet we are summing values from is dependent upon the value in a cell. So once again INDIRECT is needed.

The image below shows the summary sheet, and cell B3 contains the name of the sheet that we will be summing from. The beauty of this technique is that if someone changes the value in cell B3, it then sums from that sheet.

The formula below has been used in this example. In each sheet the values to be summed are in range C4:C11.

=SUM(INDIRECT("'"&B3&"'!C4:C11"))

The apostrophes have been used in the formula to enclose the sheet name. If a sheet name contains spaces such as *South Africa*, apostrophes are required.

In this example we will look at using an R1C1 style reference with INDIRECT to return the last value from a row.

In the image below the formula in cell F3 is returning the last value in row 10. This ensures that as new months (columns) are added to the table, it always retrieves the current months value.

The formula below has been used in cell F3. By using an R1C1 reference style instead of the traditional A1 style, we can refer to the column numerically. The COUNTA function has been used here to count the non blank cells of row 10, therefore returning the last column.

=INDIRECT("R10C"&COUNTA(10:10),FALSE)

This is concatenated onto the *R10C* part to complete the reference as row 10 and column 4.

The FALSE part of the INDIRECT formula requests the R1C1 style reference.

It feels necessary to include an example of using INDIRECT with the VLOOKUP function. For this example INDIRECT will be used to create a conditional lookup table.

In the image below a VLOOKUP function has been entered into cell B3 to return the sales value for *Jessica* (B1) and *Cardiff* (B2).

Each table has been named appropriately as *Southampton*, *Liverpool* and *Cardiff*. Just like in the first example of this blog post, INDIRECT has been used to convert the value of cell B2, to a reference to a named range.

The formula below is the VLOOKUP used. The table array is specified by changing the value in cell B2.

=VLOOKUP(B1,INDIRECT(B2),2,FALSE)

Another brilliant use of INDIRECT is to create dependent drop down lists. This is a great technique if you work with large lists.

You can break the large list up into multiple smaller lists and then make them dependent on one another. So the selection from one list would determine what options appear in the next list.

This demonstration also uses named ranges as a clever way of referencing different lists. Check out the video below to see how it is done.

Check out this video on how to create multiple dependent drop down lists.

If any of these INDIRECT examples are not clear, check out the video at the top of this blog post which will show you exactly how each formula is done.

- 4 Amazing Tips for the CONCATENATE Function
- Unleash the Power of the CELL Function of Excel
- Prevent Formulas from Showing in the Formula Bar

]]>

In this tutorial we will use a list of 87 names that as we type into the drop down list, it searches the names, and the list shortens to show only those names containing that string of characters.

There are a few formulas to write to get this done. Everything is shown and provided in this tutorial. If you prefer a video. Check out the video tutorial below.

The drop down list used here is the combo box control. It is not a Data Validation list. So the first task is to insert a combo box control where you want the list to be.

- Click the
**Developer**tab on the Ribbon (don’t have a Developer tab? Right click the Ribbon, select Customise the Ribbon and check the Developer on the right). - Click the
**Insert**button in the Controls group and select the**Combo Box (ActiveX Control)**.

- Click and drag to draw this control onto the worksheet. You can always move and resize the control later, so don’t worry about 100% accuracy.
- Now we need to link the combo box value to a cell. After inserting the combo box, you should already be in design mode. Click the
**Properties**button on the Developer tab. If this is not active, click the**Design Mode**button and then**Properties**. - The Properties window appears. In the
**LinkedCell**property, type the cell address of the cell you want the combo box linked to.

- Let’s check out what we currently have. Click the
**Design Mode**button to exit design mode. Type into the combo box and you should see the value appearing in the cell you linked it to.

To be able to create this searchable list, the first formula will need to identify which names meet the criteria and should continue to appear in the list when the user is typing.

To identify the names that contain the characters being searched for, we will use an Excel function with a very appropriate name – the SEARCH function.

The SEARCH function below can be used.

=SEARCH($G$1,A2)

In this function, cell $G$1 is the cell that the combo box is linked to. So this contains the string of characters that we are looking for. Cell A2 is the first name in the list of names.

This function will return the *#VALUE!* error if a name does not contain the characters typed, and returns the first occurrence of those characters if it does.

In the image below you can see that the characters being searched occur in the fifth position of the names in A2 and A3, in position 1 of A6 and not at all in the other cells.

Now this is what we need. We now know which names should be appearing in the final drop down list while users are searching.

However, I don’t like the *#VALUE!* error and I’m not really interested in what position the characters are in. I just need to know that they are there.

The ISNUMBER function can then be added to the SEARCH function so that it returns TRUE or FALSE when a name is identified or not. The double negative is then added before the ISNUMBER function to convert the TRUE or FALSE to 1 or 0.

=--ISNUMBER(SEARCH($G$1,A2))

The next formula needs to count how many names in the list contain the characters being searched for.

This is important to create the dynamic aspect of the searchable drop down list. As characters are typed the list should shrink, and then expand again when the characters are deleted.

The COUNTIF function is used here to count the occurrences of names being returned. This function uses a reference to the ‘IF Found’ column in B. It has a fixed start point of $B$2, but a relative row number on the end point $B2. This ensures that the reference gets bigger as the formula is copied down.

It is counting how many times a 1 occurs in the range up to the point of the current row.

COUNTIF($B$2:$B2,1)

An IF function can then be added to it so that it only performs the COUNTIF, if the cell contains a 1, otherwise show blank in the cell.

=IF(B2=1,COUNTIF($B$2:$B2,1),"")

We now know which names should be appearing in the list, and we also know how many there are.

Next step is to create a range of cells containing these names only. A drop down list can then use this range of cells.

To lookup these names we can use the amazing INDEX and MATCH function combination.

=INDEX($A$2:$A$88,MATCH(ROWS($C$2:$C2),$C$2:$C$88,0))

The INDEX function is used here to return a name from the range A2:A88 from the row specified by the MATCH function.

The ROWS function is used to return the current row number. So for the first name in the list it is row 1 of that range. The second name is row 2 and so on. This works to provide MATCH with the current name we are looking for (1st, 2nd etc).

The MATCH function then looks for this number in range C2:C88. It reports back to INDEX with the names position, and INDEX extracts the name.

The IFERROR function can then be added to this so that the cell contains blank if there are no more names to look for.

=IFERROR(INDEX($A$2:$A$88,MATCH(ROWS($C$2:$C2),$C$2:$C$88,0)),"")

Now that we have the returned names, we need an easy way of referring to them. For this we will create a named range. This will need to be dynamic and detect how many names are returned. The combo box will then use this named range for its list.

Click the **Formulas** tab on the Ribbon and then **Define Name**. Enter a name for the range (I named it *employees*) and then enter the formula like below into the **Refers to** field.

=$D$2:INDEX($D$2:$D$88,COUNTIF($D$2:$D$88,"?*"))

To __create the dynamic named range__ we used the INDEX function with COUNTIF. The INDEX function is capable of returning a value or a reference and in this scenario we need it for the latter.

The dynamic range starts from $D$2 and then the COUNTIF function is used to locate the last name in the list for the INDEX function. The “?*” is used as the criteria to count the number of cells containing text.

Now that we have the searchable list of names in a column and the range has been named. The combo box needs to be told to use this named range as its source.

- Click the
**Developer**tab on the Ribbon and then the**Design Mode**button. - Now we are in design mode, click on the combo box control and then click the
**Properties**button. - Type the name that you gave your named range into the
**ListFillRange**field.

- Close the properties window.

The final step is to make sure the list drops down when somebody types into it. At the moment someone could click the list arrow to drop it down, but if they type, no list appears.

- Double click on the combo box (you need to still be in design mode for this).
- This will take you to a code window to enter a tiny piece of VBA code. Type the line below in between the
*Private Sub*and*End Sub*lines.

Private Sub ComboBox1_Change() ComboBox1.DropDown End Sub

Adjust the *Combobox1* part to the name of your combo box.

If you are interested in learning VBA then check out our Excel VBA online course. It is a fantastic skill to have if you are a heavy Excel user.

Exit design mode and test out your combo box. You should now have a searchable drop down list to use on your Excel reports, dashboards and forms. Everyone will be asking how you did it.

**Why would you want to group worksheets?**

By grouping worksheets you can make the same change to multiple worksheets at the same time. This can be a formatting change, a structural change such as inserting a row, or even a formula.

A group can consist of one or more sheets. Once the sheets are grouped, perform the actions you want on the active sheet and those actions are replicated on the other sheets of the group.

- Click on the first sheet you want in the group, then hold down the
**Ctrl**key and select the other sheets. If the sheet tabs are contiguous you can hold**Shift**and click the first and last sheets of the group. - You can now perform whatever actions you want on the grouped sheets. In the video below I demonstrate writing a formula, formatting some cells and also formatting the sheet tabs.

When the sheets of a workbook are grouped, Excel displays [Group] next to the workbook name in the Title bar. This serves as a constant reminder of the grouped status. Some Excel functionality does not work when sheets are grouped.

To ungroup the worksheets, either click on any sheet tab that is not in the group, or right mouse click a sheet tab and select **Ungroup** sheets.

If you want to group all of the sheets of a workbook, right mouse click a sheet tab and select **Group All Sheets**.

Want to see what grouping worksheets can do for you. Check out the video below.