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.

The spreadsheet below shows a list of names with the answer in cell D2. *Ross* is the name that occurs the least in that list.

This formula returns the least frequent value from the list in A2:A16. The formula is explained below so keep reading.

{=INDEX(A2:A16,MATCH(MIN(COUNTIF(A2:A16,A2:A16)),COUNTIF(A2:A16,A2:A16),0))}

This formula is an array formula so you need to press **Ctrl + Shift + Enter**, and not **Enter**. This will put the curly braces around the formula. You do not type these.

Within this formula the COUNTIF functions are used to return how many times each name occurs in the list. The COUNTIF functions return the result below;

{2;5;5;4;4;5;4;4;5;2;4;5;4;4;4}

This means that the name in the first cell of that range (A2) occurs twice, 2nd cell (A3) occurs five times, 3rd cell (A4) occurs five times and so on.

The MIN function returns the smallest number from that array, which is 2 in this example.

The MATCH function is then used to search for the position of the first instance of 2 (the least mentioned names position). The result of this is 1, because the first instance of 2 is in the first cell of range A2:A16.

The INDEX function then returns the value which is in that cell (A2). Which in this example is *Ross*. Watch the video below for a visual explanation of this formula.

The INDEX and MATCH functions are awesome when used together for a flexible lookup formula. Find out more at this INDEX and MATCH tutorial.

Seriously improve your Excel Formula skills with our online course. Over 100 formulas covered. Sign Up Now.

]]>There is no real standalone function in Excel to do this, but it can be done. This could be a useful formula to find how many payments, or how many meetings until an end date.

The formula below calculates the number of Fridays between the date in cell A2 and the date in cell B2. The formula is explained below.

=B2-A2-NETWORKDAYS.INTL(A2,B2,16)+1

In this formula the start date is subtracted from the end date to begin with. This will leave us with how many days in total between the two dates.

In the second half of the formula, the NETWORKDAYS.INTL function is used to calculate the difference between the two dates excluding Fridays. This is then subtracted from the current total to leave us with how many Fridays there are.

The 16 in the function specifies to exclude the Fridays. When typing the function a list appears asking which days to exclude.

The +1 is added to the end because the NETWORKDAYS.INTL function calculates whole workdays. For example, you may consider the difference in days between today and tomorrow to be 1 day. NETWORKDAYS.INTL would return that answer as 2 as it uses each day as a whole day. So the +1 is added to counteract that.

I wanted to explain the other technique first as it probably makes more logical sense. However this tip was brought to me by one of my YouTube subscribers and seems to work.

I don’t really know how it works to be honest, but it does.

The NETWORKDAYS.INTL function is used, but in the third argument a string of 1’s and 0’s are used to specify what weekday you want to count. The example below counts the number of Fridays.

The string starts from a Monday. So this can be easily customised to your own requirements.

=NETWORKDAYS.INTL(A2,B2,"1111011")

- Five Awesome Date Functions in Excel
- Timesheet with Different Rates for Shift Work
- How Many Months Between Two Dates

]]>

For the formula we will be using the CELL, MID and FIND functions. Let’s begin by looking at the CELL function.

The CELL function is a fantastic, and relatively unknown, function in Excel. Its purpose is to return information about a cell such as its column, cell colour, whether it is in a protected state or the filename.We need to use the function to return the filename of a cell. Because our goal is to return the sheet name, it does not matter what cell we use. Any cell on the sheet will work. In the example below, cell B1 has been used.

=CELL("filename",B1)

The function above will return the full filename of the cell such as;

*C:\Users\Trainee1\Desktop\[return-sheet-name.xlsx]London*

Now that we have the filename, we need to extract just the sheet name. The MID and FIND functions will be used for this.

The FIND function is used to return the position of the closing “]” + 1. The “]” indicates the end of the workbook reference, so the following characters are those for the sheet name.

The MID function then extracts up to the next 32 characters. This is an excessive number but because sheet names cannot have more than 31 characters it ensures the full name is returned whatever it may be.

Here is the full Excel formula to display the sheet name in a cell;

=MID(CELL("filename",B1),FIND("]",CELL("filename",B1))+1,32)

The group league tables are ranked as the results are entered. As soon as a groups fixtures have been completed, the knockout schedule is created. The quarters, semi-final and final fixtures are then calculated as these results are entered.

The spreadsheet is unlocked so you are free to check out the formulas and how it all works. Download the Euro 2016 planner spreadsheet.

There are many formulas and techniques used to create this Euro 2016 planner. They include;

**The SUMPRODUCT function** – This has been used heavily to perform the calculations at the group stages. I thought it was the best function to handle the calculation of a team’s games played, number of wins, goals scored etc. Learn more about the SUMPRODUCT function.

**Ranking and then calculating unique ranking** – The rankings for the group stages are done on the *Calculations* sheet (you will need to unhide it). On here I needed to calculate a teams ranking based on points, then goal difference and then goals scored. If a ranking was still tied, a unique ranking was formulated.

**Nested IF’s** – These have been used in the knockout stages to organise the fixtures as the results are entered.

**The VLOOKUP function** – It was guaranteed to be used somewhere. It has been used on the *League Tables* sheet (another hidden sheet) to formulate the group tables from the workings on the *Calculations* sheet. It is also used to help calculate the third place teams permutations (explained later in this post). Learn more about VLOOKUP.

**The Excel Camera tool** – A brilliant little tool. Used to create a dynamic picture of the group tables from the *League Tables* sheet onto the *Group Stages* sheet. Find out more about the Excel Camera tool.

These skills and techniques are all shown in detail in my online course for creating your own sports league tables and tournaments in Excel. Join hundreds of others in learning these skills. I will be on hand to help with any queries.

The UEFA European Championships 2016 has a new format for some of the fixtures in the last 16 (the first knockout round). The top 2 teams in each of the 6 groups are automatically through. They are then followed by the 4 best third place finishers.

A ranking is given to each of the teams who finish third in their group. The four best teams’ progress. Who they play in the next round is determined by the table below.

For example, the table above shows that if the 4 best third place teams are from groups A, B, C and D, then the winner of group A would play the third best team in group C. But if the 4 best third place teams are from groups A, B, D and E, then the winner of group A would play the third best team in group D.

This made things a little complicated to calculate which team progresses and who they will play in the last 16. On the *League Tables* sheet you can see a league table for the third place teams. The four best groups are calculated and the table below is formulated.

On the *Knockout Stages* sheet a VLOOKUP function is then used to return the correct team from this table.

This is great when looking for a unique value. But what about when the value you are looking for appears multiple times in the list, and you want to return the last match.

Sure we could sort the list so that the last match would become the first, but this is not always an option.

This blog post looks at using the VLOOKUP function to return the last match in a list. The technique and formulas used can be adapted to find the 2^{nd} or 3^{rd} match if required.

In order to create a VLOOKUP to return the last match in the list, we will need to know how many matches there are in total.

The following formula has been entered in cell J1 to return how many times the customer ID occurs in the list.

=COUNTIF(C:C,$I$4)

Next we need to create a column of unique values which can then be used by the VLOOKUP function.

The values in this column are made by joining the customer ID and that instance of the ID. The image below shows column D as the helper column. You can see the two instances of customer *Hanari* *Carnes* which has the ID *1094*. A number 1 and 2 has been attached to the end of the ID to make it unique.

The following formula has been entered into column D. The position of the dollar signs is important for this formula to work.

=C2&COUNTIF($C$2:$C2,C2)

The COUNTIF function is an extremely powerful and versatile function to have in your Excel arsenal. Check out these 5 alternative examples of the COUNTIF function.

This column can be hidden once the VLOOKUP is written. It is an important column, but it does not need to be visible on screen.

With the helper column now in place, we can write a VLOOKUP to look to return the last match in a list.

The VLOOKUP function below has concatenated the contents of cell I4 (the customer ID) and J1 (the number of occurrences in the list of that customer ID) together to form the lookup value.

The table array is columns D:F to ensure that the leftmost column of the array is the helper column that we created.

=VLOOKUP(I4&J1,D:F,3,FALSE)

Want more information on VLOOKUP? Check out the ultimate guide to VLOOKUP.

]]>This can be quite a difficult task especially if the URL’s are not consistent. In this article we explore a few different approaches to extract the domain from a URL. The method you choose will depend on the appearance of the URL’s in the list and the format you would like to extract the domain in.

This article covers;

- Extract the domain including the URL protocol.
- Extract the domain ignoring URL protocol.
- Extract the domain without the www.
- Extract root URL’s that don’t end with a slash (/).
- Using helper columns to break up complex formulae.

Let’s start with a simple way that extracts the domain with the URL protocol (http, https, etc).

The formula below will extract all the text up to the slash (/) after the domain.

=LEFT(A2,SEARCH(“/”,A2,9)-1)

The LEFT function is used to extract the domain from cell A2.

The SEARCH function has been used to find the position of the slash (the FIND function works equally well for this). Minus 1 removes the slash from the extracted text. The search starts from character 9 to avoid the slashes that come with the URL protocol.

To ignore the URL protocol when extracting domains you can use the MID function. This function is used to extract text from the middle of a string of characters.

The formula below extracts all text between the URL protocol and the slash after the domain.

=MID(A2,SEARCH(":",A2)+3,SEARCH("/",A2,9)-SEARCH(":",A2)-3)

The first SEARCH function detailed below is used to find the first character of the domain. It does this by returning the position of the colon (:) in the URL. 3 is then added to skip the two slashes (//) and find the position of the first domain character.

SEARCH(":",A2)+3

You then need to determine how many characters the domain is. This is done by finding the position of the slash after the domain like in the first example, and subtracting the position of the first character of the domain (this is done by finding the colon and subtracting 3 to account for the two slashes before the domain and the one after it).

You may require the domain without the www part. The www is not present in all of the URL’s in the list, but if it is then it needs to be excluded from the result.

The formula below uses the SUBSTITUTE function twice to remove the www.. This is the only change from the previous formula that extracts it with the “www.”. The two SUBSTITUTE functions have been emboldened so they are easier to identify within the formula.

=MID(,SEARCH(":",A2)+3,SEARCH("/",SUBSTITUTE(A2,"www.",""),9)-SEARCH(":",A2)-3)SUBSTITUTE(A2,"www.","")

The first instance of SUBSTITUTE is used to provide the string without the “www.” for the MID function to extract from. The second instance is used when calculating how many characters are in the domain name. The “www.” is removed again here to ignore it in the calculation.

In the example below, one of the URL’s does not end with a slash. All of the previous formulas have used this character to identify the end of the domain.

To work with these URL instances in a big list, we will need include another way of returning the domain.

The formula below includes the IF, ISERROR and a LEN function to get this job done. The differences between this formula and the previous one have been highlighted in bold.

=MID(SUBSTITUTE(A2,"www.",""),SEARCH(":",A2)+3,SEARCH("/",SUBSTITUTE(A2,"www.",""),9)-SEARCH(":",A2)-3IF(ISERROR(SEARCH("/",A2,9)),LEN(SUBSTITUTE(A2,"www.",""))-SEARCH(":",A2)-2,))

Now this is a big formula, so let’s break down how it works.

Firstly, just like in the previous example, the MID function is supplied with a URL without the “www.” and told to extract characters starting with the first domain character (3 characters after the colon).

=MID(SUBSTITUTE(A2,"www.",""),SEARCH(":",A2)+3

Then to calculate how many characters in the domain name, this is when the IF function is inserted to check if it has a slash at the end of the domain. The SEARCH function looks for this slash, and the ISERROR function reports back to IF to say if there is not one.

IF(ISERROR(SEARCH("/",A2,9))

If there is not a slash, then the LEN function is used to find the last character of the string (last character of the domain name). The rest of the formula is similar to the previous example to find domain length, except this one subtracts 2 and not 3. This is because it does not have to account for the ending slash like the others.

LEN(SUBSTITUTE(A2,"www.",""))-SEARCH(":",A2)-2

When formulas get large and complex, you may find it easier to break it up into smaller chunks and use helper columns.

These helper columns can be used to store the position of the important characters in these tasks. These columns can then be referred to in our formula, but hidden on the spreadsheet.

The formula below has been entered into cell F2 and uses the helper columns of B, C, D and E.

=MID(B2,C2,E2)

Column B has been used to remove the “www.” from the URL string, if it is present, using the SUBSTITUTE function.

=SUBSTITUTE(A2,"www.","")

Column C has been used to identify the position of the first character of the domain. This is done using the SEARCH function to find the colon and add 3.

=SEARCH(":",B2)+3

Column D is used to determine the end of the domain name part of the URL. Here the IF function is used with ISERROR and SEARCH to check if a slash exists at the end of the domain name. If it does then return the position of that slash. But if not, then use the LEN function to return how many characters in the URL string. 1 is then added to this total to compensate for the missing slash.

=IF(ISERROR(SEARCH("/",B2,9)),LEN(B2)+1,SEARCH("/",B2,9))

Finally column E simply subtracts the results of columns D and C to return how many characters are in the domain name.

=D2-C2

Due to breaking the formula up into multiple different tasks, the finishing MID function is quite simple. It uses the URL’s in column B, and returns the number of characters in column E, from the character in column C.

=MID(B2,C2,E2)

It may be a neat way of deciding who is next to do the washing up, or to make the tea :). Or it is useful for randomly drawing teams for a knockout cup competition.

To perform this random selection, we are going to use two different functions together. They are INDEX and RANDBETWEEN.

The INDEX function is used to return a value from a given cell in a range, and the RANDBETWEEN function is used to calculate a random number between two given numbers.

When used together, we can get the INDEX function to return a value (a persons name) from a random cell within its range.

The following formula has been entered into cell C3 to return a name at random from the list in A2:A13.

=INDEX(A2:A13,RANDBETWEEN(1,12))

The INDEX function used the 12 cells from A2:A13 as its array. The RANDBETWEEN function is then told to generate a random number between 1 and 12 and INDEX returns the value from that cell within its range.

So for example, if RANDBETWEEN returns the number 4, then INDEX returns the name from cell A5.

Want to learn more awesome formulas like this? Check out our Excel Formulas Made Easy online course.

The RANDBETWEEN function is a volatile function. This means that it calculates every time Excel does. Not all functions work this way, and normally only calculate when necessary to do so.

Because of this you may want to switch from automatic calculations to manual, otherwise the formula will constantly generate a random name, and not just when you need one.

To do this, click the **Formulas** tab on the Ribbon, then click **Calculation Options** and then **Manual**.

Now, to run calculations on the worksheet you can press **F9**.

The **TEXT function** is used to convert a numeric value into text in a specified number format. This function is really useful when concatenating strings that will contain a numeric value.

Take the example below, where the following formula has been entered into cell C2. The date formula loses its format when concatenated. This is now useless.

=A2&" - "&B2

By using the TEXT function the date can be concatenated, and an appropriate date format applied.

The number format must be entered within the double quote marks. If these are omitted, the #NAME? error is displayed.

=A2&" - "&TEXT(B2,"dd/mm/yyyy")

You can specify the date format you want by using the same formatting characters that you get when applying custom formatting in Excel.

The examples below show some alternative representations of the date.

dd mmmm yyyy | 12 April 1974 |

dddd dd mmm yyyy | Friday 12 Apr 1974 |

ddmmyyyy | 12041974 |

**Display a Currency Format in a Text String**

The TEXT function can be useful for displaying summary text that you see on reports and dashboards in Excel. For example, “Total spend for the current month is £2,930.89”.

The formula below calculates the net income value, converts it to text and applies a currency format.

="Net income for this month is "&TEXT(G2-H2,"£#,###.00")

When applying number formatting the # symbol displays a number only if necessary, and a 0 forces the display of a number.

The TEXT function is very versatile and there are many examples for its use.

]]>In this tutorial we create a timesheet that uses different rates of pay for working weekends, and also night shifts.

Prefer a video tutorial? Skip to the video.

In this timesheet, the day and night shifts are entered on separate rows. This will make it easier for our calculations. A column (column E) is also used to record whether it is a day or night shift.

Our first task is to calculate the number of hours worked on the shift. To do this the following formula can be used. This formula finds the difference between the two times as a decimal, and then multiplies by 24 to convert it to hours.

(D5-B5)*24

If the shift is worked overnight, so you started work on one day but finished the next, then the formula below is used.

(1+D5-B5)*24

Now in this timesheet it is not quite that straight forward. We need to test first what shift they are doing and whether it was worked overnight or not, so that the correct formula can be run.

The formula below is entered into column F to calculate hours worked on the day shift.

=IF(E5=”Day”,(D5-B5)*24,0)

In column G, the formula below was used to calculate hours worked on the night shift. The IF function first tests if it was a night shift, then test to see if it was worked overnight (A5<C5), and runs the correct calculation as a result.

=IF(E5=”Night”,IF(A5<C5,(1+D5-B5)*24,(D5-B5)*24),0)

In addition to the type of shift worked, the day of the week if also a factor in determining the rate of pay applied.

To include this, 2 lookup tables were set up on a different sheet. One for day shifts and the other for nights.

The first column is the day of the week represented as a number, where 1 is Monday and 7 is Sunday. The second column stores the rate of pay.

Range Names have been assigned to each table. They have been named *day* and *night*.

In the *day* and *night* lookup tables the rate of pay is determined by the day of the week that they worked. The rate for starting work on a Saturday or Sunday is higher than the other days of the week.

So before we can look up the rate we need to know how to calculate the day of the week that they started their shift. To do this we can use the WEEKDAY function.

The formula below returns the day of the week that they started work as a number, where Monday is 1 and Sunday is 7.

=WEEKDAY(A5,2)

With all this information to hand. The final formula will need to look up the rate using the number of the weekday in the correct table.

The formula below can be entered into cell H5 to achieve this.

=IF(E5=”Night”,G5*VLOOKUP(WEEKDAY(A5,2),night,2,FALSE),F5*VLOOKUP(WEEKDAY(A5,2),day,2,FALSE))

Now this formula may seem quite daunting, so let’s break it down a little.

The IF function tests to see if the night shift was worked. If so a VLOOKUP function is used to look up the required rate of pay in the *night* table, and this is then multiplied by the hours in cell G5.

If they did not work the night shift, then a VLOOKUP function returns the rate from the *day* table and this is then multiplied by the hours in cell F5.