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.

The example below is a typical example of CONCATENATE. In this example, it is being used to join the first name and last name and insert a space in between. The formula below is written in cell C2.

=CONCATENATE(A2,” “,B2)

This blog post uncovers **4 amazing tips to take your CONCATENATE functions to the next level**.

If you are joining large amounts of text then you may need to wrap it on multiple lines. This is a common technique with text in Excel because excessively wide column can make tables awkward.

To do this with the CONCATENATE function, you must first apply text wrapping to the cells. This alone though will not wrap the text of a formula.

To wrap the text of the CONCATENATE function we need to insert line breaks. And because this is a formula that will require a function.

The function for the job is CHAR. This function will return a character specified by a code from the computer. We need a line break so need to know the code for that. You can find these codes by searching online. For a line break we need code 10.

This CHAR function can be nested within CONCATENATE like below.

=CONCATENATE(A2,CHAR(10),B2,CHAR(10),C2,CHAR(10),D2)

The result of the above formula is shown below.

The Ampersand (&) can also be used to join text as a simple alternative to the CONCATENATE function. The example below joins the first name and last name again with a space in between.

=A2&” “&B2

The TEXT function can be used with CONCATENATE to brilliant effect.

The TEXT function will convert a number to text, but display it in a number format. Without the TEXT function we would not be able to join numbers into a text string in a legible format.

In the example below the TEXT function has been used to include the sum total of values in CONCATENATE, and display them in a currency format.

=CONCATENATE("Total sales for 2016 - ",TEXT(SUM(B4:B8),"£#,###.00"))

Adding descriptive labels to your Excel charts is useful. Adding creative and dynamic labels is awesome.

You can link your chart labels such as the chart title, data labels and axis titles to the cells of a worksheet. The great thing about this is that when the cell content changes, so does the chart label.

Now with CONCATENATE we can build great content for labels. Take for example, the sales total using the TEXT function we created previously. This would be a great label.

To link a chart label to the cell; simply click on the label, then click the Formula Bar and type = followed by clicking on the cell.

The reference created by Excel will be absolute and include the sheet name. It will look something like *=’This Year Sales’!$C$10*.

You will then have an awesome chart title like below which updates as the formulas on the sheet change.

**One that drifts under the radar a little is the WEEKDAY function**. This function will return a number that identifies the day of the week of a date.

This can be very useful. This blog post will look at two examples of what the WEEKDAY function can do for you.

Firstly, let’s look at how this function is written. The syntax of the function is;

=WEEKDAY(serial number, [return type])

The *serial number* is simply the date that you want to find out the weekday for.

The *return type* is a number from 1 to 7 that identifies the day of the week of the date. It provides a list so that you can choose how you would like the number returned e.g. Sunday = 1 to Saturday = 7, or Monday = 1 to Sunday = 7.

One situation where you may want to use the WEEKDAY function is to calculate a different rate of pay for weekend work.

In the list below the WEEKDAY function has been used with the IF function in column C to calculate a different rate of pay when working on a Saturday.

This was achieved my using the formula below in cell C2. This formula checks if the day of the week is equal to 7 (which indicates a Saturday). If this is true then the hours worked is multiplied by the Saturday rate, and if not then the hours worked is multiplied by the standard workday hourly rate.

=IF(WEEKDAY(A2,1)=7,B2*$F$3,B2*$F$2)

In this list the 04/02/2017 and the 11/02/2017 were a Saturday. You can see that Excel applied the increased rate of pay.

This example can be seen in action on my Excel timesheet for different rates for shift work post.

Let’s look at another example. Maybe we wish to highlight the dates in a list that fall on a Saturday or a Sunday.

- Select the range of dates you want to format.
- Click the
**Home**tab,**Conditional Formatting**button and then**New Rule**. - Select
**Use a formula to determine which cells to format**. - Enter a formula like the one below in the box provided.

=OR(WEEKDAY(A2,1)=1,WEEKDAY(A2,1)=7)

In this formula the OR function is used to test more than one condition. Although a range of dates was highlighted, we only reference cell A2 in the formula because it is the first cell of that range.

I used this function for this exact reason in my Excel Gantt Chart template.

Take this example where column A contains a start date and time, and column B an end date and time. We wish to **calculate the elapsed time in days, hours and minutes** e.g. 11 days 4 hours 9 minutes.

There are multiple ways of calculating date and time difference in Excel. In this scenario we will need to get a little clever.

As you may well know, date and time values are stored as numbers in Excel. For example, the 05/01/2017 10:10 is stored as 42740.42.

Therefore, if I write the formula as =B2-A2, then the result is returned as 2.993056.

To return a result that makes sense to us, we will tackle the date and time parts of the cell separately.

To work with just the date part of the cell, we will use the INT function. This function rounds a value down to the nearest integer.

So if we write the function as below. This will return only the integer part of the date difference, and this is the number of days.

=INT(B2-A2)

We now need to work on the number of hours and minutes, which is the decimal part.

To return only the decimal part of the B2-A2 formula, we will use the MOD function. This function returns the remainder after a number is divided by a divisor.

We will use it to divide the B2-A2 formula by 1 so that it returns to remainder as the decimal part.

We will then use the HOUR and MINUTE functions to return the hours and minutes from this decimal value.

So the formula below returns the number of hours elapsed.

=HOUR(MOD(B2-A2,1))

And this returns the number of minutes elapsed.

=MINUTE(MOD(B2-A2,1))

Finally, we need to put this altogether as one Excel formula. We can use the ampersand (&) to concatenate the different parts of the formula.

You can construct the result to look however you want. For example the formula below would return the result as 2 days 23 hours and 50 minutes.

=INT(B2-A2)&" Days "&HOUR(MOD(B2-A2,1))&" Hours "&MINUTE(MOD(B2-A2,1))& " Minutes "

And this formula would display the result as 2 days 23:50.

=INT(B2-A2)&" Days "&HOUR(MOD(B2-A2,1))&":"&MINUTE(MOD(B2-A2,1))

The formula used in this tutorial will work for any text character, and can also be used to count the occurrences of specific words in a cell.

In this example, we used the formula to count the occurrences of the asterisk in the cells of column A.

The formula below was used to return the number of times the asterisk appears. It uses the LEN and SUBSTITUTE functions to accomplish its mission.

=LEN(A2)-LEN(SUBSTITUTE(A2,"*",""))

The LEN function is used to count the total number of characters in a cell.

The second half of the formula uses the LEN function again but with the SUBSTITUTE function. SUBSTITUTE replaces all occurrences of the asterisk with nothing, essentially removing them.

So what we are left with is a formula that subtracts the number of characters in the cell excluding the asterisks from the total number of characters including asterisks.

The result is how many asterisks there are in the cell.

It is a clever approach that can be applied for any word, phrase or text character.

The problem with extracting UK postcodes is that they are highly irregular. They will be at the end of the full address and can come in a different number of characters e.g. E1 6AX, RM3 8HN and LE41 8JX.

They are not as structured as a US zip code may be and harder to extract. Because of this the formula is intense, but I am going to break it down and explain it in detail.

The formula below is the finished article. If you are not used to writing formulas like this it may seem overwhelming, but we are going to look at it one piece at a time.

To use this formula, simply copy and paste and change the cell references to where your addresses are entered. If you want to know more about how this works, read on.

*=RIGHT(SUBSTITUTE(A5,” “,”*”,LEN(A5)-LEN(SUBSTITUTE(A5,” “,””))-1),LEN(A5)-FIND(“*”,SUBSTITUTE(A5,” “,”*”,LEN(A5)-LEN(SUBSTITUTE(A5,” “,””))-1)))*

The RIGHT function has been used to extract the postcode. This function extracts text from the end of a cell. We can be sure that the postcode is at the end, so this function works for us here.

The Right function requires two pieces of information from us. What text to extract the postcode from, and how many characters in the postcode.

*=RIGHT(the text to extract from,how many characters)*

What we do not know is how many characters are in the postcode of each address. We need Excel to calculate this.

To do so, we will find and mark the start of the postcode in the address. This unique mark can then be used to calculate how many characters in the postcode.

The postcode always starts after the penultimate space of the address. It does not matter how many spaces are in the address, we can be sure that the postcode begins after the second from last space.

The formula below calculates what number space the penultimate space is. So it basically returns the position of the space.

LEN(A2)-LEN(SUBSTITUTE(A2," ",""))-1)

The LEN function returns the number of characters in a cell. The SUBSTITUTE function finds and replaces each space with nothing, essentially removing them.

Altogether, by subtracting the number of characters in a cell without spaces from how many characters including spaces, gives us how many spaces there are.

The -1 is then used to return the occurrence of the second from last space.

This part of the formula actually occurs twice n the full formula as shown below.

*=RIGHT(SUBSTITUTE(A2,” “,”*”, LEN(A2)-LEN(SUBSTITUTE(A2,” “,””))-1),LEN(A2)-FIND(“*”,SUBSTITUTE(A2,” “,”*”,LEN(A2)-LEN(SUBSTITUTE(A2,” “,””))-1)))*

Now that we have found the postcode we want to insert a unique marker so that Excel knows where it is.

In the formula below the SUBSTITUTE function has been added to the previous formula to add an ***** at the start of the postcode (the second from last space).

SUBSTITUTE(A2," ","*",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))-1)

This also occurs twice in the formula.

*=RIGHT( SUBSTITUTE(A2,” “,”*”,LEN(A2)-LEN(SUBSTITUTE(A2,” “,””))-1),LEN(A2)-FIND(“*”,SUBSTITUTE(A2,” “,”*”,LEN(A2)-LEN(SUBSTITUTE(A2,” “,””))-1)))*

In the second part of the RIGHT function the formula below has been used to find the position of the * (our unique marker), and subtract that number from the total number of characters in the cell (LEN function). This returns how many characters are in the postcode.

LEN(A2)-FIND("*",SUBSTITUTE(A2," ","*",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))-1))

I do hope this makes sense. It is a complicated formula if you are a beginner.

If you are interested in seriously improving your Excel formula skills. Check out our online course – Excel Formulas Made Easy – Learn over 100 Formulas.

This tutorial will show you how to display any symbol though, so you could insert a smiley face, hour glass, aeroplane and much more.

The first thing we need to do is find out the letter or number for the symbol we want to insert. Every symbol from the *Wingdings* libraries has an associated letter or number when displayed in a normal written font such as Calibri or Arial.

To find this out; start by inserting the symbol in a cell on your worksheet. Then select that cell and change the font to Calibri, Arial or some other written font.

The letter or number will now be displayed instead. For example, the smiley face symbol is J, and the hourglass is 6. Importantly for this tutorial, we know the thumbs up symbol is C, and thumbs down is D.

The following formula was written in cell D2 of the worksheet shown above.

=IF(C2>=B2,"C","D")

It tests if the value in C2 (this months sales) is greater than or equal to the value in B2 (last months sales). If it is then display C (remember this is the thumbs up symbol), and if not display D (thumbs down symbol).

Now that we have the IF function showing the correct value, all the cells containing the formula need to be formatted in a font such as Calibri to show the symbol.

In the example shown above, the thumbs up symbol is formatted in green, and the thumbs down symbol in red. This is done using Conditional Formatting.

- Select the range of cells containing the symbols.
- Click the
**Home**tab and then**Conditional Formatting**. - Select
**Highlight Cells Rules**and then**Equal To**. - Enter C in the first box and then select a green font colour from the
**Custom Format**options in the second box. Click**Ok**.

- Repeat these steps to display in a red font if the value is equal to D.

Displaying a different symbol based on the values of your worksheet, and applying automatic custom colours can add a creative wow factor to your spreadsheets.

Depending on the kind of data you work with, there are loads of symbols on offer and they may just have your spreadsheets jumping out of the screen.