0% found this document useful (0 votes)
6 views150 pages

Battle Functions FullStackModeller 1.01

Uploaded by

sahvalih
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views150 pages

Battle Functions FullStackModeller 1.01

Uploaded by

sahvalih
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 150

Battle Functions

Version Log

Version Number Date


1.01 9th January 2024
Change Description
Setting the scene

Purpose
This training workbook will guide you through a selection of functions we believe you should master, whethe
It's not intended to be an exhaustive list, and there will undoubtedly be other functions you could use in the b
However, it's our belief that mastering the functions we have picked out for you here will give you an incredib
Generally each tab introduces an individual function, providing examples of its use and some exercises for y
The workbook also includes additional exercises (on blue tabs) for you to put into practice what you have lea
You will see references to someone called Sarah and her bakery business. This is a fictional business owne

How to use this workbook


Work through each of the worksheets within this workbook from left to right.
For the exercises found on each worksheet, you will be required to enter a formula into blank grey fill cells.
Worksheets in blue are more comprehensive exercises for you to test the use of these functions in other wa

Format guide

Cells with a yellow fill are inputs cells which you can populate with your own inputs / assumpt
1 Formulas will be found in grey fill cells like this one. You will be expected to populate grey fill

Note: We have made every effort possible to remove typos and other minor errors. However, this is a big w
If you do spot something that looks wrong, please email Giles at [email protected] or contact him
We will continue to offer this workbook for free via a shared drive link, and we'll ensure it's updated regularly
Enjoy!
should master, whether you'd like to take part in the Excel Battle Series or to just generally improve your modelling skills.
s you could use in the battles to great effect.
will give you an incredible base of fundamentals you can then build upon.
nd some exercises for you to work through.
ctice what you have learned, with supporting answers for you to refer to.
fictional business owner we created for much of our training content at Full Stack Modeller. You do not need any wider context a

to blank grey fill cells.


e functions in other ways.

r own inputs / assumptions.


ted to populate grey fill cells that are blank.

However, this is a big workbook, and there's every chance we've missed one somewhere!
eller.com or contact him on LinkedIn to let him know.
re it's updated regularly with any fixes.
or to just generally improve your modelling skills.

ull Stack Modeller. You do not need any wider context about her business to complete the exercises in this model.

one somewhere!
context about her business to complete the exercises in this model.
The LEFT function

Syntax =LEFT(text, num_chars)

text - The text to extract characters from


num_chars - The number of characters to extract

Key points
The LEFT function allows you to extract a specified number of characters from a text string, starting from the left side of the string

Let's start with a simple example

Below is our base text string. We need to extract some characters and we start from the left hand side of the string.

************ 5623154 - Debtors ************ 5623154 =LEFT(C15, 21)

The first element of the LEFT function identifies the text string, and the second part (after the comma) identifies the number of characters that will be returned

In plain English:
The LEFT function returns the first 21 characters from the left of the text string in cell C15

Referring to cell contents

In the example above the text string is linked through from another cell. In addition we can identify the number of characters through a cell reference:

text num_chars
************ 5623154 - Debtors 21 ************ 5623154 =LEFT(C27, D27)

Application

Using the LEFT function to extract PO numbers

Sarah has some PO data that she needs some help with. The first eight characters are the actual PO numbers

1573f821-af6e-4826-8bd7-63c10f701efb 1573f821 =LEFT(C35, 8)


f46a8843-41cf-4ef6-at56-e37067a67149 f46a8843 =LEFT(C36, 8)
3b27d9e0-41f7-408c-98fe-6038eeab7261 3b27d9e0 =LEFT(C37, 8)
c4t30530-91d8-4508-b355-fb58a28046d3 c4t30530 =LEFT(C38, 8)
d11512d1-150b-47dr-990e-b134323debbf d11512d1 =LEFT(C39, 8)
bd40b730-f76d-26db-857d-f1692b6fb8dh bd40b730 =LEFT(C40, 8)

This can be particularly useful, and quick to use, when you have text data that is consistent in length and structure:

2018 - Month 3 - 3rd 2018 {=LEFT(C45:C51, 4)}


2018 - Month 5 - 9th 2018
2018 - Month 7 - 12th 2018
2018 - Month 11 - 21st 2018
2019 - Month 1 - 7th 2019
2020 - Month 12 - 15th 2020
2021 - Month 8 - 20th 2021

Note that we are referencing a range in our grey calculation cell above, and returning a dynamic array in this instance

Exercise

Use the LEFT function to extract the month text from the text strings below

Jan - 144995535 - Peter H Jan


Mar - 195895049 - Sarah O Mar
Jan - 938560385 - James D Jan
Dec - 839948573 - Peter H Dec

Exercise Solution

Use the LEFT function to extract the month text from the text strings below

Jan - 144995535 - Peter H Jan =LEFT(C69, 3) Jan {=LEFT(C69:C72, 3)}


Mar - 195895049 - Sarah O Mar =LEFT(C70, 3) OR Mar
Jan - 938560385 - James D Jan =LEFT(C71, 3) Jan
Dec - 839948573 - Shaun H Dec =LEFT(C72, 3) Dec

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The RIGHT function

Syntax =RIGHT(text, num_chars)

text - The text to extract characters from


num_chars - The number of characters to extract

Key points
The RIGHT function allows you to extract a specified number of characters from a text string, starting from the right side of the string

Let's start with a simple example

Below is our base text string. We need to extract some characters and we start from the right hand side of the string.

************ 5623154 - Debtors Debtors =RIGHT(C15, 7)

The first element of the RIGHT function identifies the text string, and the second part (after the comma) identifies the number of characters that will be returned

In plain English:
The RIGHT function returns the first 7 characters from the right of the text string in cell C15

Referring to cell contents

In the example above the text string is linked through from another cell. Just as we showed you with LEFT, we can identify the number of characters through a cell reference as well

text num_chars
************ 5623154 - Debtors 7 Debtors =RIGHT(C27, D27)

Application

Using the RIGHT function to extract some unique system references

Sarah has some PO data that she needs some help with. The last twelve characters are unique system references

1573f821-af6e-4826-8bd7-63c10f701efb 63c10f701efb =RIGHT(C35, 12)


f46a8843-41cf-4ef6-at56-e37067a67149 e37067a67149 =RIGHT(C36, 12)
3b27d9e0-41f7-408c-98fe-6038eeab7261 6038eeab7261 =RIGHT(C37, 12)
c4t30530-91d8-4508-b355-fb58a28046d3 fb58a28046d3 =RIGHT(C38, 12)
d11512d1-150b-47dr-990e-b134323debbf b134323debbf =RIGHT(C39, 12)
bd40b730-f76d-26db-857d-f1692b6fb8dh f1692b6fb8dh =RIGHT(C40, 12)

Using the same simple example we saw on the LEFT tab, you'll see that the logic doesn't work so well with RIGHT if we want to extract the day text at the end of the string below, because the number of characters varies:

2018 - Month 3 - 3rd 3rd


2018 - Month 5 - 9th 9th
2018 - Month 7 - 12th 12th [this is incorrect]
2018 - Month 11 - 21st 21st [this is incorrect]
2019 - Month 1 - 7th 7th
2020 - Month 12 - 15th 15th [this is incorrect]
2021 - Month 8 - 20th 20th [this is incorrect]

We'll come back to this later…

Exercise

Use the RIGHT function to extract the customer contact name reference from the text strings below

Jan - 144995535 - Peter H Peter H


Mar - 195895049 - Sarah O Sarah O
Jan - 938560385 - James D James D
Dec - 839948573 - John H John H

Exercise Solution

Use the RIGHT function to extract the customer contact name reference from the text strings below

Jan - 144995535 - Peter H Peter H =RIGHT(C69, 7) Peter H {=RIGHT(C69:C72, 7)}


Mar - 195895049 - Sarah O Sarah O =RIGHT(C70, 7) OR Sarah O
Jan - 938560385 - James D James D =RIGHT(C71, 7) James D
Dec - 839948573 - Shaun H Shaun H =RIGHT(C72, 7) Shaun H

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The LEN function

Syntax =LEN(text)

text - The text string to measure the length of (the number of characters)

Key points
The LEN function allows you to return the number of characters in a text string.
It does not discriminate between text, numbers, and spaces.
Bear with us on this function. Its value may not be obvious, but when combined with other text functions it can be a very powerful tool.

Let's start with a simple example

This is our base text string which we will refer to with the LEN function to return the number of characters

************ 5623154 - Debtors 32 =LEN(C16)

There is just one element of the LEN function - the cell reference for which you would like to return the number of characters

In plain English:
How long is the text string in cell C16?

Application

Using the LEN function to return the number of characters in a text string

As we have seen above, we use the LEN function on its own simply to return the number of characters

1573f821-af6e-4826-8bd7-63c10f701efb 36 =LEN(C29)
f46a8843-41cf-4ef6-at56-e37067a67149 36 =LEN(C30)
3b27d9e0-41f7-408c-98fe-6038eeab7261 36 =LEN(C31)
c4t30530-91d8-4508-b355-fb58a28046d3 36 =LEN(C32)
d11512d1-150b-47dr-990e-b134323debbf 36 =LEN(C33)
bd40b730-f76d-26db-857d-f1692b6fb8 34 =LEN(C34)

A challenge we'll keep coming back to

Let's say we wanted to extract the day text from the right hand side of the data table below.
The challenge here is that the day text string length is not consistent.
A useful first step in helping us solve this problem is simply using LEN to calculate the total text string length:

2018 - Month 3 - 3rd 20 {=LEN(C44:C50)}


2018 - Month 5 - 9th 20
2018 - Month 7 - 12th 21
2018 - Month 11 - 21st 22
2019 - Month 1 - 7th 20
2020 - Month 12 - 15th 22
2021 - Month 8 - 20th 21

We'll come back to this again later (once we've introduced some other functions)

Exercise

Use the LEN function to return the number of characters from the text strings below

Jan - 144995535 - Peter H 25


Mar - 195895049 - Sarah O 25
Jan - 938560385 - James D 25
Dec - 839948573 - John H 24

Exercise Solution

Use the LEN function to return the number of characters from the text strings below

Jan - 144995535 - Peter H 25 =LEN(C69) 25 {=LEN(C69:C72)}


Mar - 195895049 - Sarah O 25 =LEN(C70) OR 25
Jan - 938560385 - James D 25 =LEN(C71) 25
Dec - 839948573 - John H 24 =LEN(C72) 24

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The FIND function

Syntax =FIND(find_text, within_text, [start_num])

find_text - The test string (or individual character) to find


within_text - The text string to evaluate
[start_num] - The starting position in the text string to search from

Key points
The FIND function allows you to find the position of specified text (or individual characters) from within a text string.
The [start_num] allows you to start the search within the text string from a specified position (a number of characters from furthest left).
The FIND function is case sensitive. SEARCH, which we'll mention below, is case sensitive, which makes it worth remembering alongside FIND.

Let's start with a simple example

This is our base text string which we will refer to with the FIND function to return a relative position of a determined string of text

************ 5623154 - Debtors 26 =FIND("Debtors", C18, 1)

The first element of the FIND function identifies the text string you are searching for. The second part (after the first comma) identifies the text string you are referring to,
and the third part (after the second comma) identifies the starting position for your search (number of characters from furthest left)
Note that this formula would work without the starting position number in this example, as it defaults to starting at the beginning of the text string.

In plain English:
Tell me the starting position for the word "Debtors" in cell C18

If the text cannot be found, Excel will return the #VALUE! error: #VALUE! =FIND("debtors", C18)

Note that an error is returned in the example above because the FIND function is case sensitive, and "debtors" in the formula does not have a capital D

In this instance, SEARCH offers a quick, effective alternative: 26 =SEARCH("debtors", C18)

SEARCH also allows us to use wildcards (* and ?), whereas FIND does not:
Wildcards:
* (asterisk) - all
? (question mark) - any character (enter ? for each single wildcard character)
debt* 26 =SEARCH(C37, C18)
de??ors 26 =SEARCH(C38, C18)

debt* #VALUE! =FIND(C40, C18)


de??ors #VALUE! =FIND(C41, C18)

As you can see, SEARCH works in this instance where FIND does not

It's also possible to simply return the position of an individual character. In the example below, we're returning the position of the "-" character only:

************ 5623154 - Debtors 24 =FIND("-", C47)

When we're looking for a single character, the limitations of FIND vs SEARCH do not matter.

Referring to cell contents

We could determine the text we are looking for and the starting position for the search through a cell reference:

within_text find_text start_num


************ 5623154 - Debtors Debtors 1 26 =FIND(D56, C56, E56)

Note that in the example above we used a starting position of 1. See what happens if you make it 15. What about if it is 30?

What you may have noticed is that the starting position does very little in the example above (unless you enter a number greater than 26).
If the text you were seeking to locate within your overall text string was repeated one or more times, and for some reason you wanted to ignore one of the first instances, then it would be of more use:

within_text find_text start_num


************ Debtors - 5623154 - Debtors Debtors 21 36 =FIND(D65, C65, E65)

In the example above, the starting position entry of 21 means that the resulting formula output is showing us the location of the second instance of "Debtors"

Sometimes we might just use FIND as a flag to indicate whether a particular word or text string is part of a longer string:

within_text Debtors Flag find_text


************ Debtors - 5623154 TRUE Debtors
************ Creditors - 7626152 FALSE
************ Debtors - 5623158 TRUE
************ Creditors - 7626622 FALSE
************ Debtors - 5623374 TRUE

In the example below, we can see how FIND can be used alongside some of the functions we've been looking at so far to add a layer of flexibility.
Let's say we want to extract just the reference number from the text string below (the number sequence before the name), but the reference number varies in length:

The first thing you should be looking out for in a situation like this is some element within the text string series that is consistent. In this example it looks like the "_" character consistently follows the reference number we want to extract.
Because of this, we can use the "_" character as part of our FIND logic:

Ref: 338402_Tom Marshall: USA Ref: 338402 {=LEFT(C86:C90, FIND("_", C86:C90)-1)}


Ref: 469964402_Sharon Levet: England Ref: 469964402 We use FIND and LEFT to extract all of the characters to the left of the "_" character
Ref: 9944738_Hannah Watts: Canada Ref: 9944738 Note: the -1 part of the formula removes the "_" character itself from the string that is returned
Ref: 338402_Philip Angle: Australia Ref: 338402
Ref: 338402_Pierre Grant: France Ref: 338402

We can then easily remove the "Ref: " section if we need to, in a variety of ways:
#NAME? #NAME?
#NAME? #NAME?
#NAME? #NAME?
#NAME? #NAME?
#NAME? #NAME?

Back to our unsolved challenge

Remember, what we're trying to do here is just pull out the day reference at the end of the text string. The challenge we face is that the day reference varies in terms of its text string length

What we could do with FIND is identify the position of the last instance of the "-" character, and add one to the position to ignore the final space

2018 - Month 3 - 3rd 17 {=FIND("-", C105:C111, 8) + 1}


2018 - Month 5 - 9th 17 In this example, we're finding the first instance of "-" after the 8th character in the text string
2018 - Month 7 - 12th 17 8 has been chosen relatively arbitrarily as it ensures the first "-" is excluded
2018 - Month 11 - 21st 18 We add 1 to ignore the final space
2019 - Month 1 - 7th 17
2020 - Month 12 - 15th 18
2021 - Month 8 - 20th 17

And using this value, we can solve our problem:

2018 - Month 3 - 3rd 3rd {=RIGHT(C115:C121, LEN(C115:C121) - (FIND("-", C115:C121,8)+1))}


2018 - Month 5 - 9th 9th Now we have a dynamic formula that can deal with a change in text string lengths (some extreme changes would break this formula)
2018 - Month 7 - 12th 12th
2018 - Month 11 - 21st 21st
2019 - Month 1 - 7th 7th
2020 - Month 12 - 15th 15th
2021 - Month 8 - 20th 20th

Let's break that down into steps:


Step 1: LEN Step 2: FIND Step 3: LEN - FIN Step 4: RIGHT
20 17 #NAME? #NAME?
20 17 #NAME? #NAME?
21 17 #NAME? #NAME?
22 18 #NAME? #NAME?
20 17 #NAME? #NAME?
22 18 #NAME? #NAME?
21 17 #NAME? #NAME?

This is where these functions become so powerful - it's not so much their basic capabilities, it's the way you apply them and bring them together.
Bringing them together doesn't have to be done in one cell. You can break your logic down into multiple steps.

What if we wanted to extract just the Month text and number from the centre of the text string?
We'll come back to that later (after we've introduced another function…)

Exercise

1 Use the FIND function to return the position of the first name of the customer contact

Jan - 144995535 - Peter H Peter


Mar - 195895049 - Sarah O Sarah
Jan - 938560385 - James D James
Dec - 839948573 - John H John

Now use FIND to return the position of the second "-" character in the same data set above

2 Use the FIND function, and any other functions we've covered so far, to extract the various month references from the first part of the text strings below ("12" in the last row refers to month 12)

January - 144995535 - Peter H


Mar - 195895049 - Sarah O
January - 938560385 - James D
12 - 839948573 - John H

Exercise Solution

Use the FIND function to return the position of the first name of the customer contact

Jan - 144995535 - Peter H Peter 19 =FIND(E168, C168)


Mar - 195895049 - Sarah O Sarah 19 =FIND(E169, C169)
Jan - 938560385 - James D James 19 =FIND(E170, C170)
Dec - 839948573 - John H John 19 =FIND(E171, C171)

Now use FIND to return the position of the second "-" character in the same data set above
17 {=FIND("-", C168:C171, 6)}
17
17
17

2 Use the FIND function, and any other functions we've covered so far, to extract the various month references from the first part of the text strings below ("12" in the last row refers to month 12)

January - 144995535 - Peter H January {=LEFT(C182:C185, FIND("-", C182:C185) - 2)}


Mar - 195895049 - Sarah O Mar Note: the -2 above just removes the "-" and the space from the string returned.
January - 938560385 - James D January If the "-: and space were inconsistent across the data set, we'd have another challenge to deal with
12 - 839948573 - John H 12

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The MID function

Syntax =MID(text, start_num, num_chars)

text - The text to extract characters from


start_num - The starting location within the text
num_chars - The number of characters to extract

Key points
The MID function allows you to extract a particular number of characters from a text string, starting from a position within the string that you identify

Let's start with a simple example

This is our base text string which we are going to reference using the MID function

************ 5623154 - Debtors 5623154 =MID(C17, 15, 7)

The first element of the MID function identifies the text string, the second part (after the first comma) identifies the starting position (the number of characters from the left),
and the third part (after the second comma) identifies the number of characters to be returned

In plain English:
Return 7 characters from cell C17 starting at character 15

Referring to cell contents

In the example above, the text string is linked through from another cell. In addition we can identify the starting position and the number of characters to extract through a cell reference:

text start_num num_chars


************ 5623154 - Debtors 15 7 5623154 =MID(C30, D30, E30)

Application

Using the MID function to extract location references

Sarah has some PO data that she needs some help with. The 9 characters after the first "-" are the location references

1573f821-af6e-4826-8bd7-63c10f701efb af6e-4826 {=MID(C38:C43, 10, 9)}


f46a8843-41cf-4ef6-at56-e37067a67149 41cf-4ef6
3b27d9e0-41f7-408c-98fe-6038eeab7261 41f7-408c
c4t30530-91d8-4508-b355-fb58a28046d3 91d8-4508
d11512d1-150b-47dr-990e-b134323debbf 150b-47dr
bd40b730-f76d-26db-857d-f1692b6fb8dh f76d-26db

This works well enough when the text strings are consistent in structure and length. But what if they're not?
Let's say we want to pull the company letter reference from the centre of the text string below:
We can't use a hardcoded starting reference with MID because the initial code length varies.

DL33P! Company A: Smiths Company A {=MID(C49:C53, FIND(" ", C49:C53), 10)}


DL465k! Company F: Bakers Company F Here, we're using FIND to identify the position of the first space (" "), which is not consistent across the series
DL96A! Company U: Carmel Company U From there, we can (in this instance) use a hardcoded 10 figure for the number of characters to return the company letter reference
DL2551L! Company S: Crank Company S
DL54Y! Company V: Markle Company V

Back to our unsolved challenge

Let's turn back to our ongoing text string challenge. This time, we want to extract the Month text and number from the centre of the text string.
This is challenging because the length of the Month text strings vary:

2018 - Month 3 - 3rd Month 3 {=MID(C63:C69, 8, FIND("-", C63:C69, 8)-FIND("-", C63:C69) - 2)}
2018 - Month 5 - 9th Month 5 In this example we're using FIND twice within a MID function to dynamically identify the positions of the two "-" characters
2018 - Month 7 - 12th Month 7
2018 - Month 11 - 21st Month 11
2019 - Month 1 - 7th Month 1
2020 - Month 12 - 15th Month 12
2021 - Month 8 - 20th Month 8

Let's break that out into steps:

Step 1 Step 2 Step 3 Step 4


Find the position of the second "-" Find the position of Calculate the number of Appliy to the MID
character: the first "-" character characters between these function
two positions and adjust
for extra spaces

{=FIND("-", C63:C69, 8)} {=FIND("-", C63:C69)} {=_xlfn.anchorarray(C76) - {=MID(C63:C69,


_xlfn.anchorarray( E76) - 8,_xlfn.anchorarray( G7
16 6 #NAME?2} #NAME?6))}
16 6 #NAME? #NAME?
16 6 #NAME? #NAME?
17 6 #NAME? #NAME?
16 6 #NAME? #NAME?
17 6 #NAME? #NAME?
16 6 #NAME? #NAME?

Note that in the formula above for Step 1, we've included a hardcoded 8 to start the FIND process beyond the first instance of the "-" character
This isn't a fully dynamic solution, and it only works like this if we are absolutely certain the structure of the data will never change significantly
A better solution, a more "future-proofed" solution, would be to use another function to dynamically locate the first "-" character and use that position as the starting point for the FIND function
You'll see this approach being used in the exercise solution below - we just wanted to highlight this here for now

MID & SEQUENCE

This is stepping up a bit into "modern Excel", and we haven't covered SEQUENCE yet, but it's hard to overlook this.
Using SEQUENCE with MID provides us with an incredible, dynamic method of splitting a text string up.

Let's imagine the number below is a log of individual moves made by a player on a board game, using one die:

364534264526453

By nesting SEQUENCE within MID, we can create a dynamic array output that splits each number into individual cells:

#NAME? {=MID(C97, _xlfn.sequence(LEN(C97)),1)}


#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?

Those of you familiar with TEXTJOIN will know that we could then rejoin this sequence back into one cell with new delimiters (if we wanted to):

#NAME? =TEXTJOIN("; ",,_xlfn.anchorarray( C101))

This is just the very tip of the iceburg with dynamic array functions! We just want to wet your appetite for now…

Exercise

1 Use the MID function to extract the 9 digit invoice number reference from the centre of the text strings below

Jan - 144995535 - Peter H


Mar - 195895049 - Sarah O
Jan - 938560385 - James D
Dec - 839948573 - Shaun H

2 Use any functions we have covered so far to extract the numbers between the ### symbols in the centre of the text strings below:

PO:144995535 - Company XYZ //


###489553### // Level 1
PO:6422554 - Company BDKK //
###489544263### // Level 3
PO:495243 - Company RYHF //
###995533223### // Level 5
PO:00985733 - Company YT //
###9943### // Level 12

Exercise Solution

1 Use the MID function to extract the 9 digit invoice number reference from the centre of the text strings below

Jan - 144995535 - Peter H 144995535 =MID(C146, 7, 9) 144995535 {=MID(C146:C149, 7, 9)}


Mar - 195895049 - Sarah O 195895049 =MID(C147, 7, 9) OR 195895049
Jan - 938560385 - James D 938560385 =MID(C148, 7, 9) 938560385
Dec - 839948573 - Shaun H 839948573 =MID(C149, 7, 9) 839948573

2 Use any functions we have covered so far to extract the numbers between the ### symbols in the centre of the text strings below:

PO:144995535 - Company XYZ //


###489553### // Level 1 #NAME? See the steps below
PO:6422554 - Company BDKK //
###489544263### // Level 3 #NAME?
PO:495243 - Company RYHF //
###995533223### // Level 5 #NAME?
PO:00985733 - Company YT //
###9943### // Level 12 #NAME?

Step 1: Find location of the character after the first "###"

34 {=FIND("###", C155:C158) + 3}
33
32
32

Step 2: Find the location of the start of the second "###"

#NAME? {=FIND("###", C155:C158,_xlfn.anchorarray( C163) + 3)}


#NAME?
#NAME?
#NAME?

Step 3: Calculate the number of characters between the end of the first string and the start of the second string

#NAME? {=_xlfn.anchorarray(C171) -_xlfn.anchorarray( C163)}


#NAME?
#NAME?
#NAME?

Step 4: Return the characters between those string positions


#NAME? {=MID(C155:C158,_xlfn.anchorarray( C163),_xlfn.anchorarray( C180))}
#NAME?
#NAME?
#NAME?

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The SUBSTITUTE function

Syntax =Substitute(text, old_text, new_text, [instance_num])

text - The text that will be changed in some way


old_text - The text to be replaced
new_text - the text to replace with
instance_num - the instance of the text to be substituted - if left blank, all instances will be substituted

Key points
The SUBSTITUTE function allows you to replace text from within a text string.
You would use the SUBSTITUTE function over the REPLACE function when you want to replace text based on its content rather than its position.
You can optionally specify instances of the text identified that should be substituted.

Application

Let's say we want to remove the # symbols from the text string below:

###99300### 99300 =SUBSTITUTE(C19, "#", "")

You may alternatively prefer to set the adjustments up in separate, clearly visible input cells (although this could be overkill in certain situations):

text old_text new_text instance_num Converted


###99300### # 99300 =SUBSTITUTE(C25, D25, E25)
Bottle o a Battle =SUBSTITUTE(C26, D26, E26)
901184 - 643 - 3893 - 901184 643 3893 =SUBSTITUTE(C27, D27, E27)
903943 - 973 - 0854 - : 903943 : 973 : 0854 =SUBSTITUTE(C28, D28, E28)
983954 - 133 - 5939 - xx 983954 xx 133 xx 5939 =SUBSTITUTE(C29, D29, E29)

983954 - 133 - 5939 - xx 2 983954 - 133 xx 5939 =SUBSTITUTE(C31, D31, E31,F31)

Note: sometimes a simple Find & Replace can be a much quicker and simpler solution. The downside is that you lose the audit trail of your adjustments, and the adjustments will have to be repeated time after time if the source data changes

Counting specific characters in a text string

Here's a pretty neat way SUBSTITUTE can be used with LET to count the number of times a specific character is found within a text string:
Let's say we want to count the "-" characters below:

1573f821-af6e-4826-8bd7-63c10f701efb 4 =LEN(C42) - LEN(SUBSTITUTE(C42, "-", ""))


f46a8843-41cf-4ef6-at56-e37067a67149 4 =LEN(C43) - LEN(SUBSTITUTE(C43, "-", ""))
3b27d9e0-41f7-408c-98fe-6038eeab7261 4 =LEN(C44) - LEN(SUBSTITUTE(C44, "-", ""))
c4t30530-91d8-4508-b355-fb58a28046d3 4 =LEN(C45) - LEN(SUBSTITUTE(C45, "-", ""))
d11512d1-150b-47dr-990e-b134323debbf 4 =LEN(C46) - LEN(SUBSTITUTE(C46, "-", ""))
bd40b730-f76d-26db-857d-f1692b6fb8dh 4 =LEN(C47) - LEN(SUBSTITUTE(C47, "-", ""))

This formula works by removing the number of instances the character occurs from the second LEN calculation, and then subtracting that number from the original LEN calculation
The difference between the two LEN calculations will always be the number of instances the character you're looking for occurs
Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Exercise 1

Please extract the individual elements from the text below using only the text functions we have covered so far i
Hint: use as many columns to the right as you like to separate out any elements of your formulas
The order of the data is as follows: First Name, Second Name, Customer Reference, Order Number, Product Re

Text String First Name


John Smith - 456832 - 110044 "A6052"
Jane West - 455612 - 110045 "A6852"
Bill Kane - 6556832 - 120044 "B6252"
Sarah Keen - 62156832 - 116644 "D456052"
William Clarkson - 455692 - 1261044 "C45"

Please extract the account number and description from the text below using only the text functions we have cov

Trial Balance Dec Balance Account


************ 1100015 XAA Lns & Advs to 1,000
************ 1100025 XAB Lns & Advs Bk 2,000
************ 1200003 Customers Advance 3,000
************ 1500017 Customer Advances 4,000
************ 1250126 GARD Fees Amt to 5,000
e text functions we have covered so far in this workbook:
ements of your formulas
r Reference, Order Number, Product Reference

Second Name Cust Ref Order no Product Ref

using only the text functions we have covered so far in this workbook:
************ 1100015 21
Description
Solution 1

Please extract the individual elements from the text below using only the text functions we have covered so far i
Hint: use as many columns to the right as you like to separate out any elements of your formulas
The order of the data is as follows: First Name, Second Name, Customer Reference, Order Number, Product Re

Text String First Name Second Name


John Smith - 456832 - 110044 "A6052" John Smith
Jane West - 455612 - 110045 "A6852" Jane West
Bill Kane - 6556832 - 120044 "B6252" Bill Kane
Sarah Keen - 62156832 - 116644 "D456052" Sarah Keen
William Clarkson - 455692 - 1261044 "C45" William Clarkson

Please extract the account number and description from the text below using only the text functions we have cov

Trial Balance Dec BalanceAccount Description


************ 1100015 XAA Lns & Advs to 1,000 1100015 XAA Lns & Advs to
************ 1100025 XAB Lns & Advs Bk 2,000 1100025 XAB Lns & Advs Bk
************ 1200003 Customers Advance 3,000 1200003 Customers Advance
************ 1500017 Customer Advances 4,000 1500017 Customer Advances
************ 1250126 GARD Fees Amt to 5,000 1250126 GARD Fees Amt to
we have covered so far in this workbook:

der Number, Product Reference

Cust Ref Order no Product Ref Length First space First Dash
456832 110044 A6052 36 5 12
455612 110045 A6852 35 5 11
6556832 120044 B6252 36 5 11
62156832 116644 D456052 40 6 12
455692 1261044 C45 41 8 18

xt functions we have covered so far in this workbook:


Second dash First Speech marks Second Speech marks
21 30 36
20 29 35
21 30 36
23 32 40
27 37 41
The TEXTSPLIT Function

Syntax = TEXTSPLIT(text, col_delimiter, [row_delimeter], [ignore_empty], [match_mode], [pad_with])


text - the text string that you're going to split
col_delimiter - the character or characters to delimit columns
row_delimIter - the character or characters to delimit rows (optional)
ignore_empty - control for ignoring empty values. TRUE = ignore. FALSE = preserve. Default is FALSE (optional)
match_mode - case sensitivity. 0 = enabled. 1 = disabled. Default is 0 (optional)
pad_with - value to pad missing values with in 2D arrays (optional)

Key points
The TEXTSPLIT function does exactly what it says it will do: it will split text, depending on some criteria and controls you manage within it
The result of your TEXTSPLIT will be an array that can span many rows or columns
For many Excel users, this is a powerful replacement or alternative to features and functions like Text-To-Columns, and LEFT, RIGHT, MID, etc

Let's start with a simple example

In this example TEXTSPLIT is used to separate the text before and after any "-" characters into separate columns

Jan - 144995535: Peter H #NAME? #NAME? {=_xlfn.textsplit(C21, "-")}


Mar - 195895049: Sarah O #NAME? #NAME? {=_xlfn.textsplit(C22, "-")}
Jan - 938560385: James D #NAME? #NAME? {=_xlfn.textsplit(C23, "-")}
Dec - 839948573: John H #NAME? #NAME? {=_xlfn.textsplit(C24, "-")}

The outputs on each row are horizontal arrays

The "array of an array" issue

You may have noticed that we didn't generate all of the output results in the example above from one cell this time (which is why we have four grey fill cells)
Currently, and we say that because we suspect this may change in a future update of Excel, there is an "array of an array" blocker with array functions like TEXTSPLIT.
By this we mean that Excel expects the output shape of an array input to match that of the input array.
So let's try the solution above with a single cell array formula:

Jan - 144995535: Peter H #NAME? {=_xlfn.textsplit(C35:C38, "-")}


Mar - 195895049: Sarah O #NAME?
Jan - 938560385: James D #NAME?
Dec - 839948573: John H #NAME?

The output generated is still an array, but it's limited to the shape of the input array, which means we can't use it to split the text strings by our " - " delimiter.
There is a way around this, if you really want to use TEXTSPLIT from one cell… but it's taking us down a bit of a rabbit hole. We'll show you this now, and then stop before we get too deep.

Jan - 144995535: Peter H #NAME? #NAME? {=_xlfn.textsplit(TEXTJOIN(";",,C43:C46), " - ", ";")}


Mar - 195895049: Sarah O #NAME? #NAME?
Jan - 938560385: James D #NAME? #NAME?
Dec - 839948573: John H #NAME? #NAME?

This slightly convoluted workaround uses TEXTJOIN, and a new delimiter, to take our initial range of cell text strings and bring them together into one string (joined together with this new delimiter ";")
From there we can then use TEXTSPLIT on this new consolidated text string, and use both the row and column delimiter parameters to split the text out as we originally desired.
A successful workaround, but equally we could just stick to the alternative solution we showed you at the top of this tab and copy paste multiple individual cell formulas using TEXTSPLIT
That's what we'll be doing for the rest of this worksheet.

Now let's look at some of the variations you can set up with TEXTSPLIT

In this example, the text is split into three separate columns as TEXTSPLIT has found two "-" characters to split by

Jan - 144995535 - Peter H #NAME? #NAME? #NAME? {=_xlfn.textsplit(C57, "-")}


Mar - 195895049 - Sarah O #NAME? #NAME? #NAME? {=_xlfn.textsplit(C58, "-")}
Jan - 938560385 - James D #NAME? #NAME? #NAME? {=_xlfn.textsplit(C59, "-")}
Dec - 839948573 - John H #NAME? #NAME? #NAME? {=_xlfn.textsplit(C60, "-")}

In this example, the text is split into three separate columns, but we're using two individual characters as delimiters and some curly brackets to allow TEXTSPLIT to work in this way

Jan - 144995535: Peter H #NAME? #NAME? #NAME? {=_xlfn.textsplit(C66, {"-",":"})}


Mar - 195895049: Sarah O #NAME? #NAME? #NAME? {=_xlfn.textsplit(C67, {"-",":"})}
Jan - 938560385: James D #NAME? #NAME? #NAME? {=_xlfn.textsplit(C68, {"-",":"})}
Dec - 839948573: John H #NAME? #NAME? #NAME? {=_xlfn.textsplit(C69, {"-",":"})}

In this example the additional comma is used to allow us to identify the "-" character as a row delimiter instead of a column delimiter
This just means the text is split by ROW rather than by COLUMN

Jan - 144995535 - Peter H #NAME? #NAME? #NAME? #NAME?


Mar - 195895049 - Sarah O #NAME? #NAME? #NAME? #NAME?
Jan - 938560385 - James D #NAME? #NAME? #NAME? #NAME?
Dec - 839948573 - John H

{=_xlfn.textsplit(C76,, "-")} {=_xlfn.textsplit(C77,, "-")} {=_xlfn.textsplit(C78,, "-")} {=_xlfn.textsplit(C79,, "-")}

Here's the same outcome with the original data structured horizontally:

Jan - 144995535 - Peter H Mar - 195895049 - Sarah O Jan - 938560385 - James D Dec - 839948573 - John H
#NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME?

{=_xlfn.textsplit(F86,, "-")} {=_xlfn.textsplit(G86,, "-")} {=_xlfn.textsplit(H86,, "-")} {=_xlfn.textsplit(I86,, "-")}


It's less likely that you'll use TEXTSPLIT in this way, because you tend not to manage data horizontally like this. But at least it is possible

John - Team A, Paul - Team B,


Stacey - Team A, Zack - Team A,
Sally - Team B, Claire - Team B

#NAME? #NAME? {=_xlfn.textsplit(C97, " - ", ", ")}


#NAME? #NAME? You can use both column and row delimiters to split the text in both directions at the same time
#NAME? #NAME?
#NAME? #NAME?
#NAME? #NAME?
#NAME? #NAME?

How to deal with empty values

In this context, "empty values" refers to the result when there are two delimiters next to each other.
In the example below, you'll see two "-" back to back. This leaves an empty space (cell highlighted in red fill) which has to be dealt with when you use TEXTSPLIT

Jan - 144995535 -- Peter H #NAME? #NAME? #NAME? #NAME? {=_xlfn.textsplit(C113, "-")}


Mar - 195895049 -- Sarah O #NAME? #NAME? #NAME? #NAME? Notice how empty values are not ignored by default (the cell highlighted in red on the left is the empty space between the two "-" characters
Jan - 938560385 -- James D #NAME? #NAME? #NAME? #NAME?
Dec - 839948573 -- John H #NAME? #NAME? #NAME? #NAME?

#NAME? #NAME? #NAME? #NAME? {=_xlfn.textsplit(C113, "-",,FALSE())}


#NAME? #NAME? #NAME? #NAME? This could also be achieved by entering FALSE in the [ignore_empty] control
#NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME?

#NAME? #NAME? #NAME? {=_xlfn.textsplit(C113, "-",,TRUE())}


#NAME? #NAME? #NAME? In this example, the [ignore_empty] control has been set to TRUE
#NAME? #NAME? #NAME? As a result, the additional blank column has been removed from the resulting array
#NAME? #NAME? #NAME?

How to deal with case sensitivity & padding

Tom vs Arron #NAME? #NAME? {=_xlfn.textsplit(C135," vs ")}


Sarah vs Paul #NAME? #NAME? By default, TEXTSPLIT is case sensitive.
Adam Vs Steve #NAME? You can see in this example that any variation to " vs " is not recognised as a delimiter by TEXTSPLIT
Susan vs dave #NAME? #NAME?
Richard VS BOB #NAME?

#NAME? #NAME? {=_xlfn.textsplit(C135," vs ",,,1)}


#NAME? #NAME? By switching the Match Mode to a 1, our formula now picks up all instances of "vs"
#NAME? #NAME?
#NAME? #NAME?
#NAME? #NAME?

#NAME? #NAME? {=PROPER(_xlfn.textsplit(C135," vs ",,,1))}


#NAME? #NAME? You can lean on other functions to resolve the capitalisation issues
#NAME? #NAME?
#NAME? #NAME?
#NAME? #NAME?

John - Team A, Paul - Team B,


Stacey, Zack - Team A, Sally -
Team B, Claire - Team B

#NAME? #NAME? {=_xlfn.textsplit(C158," - ", ", ")}


#NAME? #NAME? The final argument in the TEXTSPLIT function allows you to deal with any values that are missing, which can't be ignored completely because of the structure of the array produced
#NAME? #NAME? In this example, Stacey has no team listing, which means an #N/A is returned to maintain the overall structure of the array that is generated (#N/A is the default)
#NAME? #NAME?
#NAME? #NAME?
#NAME? #NAME?

#NAME? #NAME? {=_xlfn.textsplit(C158," - ", ", ",,,"No Team")}


#NAME? #NAME? In this example we've replaced the #N/A returned by default to a "No Team" text string
#NAME? #NAME?
#NAME? #NAME?
#NAME? #NAME?
#NAME? #NAME?

Exercise

1Split the text string into individual Excel cell references, vertically
Note: this is a merged cell

L9;I3;E12;D10;I3;L9;I4;O4;D12;H11;E14;J8;B6;M6;J10;A6;G15;H7;M7;M13;O7;E11;J12;J2;I7;E8;M14;O9;F7;F4;E3;E15;D12;C9;J6;M10;L9;L3;M11;M2

2Split the text string into individual Excel cell references, vertically
Note: this time there is more than one character type between each cell reference

L9;I3;E12;D10;I3;L9;I4;O4;D12;H11;E14;J8;B6;M6;J10;A6;G15;H7;M7;M13;O7;E11;J12;J2;I7;E8;M14;O9;F7;F4;E3;E15;D12;C9;J6;M10;L9;L3;M11;M2

Solution

1Split the text string into individual Excel cell references, vertically
Note: this is a merged cell

L9;I3;E12;D10;I3;L9;I4;O4;D12;H11;E14;J8;B6;M6;J10;A6;G15;H7;M7;M13;O7;E11;J12;J2;I7;E8;M14;O9;F7;F4;E3;E15;D12;C9;J6;M10;L9;L3;M11;M2

#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?

2Split the text string into individual Excel cell references, vertically
Note: this time there is more than one character type between each cell reference

L9;I3;E12;D10;I3;L9;I4;O4;D12:H11;E14;J8;B6;M6;J10;A6;G15;H7;M7;M13-O7;E11;J12;J2;I7;E8;M14;O9;F7;F4-E3;E15;D12;C9;J6;M10;L9;L3-M11;M2

#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The TEXTBEFORE & TEXTAFTER Functions

=TEXTBEFORE(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])


text - the text string that you're going to split
delimiter - the character(s) that delimit the text.
instance_num - the instance of the delimiter in text. Default is 1. [optional]
match_mode - case-sensitivity. 0 = enabled, 1 = disabled. Default is 0. [optional]
match_end - treat end of text as delimiter. 0 = disabled, 1 = enabled. Default is 0. [optional]
if_not_found - value to return when no match is found. #N/A is default. [optional]

=TEXTAFTER(text,delimiter,[instance_num],[match_mode],[match_end],[if_not_found])
text - the text string that you're going to split
delimiter - the character(s) that delimit the text.
instance_num - the instance of the delimiter in text. Default is 1. [optional]
match_mode - case-sensitivity. 0 = enabled, 1 = disabled. Default is 0. [optional]
match_end - treat end of text as delimiter. 0 = disabled, 1 = enabled. Default is 0. [optional]
if_not_found - value to return when no match is found. #N/A is default. [optional]

Key points
The TEXTBEFORE function returns the text that occurs before a given substring or delimiter.
In cases where multiple delimiters appear in the text, TEXTBEFORE can return text before the nth occurrence of the delimiter.
TEXTBEFORE can also extract text that occurs before a given delimiter when counting from the end of a text string (i.e., get the text before the second to last delimiter).
TEXTBEFORE takes six arguments, but only the first two are required for the function to work: "text" provides the text to process, and "delimiter" is the substring used to split the text.

The TEXTAFTER function returns the text that occurs after a given substring or delimiter.
In cases where multiple delimiters appear in the text, TEXTAFTER can return text after the nth occurrence of the delimiter.
TEXTAFTER can also extract text after a specific delimiter when counting from the end of a text string (i.e., get text after the second to the last delimiter).
TEXTAFTER takes six arguments, but only the first two are required for the function to work: "text" provides the text to process, and "delimiter" is the substring used to split the text.

Let's start with a simple example

In this example TEXTBEFORE is used to separate the text before the first "-" character:

Jan - 144995535: Peter H #NAME? =_xlfn.textbefore(C37, "-")


Mar - 195895049: Sarah O #NAME? =_xlfn.textbefore(C38, "-")
Jan - 938560385: James D #NAME? =_xlfn.textbefore(C39, "-")
Dec - 839948573: John H #NAME? =_xlfn.textbefore(C40, "-")

You can also reference arrays of cells with TEXTBEFORE and TEXTAFTER in the way we highlighted was an issue with TEXTSPLIT.
Why? Because the input array (range) and output array will always be the same shape (we don't lose any data we don't want to lose)

#NAME? {=_xlfn.textbefore(C37:C40, "-")}


#NAME?
#NAME?
#NAME?

#NAME? {=_xlfn.textafter(C37:C40, "-")}


#NAME?
#NAME?
#NAME?

Now let's look at some of the variations you can set up with TEXTBEFORE & TEXTAFTER

Jan - 144995535 - Peter H #NAME? {=_xlfn.textbefore(C62:C65, "-",2)}


Mar - 195895049 - Sarah O #NAME? In this example, the text is split before the second instance of the "-" delimiter
Jan - 938560385 - James D #NAME?
Dec - 839948573 - John H #NAME?

Jan - 144995535: Peter H #NAME? {=_xlfn.textbefore(C69:C72, {"-",":"},2)}


Mar - 195895049: Sarah O #NAME? In this example, the text is split before the second instance of either of the two delimiters listed (within the curly brackets)
Jan - 938560385: James D #NAME?
Dec - 839948573: John H #NAME?

In this example we're using the TRANSPOSE function to profile our output array horizontally, still based on a dynamic array formula entered into one cell

Jan - 144995535 - Peter H #NAME? #NAME? #NAME? #NAME?


Mar - 195895049 - Sarah O {=TRANSPOSE(_xlfn.textafter(C79:C82, "-",2))}
Jan - 938560385 - James D
Dec - 839948573 - John H

We can use negative instance numbers to count delimiters backwards (from the end of the text string)

Jan - 144995535 - Peter H - Down #NAME? {=_xlfn.textbefore(C90:C93, "-",-1)}


Mar - 195895049 - Sarah O - Up #NAME?
Jan - 938560385 - James D - Up #NAME?
Dec - 839948573 - John H - Down #NAME?

And finally, just as we saw with TEXTSPLIT, we can use curly brackets to include multiple delimiters at once

Ref: 338402_Tom Marshall: USA #NAME? {=_xlfn.textafter(C100:C104, {" - ",": ",". "}, -1)}
Ref: 469964402_Sharon Levet - England #NAME? In this formula, we're looking for the first instance of any of the delimiters listed, working backwards from the end of the text string
Ref: 9944738_Hannah Watts: Canada #NAME?
Ref: 338402_Philip Angle. Australia #NAME?
Ref: 338402_Pierre Grant: France #NAME?

How to deal with case sensitivity & padding

Tom vs Arron #NAME? {=_xlfn.textbefore(C111:C115," vs ")}


Sarah vs Paul #NAME? By default, TEXTBEFORE & TEXTAFTER are case sensitive.
Adam Vs Steve #NAME? You can see in this example that any variation to " vs " is not recognised as a delimiter by TEXTBEFORE
Susan vs dave #NAME?
richard VS Bob #NAME?

#NAME? {=_xlfn.textbefore(C111:C115," vs ",,1)}


#NAME? By switching the Match Mode to a 1, our formula now picks up all instances of "vs", no matter the capitalisation
#NAME?
#NAME?
#NAME?

#NAME? {=PROPER(_xlfn.textbefore(C111:C115," vs ",,1))}


#NAME? You can lean on other functions to resolve any other capitalisation issues ("Richard" vs "richard")
#NAME?
#NAME?
#NAME?

Exercise

1 For this exercise, see if you can solve the problem we dealt with in the early function worksheets (LEFT, RIGHT, LEN, FIND, MID), using TEXTBEFORE or TEXTAFTER
You just want to extract the day text string from the right hand side of the data set below

2018 - Month 3 - 3rd


2018 - Month 5 - 9th
2018 - Month 7 - 12th
2018 - Month 11 - 21st
2019 - Month 1 - 7th
2020 - Month 12 - 15th
2021 - Month 8 - 20th

2 Extract the full name of each individual from the data set below

John Smith - 456832 - 110044 "A6052"


Jane West - 455612 - 110045 "A6852"
Bill Kane - 6556832 - 120044 "B6252"
Sarah Keen - 62156832 - 116644 "D456052"
William Clarkson - 455692 - 1261044 "C45"

Solution

1 For this exercise, see if you can solve the problem we dealt with in the early function worksheets (LEFT, RIGHT, LEN, FIND, MID), using TEXTBEFORE or TEXTAFTER
You just want to extract the day text string from the right hand side of the data set below

2018 - Month 3 - 3rd #NAME?


2018 - Month 5 - 9th #NAME?
2018 - Month 7 - 12th #NAME?
2018 - Month 11 - 21st #NAME?
2019 - Month 1 - 7th #NAME?
2020 - Month 12 - 15th #NAME?
2021 - Month 8 - 20th #NAME?

That's much, much easier!

2 Extract the full name of each individual from the data set below

John Smith - 456832 - 110044 "A6052" #NAME?


Jane West - 455612 - 110045 "A6852" #NAME?
Bill Kane - 6556832 - 120044 "B6252" #NAME?
Sarah Keen - 62156832 - 116644 "D456052" #NAME?
William Clarkson - 455692 - 1261044 "C45" #NAME?

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Exercise 2

1 The data set below includes student names, test scores, and an overall comment.
Split the data up into relevant columns

Simon, 86, Very good


Sam, 86. Very Good
Tim, 60, OK
Claire. 94, Excellent
Grace - 40 - Fail
Gary, 60, OK
Liam, 70, Good
Greg: 99, Excellent
Solution 2

1 The data set below includes student names, test scores, and an overall comment.
Split the data up into relevant columns

Simon, 86, Very good #NAME? #NAME?


Sam, 86. Very Good #NAME? #NAME?
Tim, 60, OK #NAME? #NAME?
Claire. 94, Excellent #NAME? #NAME?
Grace - 40 - Fail #NAME? #NAME?
Gary, 60, OK #NAME? #NAME?
Liam, 70, Good #NAME? #NAME?
Greg: 99, Excellent #NAME? #NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
The XLOOKUP function

Syntax = XLOOKUP (lookup, lookup_array, return_array, [not_found], [match_mode], [search_mode])

lookup - The value that you want to match


lookup_array - The range of cells being searched through for the match value
return_array - The range of cells that you want to return a value from
[not_found] - Value to return if no match is found
[match_mode] - Defines how the match should be performed:
1 for next lower, -1 for next higher, 0 for exact match and 2 for a wildcard match
[search_mode] - 1 for search from first (default), -1 for search from last, 2 for binary search ascending, -2 for binary search descending.

Key points
XLOOKUP is a much-improved version of "older" lookup functions like VLOOKUP, HLOOKUP and INDEX MATCH
The function includes an optional argument for what to return if no match is found. This removes the need for separate error management functions.
As with other reference functions, we are able to choose an exact or approximate match using the match_mode argument.
XLOOKUP also includes the additional feature of defining whether the search is performed top to bottom or bottom to top using the search_mode argument.
The function can take advantage of the dynamic array engine, returning multiple entries for one formula.
The XLOOKUP function only works with a 365 licence and with Excel 2021. This raises a significant compatibility risk which you must consider if you intend to share your modelling work with other stakeholders.
In our opinion this is a much improved method for mapping tables of data, with the one (significant) caveat of compatibility risk.

Let's start with a simple example

Sarah has a list of products and their prices in a table:


We can use XLOOKUP to build a dynamic formula that will pull out the sales value for the product you choose in cell C33

Product Price
Chicken Pie £ 2.75
Lamb Pie £ 3.00
Vegetarian Pie £ 3.25
Pork Pie £ 3.15

Lamb Pie £ 3.00 =_xlfn.xlookup(C33, C28:C31, D28:D31)

In plain English:
Return the price of Lamb Pies from the product table

Let's take a closer look at the structure of the arguments in the formula

lookup - We want to find the price for Lamb Pie


lookup_array - We are looking for Lamb Pie in the range C28 to C31
return_array - The range D28 to D31 contains the product prices we want to choose from

What if our data is structured in rows rather than columns?

This time Sarah's list of products and their prices are in a table structured in rows:
We can still use XLOOKUP to build a dynamic formula that will pull out the sales value for the product selected

Product Chicken Pie Lamb Pie Vegetarian PiePork Pie


Price £ 2.75 £ 3.00 £ 3.25 £ 3.15

Lamb Pie £ 3.00 =_xlfn.xlookup(C52,C49:G49,C50:G50)

In plain English:
Return the price of Lamb Pie from the product table

What happens if the product we are looking for is not in the product table?

Let's see what happens if the product we are looking for is not in the product table, and how we can use the [not_found] argument to improve the result:

Product Price
Chicken Pie £ 2.75
Lamb Pie £ 3.00
Vegetarian Pie £ 3.25
Pork Pie £ 3.15

Apple Pie #NAME? =_xlfn.xlookup(C67,C62:C65,D62:D65)

In plain English:
Return the price of Apple Pie from the product table

As Apple Pie is not in the product table, XLOOKUP returns the error value #N/A

Before the introduction of XLOOKUP, we'd typically manage this error using the IFERROR function:

Apple Pie #NAME? =_xlfn.xlookup(C76,C62:C65,D62:D65)

We can keep the two functions separate by referring to the result value: Not found =IFERROR(G76,"Not found")

or nest the two functions together: Not found =IFERROR(_xlfn.xlookup(C76,C62:C65,D62:D65),"Not found")

We need to use IFERROR with care as it handles all errors in the same way and could mask a more serious #REF! or #VALUE! error.

So let's now use the [not_found] argument within XLOOKUP to improve the result:

Product Price
Chicken Pie £ 2.75
Lamb Pie £ 3.00
Vegetarian Pie £ 3.25
Pork Pie £ 3.15

Apple Pie #NAME? =_xlfn.xlookup(C92, C87:C90, D87:D90, "Not found")

In plain English:
Return the price of Apple Pie from the product table. If the result is not found then return "Not found".

How to use the match_mode argument

As with MATCH and other LOOKUP functions, it is possible to perform different types of match:

The optional match_mode argument defines how the match should be performed:

Description Match_mode
Exact match 0 (default)
Exact match or next lower -1
Exact match or next higher 1
Wildcard match 2

Let's see how the match-mode can be applied:

1. Exact match (0 or omitted)

Product Price
Chicken Pie £ 2.75
Lamb Pie £ 3.00
Vegetarian Pie £ 3.25
Pork Pie £ 3.15

Lamb Pie £ 3.00 =_xlfn.xlookup(C119, C114:C117, D114:D117, "Not found", 0)

In plain English:
Return the price of Lamb Pie from the product table. If the result is not found then return "Not found". Only return an exact match

2. Exact match or next lower (-1)

We would like to use the table below to assign an age to an age category

Age Category
0 0-9
10 10-19
20 20-29
30 30-39
40 40-59
60 60+

12 #NAME? =_xlfn.xlookup(C137, C130:C135, D130:D135, "Not found", -1)

In plain English:
Return the category for the age entered. This is achieved by searching from the bottom and finding the nearest lowest number to the age value entered.

3. Exact match or next higher (1)

We would like to use the table below to assign an age to an age category

Age Category
100 60-100
60 40-59
40 30-39
30 20-29
20 10-19
10 0-9

12 #NAME? =_xlfn.xlookup(C154,C147:C152,D147:D152,"Not found",1)

In plain English:
Return the category for the age entered. This is achieved by searching from the top and finding the nearest highest number to the age value entered.

4. Wildcard match

There are two wildcard types that we can use:

* (asterisk) - all
? (question mark) - any character (enter ? for each single wildcard character)

Location No. of Sightings


Hales Wood 131
Green Wood 397
Hakes Wood 56
Forest of Dean 649
Pile Wood 253
Quantock Wood 355

Starts with P: P* 253 =_xlfn.xlookup(D174, C167:C172, D167:D172, "Not found", 2)

Starts with Ha: Ha* 131 =_xlfn.xlookup(D176, C167:C172, D167:D172, "Not found", 2)

End with Wood *Wood 131 =_xlfn.xlookup(D178, C167:C172, D167:D172, "Not found", 2)

Contains of: *of* 649 =_xlfn.xlookup(D180, C167:C172, D167:D172, "Not found", 2)

Using the ?: Ha?es Wood 131 =_xlfn.xlookup(D182, C167:C172, D167:D172, "Not found", 2)

How to use the search_mode argument

The search_mode argument lets us choose the direction of the search - i.e. top to bottom (default) or bottom to top.

1. Top to bottom (1)

Product Price
Chicken Pie £ 5.00
Lamb Pie £ 3.00
Chicken Pie £ 10.00
Vegetarian Pie £ 3.25
Pork Pie £ 3.15

Chicken Pie £ 5.00 =_xlfn.xlookup(C197,C191:C195,D191:D195,"Not found",0,1)

In plain English:
Return the price of Chicken Pie from the product table. If the result is not found then return "Not found". Only return an exact match. Start the search from the top.

2. Bottom to top (-1)

Product Price
Chicken Pie £ 5.00
Lamb Pie £ 3.00
Chicken Pie £ 10.00
Vegetarian Pie £ 3.25
Pork Pie £ 3.15

Chicken Pie £ 10.00 =_xlfn.xlookup(C212,C206:C210,D206:D210,"Not found",0,-1)

In plain English:
Return the price of Chicken Pie from the product table. If the result is not found then return "Not found". Only return an exact match. Start the search from the bottom.

Note: if there are multiple matches, XLOOKUP will return the first it finds (depending on whether you have set the search mode to Top to Bottom or Bottom to Top)

Let's make it dynamic!

We can also leverage the new Dynamic Array functionality with XLOOKUP.

Dynamic Version 1 - Returning multiple lookup range values


Setting the return array to more than one column will return an array of results based on a formula that is entered into a single cell.
The results will then spill across the range as required.

Product Price Quantity Pro Quantity Sold


Chicken Pie £ 5.00 180 171
Lamb Pie £ 3.00 75 72
Vegetarian Pie £ 3.25 30 29

Chicken Pie

Price Quantity Produ Quantity Sold


#NAME? #NAME? #NAME? {=_xlfn.xlookup(C233,C229:C231,D229:F231,"Not found")}

The formula is only The formula automatically


entered in the first cell extends to columns D and
E

Dynamic Version 2 - Returning result from a single lookup range for multiple input values
If we instead use a range for our lookup values, we'll see the resulting formula spill in a different way:

Product Price
Chicken Pie £ 5.00
Lamb Pie £ 3.00
Vegetarian Pie £ 3.25

Chicken Pie
Lamb Pie The formula is only
entered in the first
cell
Price
#NAME? {=_xlfn.xlookup(C250:C251,C246:C248,D246:D248,"Not found")}
#NAME?
The formula automatically
extends down to a second
row

Attempt at Dynamic Version 3: Multiple inputs and output ranges (note - it doesn't work!)

Product Price Quantity Pro Quantity Sold


Chicken Pie £ 5.00 180 171
Lamb Pie £ 3.00 75 72
Vegetarian Pie £ 3.25 30 29

Chicken Pie
Lamb Pie
We may have expected the
formula to spill here as well,
Price Quantity Produ Quantity Sold but Excel doesn't allow this (at
#NAME? the moment) {=_xlfn.xlookup(C266:C267,C262:C264,D262:F264,"Not found")}
#NAME?
This time we're using a
range for both the input
values and the lookup
ranges.
The result is still a dynamic
array, but it's only extending
down (not across)

This is a theme we'll come back to. For now, just note that there are limitations when it comes to leaning on the new array features in Excel
If we try to set up a formula like this with both row and columns ranges as inputs, Excel will only return one element of them
We believe this may change in the future

Application

Sarah has some sales data from her sales till system. She also has some reference data that includes each product's price, cost and category.

Sarah would like to combine this data together to create one single data set that she can use for reporting

Till Data Reference Data

Market date Product Quantity Sold Product Unit Price Unit Cost Pie Category
02/01/18 Chicken Pies 171 Chicken Pies £ 8.00 £ 1.20 Meat Pie
02/01/18 Lamb Pies 72 Lamb Pies £ 8.50 £ 1.95 Meat Pie
02/01/18 Vegetarian Pies 29 Vegetarian Pie £ 7.50 £ 1.00 Veggie Pie
04/01/18 Chicken Pies 178
04/01/18 Lamb Pies 72
04/01/18 Vegetarian Pies 24
06/01/18 Chicken Pies 175
06/01/18 Lamb Pies 67
06/01/18 Vegetarian Pies 28
09/01/18 Chicken Pies 179
09/01/18 Lamb Pies 72

Combined Compare this to the equivalent INDEX MATCH formula:

Market date Product Quantity SoldUnit Price Unit Cost Pie Category Unit Price Unit Cost Pie Category
02/01/18 Chicken Pies 171 #NAME? #NAME? #NAME? £ 8.00 £ 1.20 Meat Pie
02/01/18 Lamb Pies 72 #NAME? #NAME? #NAME? £ 8.50 £ 1.95 Meat Pie
02/01/18 Vegetarian Pies 29 #NAME? #NAME? #NAME? £ 7.50 £ 1.00 Veggie Pie
04/01/18 Chicken Pies 178 #NAME? #NAME? #NAME? £ 8.00 £ 1.20 Meat Pie
04/01/18 Lamb Pies 72 #NAME? #NAME? #NAME? £ 8.50 £ 1.95 Meat Pie
04/01/18 Vegetarian Pies 24 #NAME? #NAME? #NAME? £ 7.50 £ 1.00 Veggie Pie
06/01/18 Chicken Pies 175 #NAME? #NAME? #NAME? £ 8.00 £ 1.20 Meat Pie
06/01/18 Lamb Pies 67 #NAME? #NAME? #NAME? £ 8.50 £ 1.95 Meat Pie
06/01/18 Vegetarian Pies 28 #NAME? #NAME? #NAME? £ 7.50 £ 1.00 Veggie Pie
09/01/18 Chicken Pies 179 #NAME? #NAME? #NAME? £ 8.00 £ 1.20 Meat Pie
09/01/18 Lamb Pies 72 #NAME? #NAME? #NAME? £ 8.50 £ 1.95 Meat Pie

2D Lookups

If you're familiar with INDEX MATCH (which we'll cover next), you may be familiar with the INDEX MATCH MATCH approach to perform a two dimensional lookup.
The good news is you can do exactly the same thing with an XLOOKUP nested within another XLOOKUP:

Jan Feb Mar Apr May Jun


Tom 45 28 32 36 62 11
Sarah 28 76 87 28 36 45
Alice 46 34 28 89 28 54

Input 1 Tom
Input 2 Mar
Result: #NAME? {=_xlfn.xlookup(D334, C329:C331, _xlfn.xlookup(D335, D328:I328, D329:I331))}

Once you get used to this nested structure you'll find it's even easier to use than INDEX MATCH MATCH)

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Exercise 3
Sarah has downloaded some data from her stock system:
Unit Of Measure
Product Ref Description Price Cost UoM Max Stock
SKU0001 Chicken Pie £ 8.00 £ 1.20 Each 300
SKU0002 Lamb Pie £ 8.50 £ 1.95 Each 150
SKU0003 Vegetarian Pie £ 7.50 £ 1.00 Each 205
SKU0004 Pork pie £ 8.00 £ 1.45 Each 450

1. Please use the XLOOKUP function to find the Cost of the product listed below

SKU0002

2. Please use the XLOOKUP function to find the Description for the product listed below

SKU0003

3. Please use the XLOOKUP function to find the Max Stock for the product listed below

Lamb Pie

4. Please use the XLOOKUP function to create a dynamic lookup that can return the appropriate data point based on the two dropdowns below

Max Stock
Pork pie

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Solution 3
Sarah has downloaded some data from her stock system:
Unit Of Measure
Product Ref Description Price Cost UoM Max Stock
SKU0001 Chicken Pie £ 8.00 £ 1.20 Each 300
SKU0002 Lamb Pie £ 8.50 £ 1.95 Each 150
SKU0003 Vegetarian Pie £ 7.50 £ 1.00 Each 205
SKU0004 Pork pie £ 8.00 £ 1.45 Each 450

1. Please use the XLOOKUP function to find the Cost of the product below

SKU0002

1.95

2. Please use the XLOOKUP function to find the Description for the product below

SKU0003

#NAME?

3. Please use the XLOOKUP function to find the Max Stock for the product below

Lamb Pie

150

4. Please use the XLOOKUP function to create a dynamic lookup that can return the appropriate data point based on the two dropdowns below

Max Stock
Pork pie
#NAME?

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Exercise 4

1) Sarah has downloaded some customer postcodes from her CRM system

Customer Postcode
Customer 1 SO22 6JD
Customer 3 YT49 8DD
Customer 4 PQ92 8BX
Customer 2 PD32 9WE

Customer: Customer 2

Use the XLOOKUP function to return the postcode for customer 2:

2) Sarah would like to pull sales values from the table below:

Customer 946

The first customer number


ending in 1, starting from the
bottom of the data set

Customer 2017 Sales


CUST17 1,500
CUST485 2,700
CUST793 3,600
CUST480 9,000
CUST955 1,500
CUST310 10,000
CUST835 6,750
CUST266 2,000
CUST756 6,000
CUST961 1,500
CUST935 3,600
CUST467 1,500
CUST420 2,250
CUST103 700
CUST721 5,000
CUST329 500
CUST569 4,500
CUST572 2,000
CUST934 12,500
CUST146 4,500
CUST271 10,000
CUST606 2,700
CUST967 2,000
CUST173 3,500
CUST302 4,000
CUST425 1,000
CUST946 1,800
CUST65 1,800
CUST201 10,000
CUST27 2,000
CUST836 2,500

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Solution 4

1) Sarah has downloaded some customer postcodes from her CRM system

Customer Postcode
Customer 1 SO22 6JD
Customer 3 YT49 8DD
Customer 4 PQ92 8BX
Customer 2 PD32 9WE

Customer: Customer 2

Use the XLOOKUP function to return the postcode for customer 2: #NAME?

2) Sarah would like to pull sales values from the table below:

Customer 946 CUST946 1,800

The first customer number


ending in 1, starting from the *1
bottom of the data set 10,000

Customer 2017 Sales


CUST17 1,500
CUST485 2,700
CUST793 3,600
CUST480 9,000
CUST955 1,500
CUST310 10,000
CUST835 6,750
CUST266 2,000
CUST756 6,000
CUST961 1,500
CUST935 3,600
CUST467 1,500
CUST420 2,250
CUST103 700
CUST721 5,000
CUST329 500
CUST569 4,500
CUST572 2,000
CUST934 12,500
CUST146 4,500
CUST271 10,000
CUST606 2,700
CUST967 2,000
CUST173 3,500
CUST302 4,000
CUST425 1,000
CUST946 1,800
CUST65 1,800
CUST201 10,000
CUST27 2,000
CUST836 2,500

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Exercise 5

Sarah has some sales data from her sales till system. She also has some reference data on the Inputs tab that in
Sarah would like to enrich the table of data on this tab with the reference data on the Inputs tab to create one sin
The column headers describe what data you are being asked to create. Use XLOOKUP to enrich the data as req
Are you able to take advantage of Dynamic Array functionality so that you only have to enter a formula in column

Market date Location Product Quantity Produced Quantity Sold


02/01/18 London Chicken Pies 180 171
02/01/18 London Lamb Pies 75 72
02/01/18 London Vegetarian Pies 30 29
04/01/18 London Chicken Pies 180 178
04/01/18 London Lamb Pies 75 72
04/01/18 London Vegetarian Pies 30 24
06/01/18 London Chicken Pies 180 175
06/01/18 London Lamb Pies 75 67
06/01/18 London Vegetarian Pies 30 28
09/01/18 London Chicken Pies 180 179
09/01/18 London Lamb Pies 75 72
09/01/18 London Vegetarian Pies 30 28
11/01/18 London Chicken Pies 180 172
11/01/18 London Lamb Pies 75 62
11/01/18 London Vegetarian Pies 30 29
13/01/18 London Chicken Pies 180 179
13/01/18 London Lamb Pies 75 74
13/01/18 London Vegetarian Pies 30 27
16/01/18 London Chicken Pies 180 180
16/01/18 London Lamb Pies 75 73
16/01/18 London Vegetarian Pies 30 29
18/01/18 London Chicken Pies 180 178
18/01/18 London Lamb Pies 75 72
18/01/18 London Vegetarian Pies 30 28
20/01/18 London Chicken Pies 180 180
20/01/18 London Lamb Pies 75 75
20/01/18 London Vegetarian Pies 30 30
23/01/18 London Chicken Pies 180 173
23/01/18 London Lamb Pies 75 67
23/01/18 London Vegetarian Pies 30 26
25/01/18 London Chicken Pies 180 180
25/01/18 London Lamb Pies 75 74
25/01/18 London Vegetarian Pies 30 29
27/01/18 London Chicken Pies 180 180
27/01/18 London Lamb Pies 75 75
27/01/18 London Vegetarian Pies 30 26
30/01/18 London Chicken Pies 180 168
30/01/18 London Lamb Pies 75 73
30/01/18 London Vegetarian Pies 30 24
01/02/18 London Chicken Pies 180 179
01/02/18 London Lamb Pies 75 71
01/02/18 London Vegetarian Pies 30 23
03/02/18 London Chicken Pies 180 180
03/02/18 London Lamb Pies 75 75
03/02/18 London Vegetarian Pies 30 30
06/02/18 London Chicken Pies 180 173
06/02/18 London Lamb Pies 75 72
06/02/18 London Vegetarian Pies 30 26
08/02/18 London Chicken Pies 180 178
08/02/18 London Lamb Pies 75 74
08/02/18 London Vegetarian Pies 30 29
10/02/18 London Chicken Pies 180 180
10/02/18 London Lamb Pies 75 75
10/02/18 London Vegetarian Pies 30 29
13/02/18 London Chicken Pies 180 163
13/02/18 London Lamb Pies 75 71
13/02/18 London Vegetarian Pies 30 27
15/02/18 London Chicken Pies 180 178
15/02/18 London Lamb Pies 75 72
15/02/18 London Vegetarian Pies 30 25
17/02/18 London Chicken Pies 180 180
17/02/18 London Lamb Pies 75 75
17/02/18 London Vegetarian Pies 30 29
20/02/18 London Chicken Pies 180 171
20/02/18 London Lamb Pies 75 64
20/02/18 London Vegetarian Pies 30 25
22/02/18 London Chicken Pies 180 179
22/02/18 London Lamb Pies 75 74
22/02/18 London Vegetarian Pies 30 23
24/02/18 London Chicken Pies 180 180
24/02/18 London Lamb Pies 75 75
24/02/18 London Vegetarian Pies 30 30
27/02/18 London Chicken Pies 180 178
27/02/18 London Lamb Pies 75 64
27/02/18 London Vegetarian Pies 30 22
01/03/18 London Chicken Pies 180 178
01/03/18 London Lamb Pies 75 70
01/03/18 London Vegetarian Pies 30 23
03/03/18 London Chicken Pies 180 180
03/03/18 London Lamb Pies 75 75
03/03/18 London Vegetarian Pies 30 30
06/03/18 London Chicken Pies 180 174
06/03/18 London Lamb Pies 75 72
06/03/18 London Vegetarian Pies 30 22
08/03/18 London Chicken Pies 180 180
08/03/18 London Lamb Pies 75 72
08/03/18 London Vegetarian Pies 30 28
10/03/18 London Chicken Pies 180 180
10/03/18 London Lamb Pies 75 75
10/03/18 London Vegetarian Pies 30 25
13/03/18 London Chicken Pies 180 178
13/03/18 London Lamb Pies 75 72
13/03/18 London Vegetarian Pies 30 21
15/03/18 London Chicken Pies 180 180
15/03/18 London Lamb Pies 75 72
15/03/18 London Vegetarian Pies 30 27
17/03/18 London Chicken Pies 180 180
17/03/18 London Lamb Pies 75 75
17/03/18 London Vegetarian Pies 30 28
20/03/18 London Chicken Pies 180 178
20/03/18 London Lamb Pies 75 74
20/03/18 London Vegetarian Pies 30 20
22/03/18 London Chicken Pies 180 178
22/03/18 London Lamb Pies 75 69
22/03/18 London Vegetarian Pies 30 27
24/03/18 London Chicken Pies 180 180
24/03/18 London Lamb Pies 75 75
24/03/18 London Vegetarian Pies 30 30
27/03/18 London Chicken Pies 180 178
27/03/18 London Lamb Pies 75 72
27/03/18 London Vegetarian Pies 30 23
29/03/18 London Chicken Pies 180 180
29/03/18 London Lamb Pies 75 74
29/03/18 London Vegetarian Pies 30 27
31/03/18 London Chicken Pies 180 180
31/03/18 London Lamb Pies 75 74
31/03/18 London Vegetarian Pies 30 27
03/04/18 London Chicken Pies 180 174
03/04/18 London Lamb Pies 75 71
03/04/18 London Vegetarian Pies 30 26
05/04/18 London Chicken Pies 180 180
05/04/18 London Lamb Pies 75 75
05/04/18 London Vegetarian Pies 30 24
07/04/18 London Chicken Pies 180 180
07/04/18 London Lamb Pies 75 75
07/04/18 London Vegetarian Pies 30 30
10/04/18 London Chicken Pies 180 178
10/04/18 London Lamb Pies 75 71
10/04/18 London Vegetarian Pies 30 28
12/04/18 London Chicken Pies 180 180
12/04/18 London Lamb Pies 75 75
12/04/18 London Vegetarian Pies 30 30
14/04/18 London Chicken Pies 180 180
14/04/18 London Lamb Pies 75 75
14/04/18 London Vegetarian Pies 30 28
17/04/18 London Chicken Pies 180 180
17/04/18 London Lamb Pies 75 74
17/04/18 London Vegetarian Pies 30 26
19/04/18 London Chicken Pies 180 178
19/04/18 London Lamb Pies 75 71
19/04/18 London Vegetarian Pies 30 24
21/04/18 London Chicken Pies 180 180
21/04/18 London Lamb Pies 75 75
21/04/18 London Vegetarian Pies 30 30
24/04/18 London Chicken Pies 180 168
24/04/18 London Lamb Pies 75 67
24/04/18 London Vegetarian Pies 30 20
26/04/18 London Chicken Pies 180 180
26/04/18 London Lamb Pies 75 74
26/04/18 London Vegetarian Pies 30 28
28/04/18 London Chicken Pies 180 180
28/04/18 London Lamb Pies 75 75
28/04/18 London Vegetarian Pies 30 30
01/05/18 London Chicken Pies 180 178
01/05/18 London Lamb Pies 75 71
01/05/18 London Vegetarian Pies 30 28
03/05/18 London Chicken Pies 180 180
03/05/18 London Lamb Pies 75 70
03/05/18 London Vegetarian Pies 30 23
05/05/18 London Chicken Pies 180 180
05/05/18 London Lamb Pies 75 75
05/05/18 London Vegetarian Pies 30 30
08/05/18 London Chicken Pies 180 177
08/05/18 London Lamb Pies 75 70
08/05/18 London Vegetarian Pies 30 23
10/05/18 London Chicken Pies 180 180
10/05/18 London Lamb Pies 75 74
10/05/18 London Vegetarian Pies 30 27
12/05/18 London Chicken Pies 180 180
12/05/18 London Lamb Pies 75 75
12/05/18 London Vegetarian Pies 30 30
15/05/18 London Chicken Pies 180 180
15/05/18 London Lamb Pies 75 71
15/05/18 London Vegetarian Pies 30 25
17/05/18 London Chicken Pies 180 174
17/05/18 London Lamb Pies 75 70
17/05/18 London Vegetarian Pies 30 28
19/05/18 London Chicken Pies 180 180
19/05/18 London Lamb Pies 75 75
19/05/18 London Vegetarian Pies 30 30
22/05/18 London Chicken Pies 180 180
22/05/18 London Lamb Pies 75 75
22/05/18 London Vegetarian Pies 30 30
24/05/18 London Chicken Pies 180 180
24/05/18 London Lamb Pies 75 75
24/05/18 London Vegetarian Pies 30 28
26/05/18 London Chicken Pies 180 180
26/05/18 London Lamb Pies 75 75
26/05/18 London Vegetarian Pies 30 22
29/05/18 London Chicken Pies 180 177
29/05/18 London Lamb Pies 75 70
29/05/18 London Vegetarian Pies 30 22
31/05/18 London Chicken Pies 180 180
31/05/18 London Lamb Pies 75 70
31/05/18 London Vegetarian Pies 30 25
02/06/18 London Chicken Pies 180 180
02/06/18 London Lamb Pies 75 75
02/06/18 London Vegetarian Pies 30 30
05/06/18 London Chicken Pies 180 180
05/06/18 London Lamb Pies 75 70
05/06/18 London Vegetarian Pies 30 25
07/06/18 London Chicken Pies 180 180
07/06/18 London Lamb Pies 75 72
07/06/18 London Vegetarian Pies 30 27
09/06/18 London Chicken Pies 180 180
09/06/18 London Lamb Pies 75 70
09/06/18 London Vegetarian Pies 30 25
12/06/18 London Chicken Pies 180 180
12/06/18 London Lamb Pies 75 70
12/06/18 London Vegetarian Pies 30 22
14/06/18 London Chicken Pies 180 180
14/06/18 London Lamb Pies 75 75
14/06/18 London Vegetarian Pies 30 28
16/06/18 London Chicken Pies 180 180
16/06/18 London Lamb Pies 75 75
16/06/18 London Vegetarian Pies 30 30
19/06/18 London Chicken Pies 180 180
19/06/18 London Lamb Pies 75 70
19/06/18 London Vegetarian Pies 30 21
21/06/18 London Chicken Pies 180 180
21/06/18 London Lamb Pies 75 70
21/06/18 London Vegetarian Pies 30 25
23/06/18 London Chicken Pies 180 180
23/06/18 London Lamb Pies 75 75
23/06/18 London Vegetarian Pies 30 30
26/06/18 London Chicken Pies 180 180
26/06/18 London Lamb Pies 75 73
26/06/18 London Vegetarian Pies 30 27
28/06/18 London Chicken Pies 180 180
28/06/18 London Lamb Pies 75 75
28/06/18 London Vegetarian Pies 30 29
30/06/18 London Chicken Pies 180 180
30/06/18 London Lamb Pies 75 75
30/06/18 London Vegetarian Pies 30 30
on the Inputs tab that includes each product's price, cost and category.
s tab to create one single data set that she can use for reporting
o enrich the data as required below.
ter a formula in column G to populate columns G, H and I?

Pie Category Unit Price Unit Cost Sales


Cost of Sales Gross Margin
Model reference data

Product reference data

Pie Description Pie Category Unit Price Unit Cost


Chicken Pies Meat Pie £ 8.00 £ 1.20
Lamb Pies Meat Pie £ 8.50 £ 1.95
Vegetarian Pies Veggie Pie £ 7.50 £ 1.00
Exercise 5

Sarah has some sales data from her sales till system. She also has some reference data on the Inputs tab that inclu
Sarah would like to enrich the table of data on this tab with the reference data on the Inputs tab to create one single
The column headers describe what data you are being asked to create. Use XLOOKUP to enrich the data as requir
Are you able to take advantage of Dynamic Array functionality so that you only have to enter a formula in column G

Market date Location Product Quantity Produced Quantity Sold


02/01/18 London Chicken Pies 180 171
02/01/18 London Lamb Pies 75 72
02/01/18 London Vegetarian Pies 30 29
04/01/18 London Chicken Pies 180 178
04/01/18 London Lamb Pies 75 72
04/01/18 London Vegetarian Pies 30 24
06/01/18 London Chicken Pies 180 175
06/01/18 London Lamb Pies 75 67
06/01/18 London Vegetarian Pies 30 28
09/01/18 London Chicken Pies 180 179
09/01/18 London Lamb Pies 75 72
09/01/18 London Vegetarian Pies 30 28
11/01/18 London Chicken Pies 180 172
11/01/18 London Lamb Pies 75 62
11/01/18 London Vegetarian Pies 30 29
13/01/18 London Chicken Pies 180 179
13/01/18 London Lamb Pies 75 74
13/01/18 London Vegetarian Pies 30 27
16/01/18 London Chicken Pies 180 180
16/01/18 London Lamb Pies 75 73
16/01/18 London Vegetarian Pies 30 29
18/01/18 London Chicken Pies 180 178
18/01/18 London Lamb Pies 75 72
18/01/18 London Vegetarian Pies 30 28
20/01/18 London Chicken Pies 180 180
20/01/18 London Lamb Pies 75 75
20/01/18 London Vegetarian Pies 30 30
23/01/18 London Chicken Pies 180 173
23/01/18 London Lamb Pies 75 67
23/01/18 London Vegetarian Pies 30 26
25/01/18 London Chicken Pies 180 180
25/01/18 London Lamb Pies 75 74
25/01/18 London Vegetarian Pies 30 29
27/01/18 London Chicken Pies 180 180
27/01/18 London Lamb Pies 75 75
27/01/18 London Vegetarian Pies 30 26
30/01/18 London Chicken Pies 180 168
30/01/18 London Lamb Pies 75 73
30/01/18 London Vegetarian Pies 30 24
01/02/18 London Chicken Pies 180 179
01/02/18 London Lamb Pies 75 71
01/02/18 London Vegetarian Pies 30 23
03/02/18 London Chicken Pies 180 180
03/02/18 London Lamb Pies 75 75
03/02/18 London Vegetarian Pies 30 30
06/02/18 London Chicken Pies 180 173
06/02/18 London Lamb Pies 75 72
06/02/18 London Vegetarian Pies 30 26
08/02/18 London Chicken Pies 180 178
08/02/18 London Lamb Pies 75 74
08/02/18 London Vegetarian Pies 30 29
10/02/18 London Chicken Pies 180 180
10/02/18 London Lamb Pies 75 75
10/02/18 London Vegetarian Pies 30 29
13/02/18 London Chicken Pies 180 163
13/02/18 London Lamb Pies 75 71
13/02/18 London Vegetarian Pies 30 27
15/02/18 London Chicken Pies 180 178
15/02/18 London Lamb Pies 75 72
15/02/18 London Vegetarian Pies 30 25
17/02/18 London Chicken Pies 180 180
17/02/18 London Lamb Pies 75 75
17/02/18 London Vegetarian Pies 30 29
20/02/18 London Chicken Pies 180 171
20/02/18 London Lamb Pies 75 64
20/02/18 London Vegetarian Pies 30 25
22/02/18 London Chicken Pies 180 179
22/02/18 London Lamb Pies 75 74
22/02/18 London Vegetarian Pies 30 23
24/02/18 London Chicken Pies 180 180
24/02/18 London Lamb Pies 75 75
24/02/18 London Vegetarian Pies 30 30
27/02/18 London Chicken Pies 180 178
27/02/18 London Lamb Pies 75 64
27/02/18 London Vegetarian Pies 30 22
01/03/18 London Chicken Pies 180 178
01/03/18 London Lamb Pies 75 70
01/03/18 London Vegetarian Pies 30 23
03/03/18 London Chicken Pies 180 180
03/03/18 London Lamb Pies 75 75
03/03/18 London Vegetarian Pies 30 30
06/03/18 London Chicken Pies 180 174
06/03/18 London Lamb Pies 75 72
06/03/18 London Vegetarian Pies 30 22
08/03/18 London Chicken Pies 180 180
08/03/18 London Lamb Pies 75 72
08/03/18 London Vegetarian Pies 30 28
10/03/18 London Chicken Pies 180 180
10/03/18 London Lamb Pies 75 75
10/03/18 London Vegetarian Pies 30 25
13/03/18 London Chicken Pies 180 178
13/03/18 London Lamb Pies 75 72
13/03/18 London Vegetarian Pies 30 21
15/03/18 London Chicken Pies 180 180
15/03/18 London Lamb Pies 75 72
15/03/18 London Vegetarian Pies 30 27
17/03/18 London Chicken Pies 180 180
17/03/18 London Lamb Pies 75 75
17/03/18 London Vegetarian Pies 30 28
20/03/18 London Chicken Pies 180 178
20/03/18 London Lamb Pies 75 74
20/03/18 London Vegetarian Pies 30 20
22/03/18 London Chicken Pies 180 178
22/03/18 London Lamb Pies 75 69
22/03/18 London Vegetarian Pies 30 27
24/03/18 London Chicken Pies 180 180
24/03/18 London Lamb Pies 75 75
24/03/18 London Vegetarian Pies 30 30
27/03/18 London Chicken Pies 180 178
27/03/18 London Lamb Pies 75 72
27/03/18 London Vegetarian Pies 30 23
29/03/18 London Chicken Pies 180 180
29/03/18 London Lamb Pies 75 74
29/03/18 London Vegetarian Pies 30 27
31/03/18 London Chicken Pies 180 180
31/03/18 London Lamb Pies 75 74
31/03/18 London Vegetarian Pies 30 27
03/04/18 London Chicken Pies 180 174
03/04/18 London Lamb Pies 75 71
03/04/18 London Vegetarian Pies 30 26
05/04/18 London Chicken Pies 180 180
05/04/18 London Lamb Pies 75 75
05/04/18 London Vegetarian Pies 30 24
07/04/18 London Chicken Pies 180 180
07/04/18 London Lamb Pies 75 75
07/04/18 London Vegetarian Pies 30 30
10/04/18 London Chicken Pies 180 178
10/04/18 London Lamb Pies 75 71
10/04/18 London Vegetarian Pies 30 28
12/04/18 London Chicken Pies 180 180
12/04/18 London Lamb Pies 75 75
12/04/18 London Vegetarian Pies 30 30
14/04/18 London Chicken Pies 180 180
14/04/18 London Lamb Pies 75 75
14/04/18 London Vegetarian Pies 30 28
17/04/18 London Chicken Pies 180 180
17/04/18 London Lamb Pies 75 74
17/04/18 London Vegetarian Pies 30 26
19/04/18 London Chicken Pies 180 178
19/04/18 London Lamb Pies 75 71
19/04/18 London Vegetarian Pies 30 24
21/04/18 London Chicken Pies 180 180
21/04/18 London Lamb Pies 75 75
21/04/18 London Vegetarian Pies 30 30
24/04/18 London Chicken Pies 180 168
24/04/18 London Lamb Pies 75 67
24/04/18 London Vegetarian Pies 30 20
26/04/18 London Chicken Pies 180 180
26/04/18 London Lamb Pies 75 74
26/04/18 London Vegetarian Pies 30 28
28/04/18 London Chicken Pies 180 180
28/04/18 London Lamb Pies 75 75
28/04/18 London Vegetarian Pies 30 30
01/05/18 London Chicken Pies 180 178
01/05/18 London Lamb Pies 75 71
01/05/18 London Vegetarian Pies 30 28
03/05/18 London Chicken Pies 180 180
03/05/18 London Lamb Pies 75 70
03/05/18 London Vegetarian Pies 30 23
05/05/18 London Chicken Pies 180 180
05/05/18 London Lamb Pies 75 75
05/05/18 London Vegetarian Pies 30 30
08/05/18 London Chicken Pies 180 177
08/05/18 London Lamb Pies 75 70
08/05/18 London Vegetarian Pies 30 23
10/05/18 London Chicken Pies 180 180
10/05/18 London Lamb Pies 75 74
10/05/18 London Vegetarian Pies 30 27
12/05/18 London Chicken Pies 180 180
12/05/18 London Lamb Pies 75 75
12/05/18 London Vegetarian Pies 30 30
15/05/18 London Chicken Pies 180 180
15/05/18 London Lamb Pies 75 71
15/05/18 London Vegetarian Pies 30 25
17/05/18 London Chicken Pies 180 174
17/05/18 London Lamb Pies 75 70
17/05/18 London Vegetarian Pies 30 28
19/05/18 London Chicken Pies 180 180
19/05/18 London Lamb Pies 75 75
19/05/18 London Vegetarian Pies 30 30
22/05/18 London Chicken Pies 180 180
22/05/18 London Lamb Pies 75 75
22/05/18 London Vegetarian Pies 30 30
24/05/18 London Chicken Pies 180 180
24/05/18 London Lamb Pies 75 75
24/05/18 London Vegetarian Pies 30 28
26/05/18 London Chicken Pies 180 180
26/05/18 London Lamb Pies 75 75
26/05/18 London Vegetarian Pies 30 22
29/05/18 London Chicken Pies 180 177
29/05/18 London Lamb Pies 75 70
29/05/18 London Vegetarian Pies 30 22
31/05/18 London Chicken Pies 180 180
31/05/18 London Lamb Pies 75 70
31/05/18 London Vegetarian Pies 30 25
02/06/18 London Chicken Pies 180 180
02/06/18 London Lamb Pies 75 75
02/06/18 London Vegetarian Pies 30 30
05/06/18 London Chicken Pies 180 180
05/06/18 London Lamb Pies 75 70
05/06/18 London Vegetarian Pies 30 25
07/06/18 London Chicken Pies 180 180
07/06/18 London Lamb Pies 75 72
07/06/18 London Vegetarian Pies 30 27
09/06/18 London Chicken Pies 180 180
09/06/18 London Lamb Pies 75 70
09/06/18 London Vegetarian Pies 30 25
12/06/18 London Chicken Pies 180 180
12/06/18 London Lamb Pies 75 70
12/06/18 London Vegetarian Pies 30 22
14/06/18 London Chicken Pies 180 180
14/06/18 London Lamb Pies 75 75
14/06/18 London Vegetarian Pies 30 28
16/06/18 London Chicken Pies 180 180
16/06/18 London Lamb Pies 75 75
16/06/18 London Vegetarian Pies 30 30
19/06/18 London Chicken Pies 180 180
19/06/18 London Lamb Pies 75 70
19/06/18 London Vegetarian Pies 30 21
21/06/18 London Chicken Pies 180 180
21/06/18 London Lamb Pies 75 70
21/06/18 London Vegetarian Pies 30 25
23/06/18 London Chicken Pies 180 180
23/06/18 London Lamb Pies 75 75
23/06/18 London Vegetarian Pies 30 30
26/06/18 London Chicken Pies 180 180
26/06/18 London Lamb Pies 75 73
26/06/18 London Vegetarian Pies 30 27
28/06/18 London Chicken Pies 180 180
28/06/18 London Lamb Pies 75 75
28/06/18 London Vegetarian Pies 30 29
30/06/18 London Chicken Pies 180 180
30/06/18 London Lamb Pies 75 75
30/06/18 London Vegetarian Pies 30 30
the Inputs tab that includes each product's price, cost and category.
ab to create one single data set that she can use for reporting
nrich the data as required below.
a formula in column G to populate columns G, H and I?

Pie Category Unit Price Unit Cost Sales Cost of Sales


#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME?
Gross Margin
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
#NAME?
The INDEX function

Syntax =INDEX(array, row_num, col_num)

array - The range of cells that you want to return a value from
row_num - The position number of the row that you want to return a value for
col_num - The position number of the column that you want to return a value for

Key points
The INDEX function allows you to return a value from a given position within a range
It is one of the most widely used functions in financial modelling due to its flexibility and potential power (especially when used in conjunction with the MATCH function)
You can use INDEX to return individual values or entire rows and columns

Let's start with a simple example

Sarah has a list of products and their prices in a table:

Product Price
Chicken Pie £ 2.75
Lamb Pie £ 3.00
Vegetarian Pie £ 3.25
Pork pie £ 3.15

We can use the INDEX function to identify the range of values we want to choose from, and we manually enter the position of the specific value we want to return:

Excel returns: Vegetarian Pie =INDEX(C19:C22, 3)

In plain English:
Return the third item from the range C19 to C22

Instead of manually entering the position of the value we want to return, we can refer to another cell where the position can be entered:

Row 3 Vegetarian Pie {=INDEX(C19:C22, D33)}

Using INDEX across a row

Index can be used for ranges across rows or columns. Let's look at the same table of data, this time set across a number of columns:

Product Chicken Pie Lamb Pie Vegetarian Pie Pork pie


Sales £ 2.75 £ 3.00 £ 3.25 £ 3.15

Vegetarian Pie =INDEX(D40:G40, 3)

Column 3 Vegetarian Pie {=INDEX(D40:G40, D46)}

Column 3 This time let's reference row 41: £ 3.25 {=INDEX(D41:G41, D48)}

Application

INDEX can be used in financial models to pick values for scenarios:

Case ID 1 2 3 4 5
Case Worst Case Mid - 1 Mid - 2 Mid -3 Best Case
Sales value £20,000 £30,000 £40,000 £45,000 £50,000

Live Scenario 5

Live Scenario Title Best Case {=INDEX(D56:H56, D59)}


Live Scenario Sales value £50,000 {=INDEX(D57:H57, D59)}

Like a lot of companies, Sarah's business runs a financial year from April to March

Sarah could use INDEX to pick the fourth month in her financial year:

Apr-18
May-18
Jun-18
Jul-18
Aug-18
Sep-18
Oct-18
Nov-18
Dec-18
Jan-19
Feb-19
Mar-19

4 Jul-18 {=INDEX(C69:C80,C82)}

If Sarah wanted to pick the third day from a list of days of the week she could also use INDEX:

Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday

3 Wednesday =INDEX(C87:C93,C95)

Model Period Application

One of the best use cases for INDEX is to efficiently bring additional data through into modelling periods:

Imagine we have this list of inputs in our Inputs tab within a financial model:

Seasonality
Jan 140.00%
Feb 120.00%
Mar 90.00%
Apr 70.00%
May 60.00%
Jun 90.00%
Jul 150.00%
Aug 190.00%
Sep 150.00%
Oct 110.00%
Nov 80.00%
Dec 90.00%

And on the right we have an extract of some of the timeline data from our model:

Model Period 1 2 3 4 5 6 7 8 9 10 11 12 13
Period Start Date 1/1/2024 2/1/2024 3/1/2024 4/1/2024 5/1/2024 6/1/2024 7/1/2024 8/1/2024 9/1/2024 10/1/2024 11/1/2024 12/1/2024 1/1/2025
Period End Date 1/31/2024 2/29/2024 3/31/2024 4/30/2024 5/31/2024 6/30/2024 7/31/2024 8/31/2024 9/30/2024 10/31/2024 11/30/2024 12/31/2024 1/31/2025
We can use the natural order of the INDEX with months listed in order like this:
Month No. 1 2 3 4 5 6 7 8 9 10 11 12 1
Seasonality 140.00% 120.00% 90.00% 70.00% 60.00% 90.00% 150.00% 190.00% 150.00% 110.00% 80.00% 90.00% 140.00%

This successfully pulls through the seasonality data into a horizontal structure, without the need for any additional lookup references
Note: this approach doesn't have to align to months of the year. Essentially you can use INDEX like this to extract data from a range in order, so long as the numerical lookup number aligns properly to your lookup table

Exercises

Customer Postcode
Customer 1 SO22 6JD
Customer 2 PD32 9WE
Customer 3 YT49 8DD
Customer 4 PQ92 8BX

Use the INDEX function along with a separate input cell to allow a user to change the postcode that is generated:
Customer No. 2
INDEX Function:

Exercise Solutions

1) Postcodes from a table

Customer Postcode
Customer 1 SO22 6JD
Customer 2 PD32 9WE
Customer 3 YT49 8DD
Customer 4 PQ92 8BX

Use the INDEX function along with a separate input cell to allow a user to change the postcode that is generated:
Customer No. 2
INDEX Function: PD32 9WE

Limitations

Use the Index function to generate the 2017 sales for customer 946:

Index Function:

Customer 2017 Sales


CUST17 1500
CUST485 2700
CUST793 3600
CUST480 9000
CUST955 1500
CUST310 10000
CUST835 6750
CUST266 2000
CUST756 6000
CUST961 1500
CUST935 3600
CUST467 1500
CUST420 2250
CUST103 700
CUST721 5000
CUST329 500
CUST569 4500
CUST572 2000
CUST934 12500
CUST146 4500
CUST271 10000
CUST606 2700
CUST967 2000
CUST173 3500
CUST302 4000
CUST425 1000
CUST946 1800
CUST65 1800
CUST201 10000
CUST27 2000
CUST836 2500

For large lists it can be difficult to identify the position of the value you want to return.
This is why INDEX and MATCH tends to be used as a pair for larger data set lookups…
Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The MATCH function

Syntax =MATCH(lookup_value, lookup_array, match_type)

lookup_value - The value that you want to match


lookup_array - The range of cells being searched through for the match value
match_type - Defines how the match should be performed: 1 for next lower, -1 for next higher and 0 for exact match.

Key points
The MATCH function allows you to return the relative position of a chosen value from within a selected range.
MATCH will return a number which represents the position of the chosen value within the range.
When used in conjunction with INDEX it is extremely powerful, but let's just take the function on its own for now.
MATCH returns a #N/A error if no match is found.

Let's start with a simple example

Below is the same table of data we saw on the INDEX tab

This time, we're going to use MATCH to return the position of "Lamb Pie" within the selected range

Product Price
Chicken Pie £ 2.75
Lamb Pie £ 3.00
Vegetarian Pie £ 3.25
Pork pie £ 3.15

Lamb Pie 2 =MATCH(C28, C22:C25, 0)

In plain English:
What is the position of "Lamb Pie" in the range C22 to C25

Match type
The zero at the end of the function (the match type) means we have searched for the position of an exact match for "Lamb Pie"

Using MATCH across a row

We can equally use MATCH with a range of table / column headers

Chicken Pie Lamb Pie Vegetarian Pie Pork pie

Lamb Pie 2 =MATCH(C42, C40:F40, 0)

Match type

These are the match type options available to you within the MATCH function:
0 MATCH finds the first value that is an exact match to the lookup value.
1 (or omitted) MATCH finds the largest value that is less than or equal to the lookup value. The values in the range must be placed in ascending order for this to work.
-1 MATCH finds the smallest value that is more than or equal to the lookup value. The values in the range must be placed in descending order for this to work.

Note: Set match type to zero (0) if you need an exact match. The default setting of 1 can cause MATCH to return results that appears to be working but are in fact incorrect.

Let's look at a simple example of the three options

Ascending Order Descending Order

VALUE VALUE
- 2,000
250 1,750
500 1,500
750 1,250
1,000 1,000
1,250 750
1,500 500
1,750 250
2,000 -

Value to find: 275

Exact match, enter 0 as the match type #N/A =MATCH(E68, C58:C66, 0)

Largest value that is less than or equal to the lookup value, enter 1 2 =MATCH(E68, C58:C66, 1)

If nothing is entered in the match type it defaults to 1 2 =MATCH(E68, C58:C66)

Smallest value that is more than or equal to the lookup value, enter -1 7 =MATCH(E68, E58:E66, -1)

Application

Most of the time we will be using MATCH together with other functions such as INDEX.

In isolation, MATCH can be used to quickly determine whether or not an item is present in a list or not. For example:

Sarah would like to find out whether two postcodes (EC1A 1BB and BS4 3NF) exist in a table she has downloaded

Postcode
SO22 6JD
YT49 8DD
PQ92 8BX
PD32 9WE
EC1A 1BB
W1A 0AX
M1 1AE
B33 8TH
CR2 6XH
DN55 1PT

EC1A 1BB 5 =MATCH(C99, $C$88:$C$97,0)


BS4 3NF #N/A =MATCH(C100, $C$88:$C$97,0)

EC1A 1BB has been found in the table in position 5


BS4 3NF is not in the table so MATCH has returned #N/A

Sarah now knows that EC1A 1BB is in the list and BS4 3NF is not. COUNTIFS could also be used to perform this check.

Exercises

1) Customer position from a table

Customer Postcode
Customer 1 SO22 6JD
Customer 3 YT49 8DD
Customer 4 PQ92 8BX
Customer 2 PD32 9WE

Use the MATCH function to return the relative position of customer 2 within the range above:
Customer:

Exercise Solutions

1) Customer position from a table

Customer Postcode
Customer 1 SO22 6JD
Customer 3 YT49 8DD
Customer 4 PQ92 8BX
Customer 2 PD32 9WE

Use the MATCH function to return the relative position of customer 2 within the range above:
Customer: Customer 2 4

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Combining INDEX and MATCH

Syntax =INDEX(array, MATCH(lookup_value, lookup_array, match_type))

Key points
Used together INDEX and MATCH offer an extremely powerful method for looking up and returning specific items from a table of data.
It is more robust than HLOOKUP or VLOOKUP and we advise that it should be used instead of these functions.

Let's start with a simple example

If we turn to our table of product sales data again, we can use INDEX and MATCH together to build a dynamic formula that will pull out the sales value for the product you choose in cell B20
Try choosing a different product and see what happens to the price in cell G20

Product Price
Chicken Pie £ 2.75
Lamb Pie £ 3.00
Vegetarian Pie £ 3.25
Pork pie £ 3.15

Lamb Pie £ 3.00 =INDEX(D15:D18, MATCH(C20, C15:C18, 0))

In plain English:
INDEX and MATCH return the price of Lamb Pie from the table

Let's look at this broken down into its two elements, starting with the MATCH:

What is the position of Lamb Pie in the range C15 to C18 2 =MATCH(C20, C15:C18, 0)

Return the item in position 2 from the range D15 to D18 £ 3.00 {=INDEX(D15:D18, G28)}

We recommend splitting the MATCH element out from the INDEX when it makes sense to do so, as this improves the clarity and simplicity of your model

Application

Sarah has some sales data from her sales till system. She also has some reference data that includes each product's price, cost and category.

Sarah would like to combine this data together to create one single data set that she can use for reporting

Till Data Reference Data

Market date Product Quantity Sold Product Unit Price Unit Cost Pie Category
02/01/18 Chicken Pies 171 Chicken Pies £ 8.00 £ 1.20 Meat Pie
02/01/18 Lamb Pies 72 Lamb Pies £ 8.50 £ 1.95 Meat Pie
02/01/18 Vegetarian Pies 29 Vegetarian Pies £ 7.50 £ 1.00 Veggie Pie
04/01/18 Chicken Pies 178
04/01/18 Lamb Pies 72
04/01/18 Vegetarian Pies 24
06/01/18 Chicken Pies 175
06/01/18 Lamb Pies 67
06/01/18 Vegetarian Pies 28
09/01/18 Chicken Pies 179
09/01/18 Lamb Pies 72

Combined Below using INDEX MATCH for illustration

Market date Product Quantity Sold Product Match Pie Category Unit Price Unit Cost Pie Category Unit Price Unit Cost
02/01/18 Chicken Pies 171 1 Meat Pie £ 8.00 £ 1.20 Meat Pie £ 8.00 £ 1.20
02/01/18 Lamb Pies 72 2 Meat Pie £ 8.50 £ 1.95 Meat Pie £ 8.50 £ 1.95
02/01/18 Vegetarian Pies 29 3 Veggie Pie £ 7.50 £ 1.00 Veggie Pie £ 7.50 £ 1.00
04/01/18 Chicken Pies 178 1 Meat Pie £ 8.00 £ 1.20 Meat Pie £ 8.00 £ 1.20
04/01/18 Lamb Pies 72 2 Meat Pie £ 8.50 £ 1.95 Meat Pie £ 8.50 £ 1.95
04/01/18 Vegetarian Pies 24 3 Veggie Pie £ 7.50 £ 1.00 Veggie Pie £ 7.50 £ 1.00
06/01/18 Chicken Pies 175 1 Meat Pie £ 8.00 £ 1.20 Meat Pie £ 8.00 £ 1.20
06/01/18 Lamb Pies 67 2 Meat Pie £ 8.50 £ 1.95 Meat Pie £ 8.50 £ 1.95
06/01/18 Vegetarian Pies 28 3 Veggie Pie £ 7.50 £ 1.00 Veggie Pie £ 7.50 £ 1.00
09/01/18 Chicken Pies 179 1 Meat Pie £ 8.00 £ 1.20 Meat Pie £ 8.00 £ 1.20
09/01/18 Lamb Pies 72 2 Meat Pie £ 8.50 £ 1.95 Meat Pie £ 8.50 £ 1.95

Note how the product match is performed just once in its own column and the three INDEX functions are then kept nice and simple
Compare this to the INDEX MATCH formulas in columns K, L and M

Exercises

1) Customer postcode from a table

Customer Postcode
Customer 1 SO22 6JD
Customer 3 YT49 8DD
Customer 4 PQ92 8BX
Customer 2 PD32 9WE

Use the Match and INDEX functions separately to return the relative position of customer 2 within the range above:
Customer: Customer 2
Match Function:
Index Function

Combine INDEX and MATCH to perform the same action

Use the Index and Match functions to generate the 2017 sales for customer 946:

Customer: CUST946 or Match Function:


Index & Match Function: Index Function:

Customer 2017 Sales


CUST17 1,500
CUST485 2,700
CUST793 3,600
CUST480 9,000
CUST955 1,500
CUST310 10,000
CUST835 6,750
CUST266 2,000
CUST756 6,000
CUST961 1,500
CUST935 3,600
CUST467 1,500
CUST420 2,250
CUST103 700
CUST721 5,000
CUST329 500
CUST569 4,500
CUST572 2,000
CUST934 12,500
CUST146 4,500
CUST271 10,000
CUST606 2,700
CUST967 2,000
CUST173 3,500
CUST302 4,000
CUST425 1,000
CUST946 1,800
CUST65 1,800
CUST201 10,000
CUST27 2,000
CUST836 2,500

Exercise Solutions

1) Customer postcode from a table

Customer Postcode
Customer 1 SO22 6JD
Customer 3 YT49 8DD
Customer 4 PQ92 8BX
Customer 2 PD32 9WE

Use the Match and INDEX functions separately to return the relative position of customer 2 within the range above:
Customer: Customer 2
Match Function: 4
Index Function PD32 9WE

Combine INDEX and MATCH to perform the same action PD32 9WE

Use the Index and Match functions to generate the 2017 sales for customer 946:

Customer: CUST946 or Match Function: 27


Index & Match Function: 1800 Index Function: 1800

Customer 2017 Sales


CUST17 1,500
CUST485 2,700
CUST793 3,600
CUST480 9,000
CUST955 1,500
CUST310 10,000
CUST835 6,750
CUST266 2,000
CUST756 6,000
CUST961 1,500
CUST935 3,600
CUST467 1,500
CUST420 2,250
CUST103 700
CUST721 5,000
CUST329 500
CUST569 4,500
CUST572 2,000
CUST934 12,500
CUST146 4,500
CUST271 10,000
CUST606 2,700
CUST967 2,000
CUST173 3,500
CUST302 4,000
CUST425 1,000
CUST946 1,800
CUST65 1,800
CUST201 10,000
CUST27 2,000
CUST836 2,500

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The INDEX function - using two dimensions

Syntax =INDEX(array, row_num, col_num)

array - The range of cells that you want to analyse


row_num - The number of the row that you want to return a value for
col_num - The number of the column that you want to return a value for

Key points
The INDEX function can also return a value from within a two dimensional range, using a defined row and column position.
This essentially allows us to refer to tables of data rather than a single row or column range

Let's start with a simple example

Sarah has some sales quantity data from her till system. We can use INDEX to return a value from the data table:

Product January February March


Chicken Pie 20 25 30
Lamb Pie 70 10 60
Vegetarian Pie 40 35 30
Pork pie 50 40 20

Rather than pointing INDEX at a single row or column range, we are now going to point it at the range D18 to F21:

60 =INDEX(D18:F21, 2, 3)

In plain English:
Return the value from the cell that is in the second row and third column in the range D18 to F21

Just as we saw on the INDEX tab, instead of manually entering the position of the value we want to return, we can refer to other cells where the position can be entered:

Row 0
Column 3

30 {=INDEX(D18:F21,D33,D34)}
60
Of course it would be much more useful if we could make t 30
Let's see how we can combine a 2D INDEX with the MATCH 20

Using 0 to return everything

We can also use 0 to return the whole input range as an array instead of identifying specific rows and / or columns :

20 25 30 {=INDEX(D18:F21, 0, 0)}
70 10 60
40 35 30
50 40 20

Why might you use this, you may ask?


It's a harder answer now we have functions like CHOOSECOLS available to us, but in principle you could use this to extract specific rows or columns of data:

25 {=INDEX(D18:F21, 0, 2)}
10
35
40

Here's the TOCOLS version:

#NAME? {=_xlfn.choosecols(D18:F21,2)}
#NAME?
#NAME?
#NAME?

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Combining INDEX with two MATCH functions

Syntax =INDEX(array, MATCH(lookup_value, lookup_array, match_type) , MATCH(lookup_value, lookup_array, match_type))

Key points
We have already seen INDEX and MATCH come together to create a referencing tool that is very powerful, and widely used in financial models.
We can actually take this a step further, using MATCH twice to turn the 2D INDEX formula into something even more dynamic.
In most instances a simple one way INDEX MATCH is sufficient to solve a problem. But if you do need to dynamically reference both rows and columns then INDEX MATCH MATCH offers a way forward for you.

Let's start with a simple example

Here's our table of data again

Product January February March


Chicken Pie 20 25 30
Lamb Pie 70 10 60
Vegetarian Pie 40 35 30
Pork pie 50 40 20

Now we need to use MATCH twice within the INDEX function to reference both the product range and the month range

Lamb Pie January 70 =INDEX($D$15:$F$18, MATCH(C23, $C$15:$C$18, 0), MATCH(D23, $D$14:$F$14, 0))

Both MATCH functions required an exact match to work, so you see the "0" as the final element of both functions in the formula above

In plain English:
Return the quantity of Lamb Pie sold in January from the table range refered to

This is now quite a long and less straight-forward formula to follow, so let's pull it apart by separating the MATCH elements out from the INDEX:

Product Month Match row Match col Index Combined


Lamb Pie January 2 1 70 70 =INDEX($D$15:$F$18, MATCH(C34, $C$15:$C$18, 0), MATCH(D34, $D$14:$F$14, 0))
Vegetarian Pie February 3 2 35 35 =INDEX($D$15:$F$18, MATCH(C35, $C$15:$C$18, 0), MATCH(D35, $D$14:$F$14, 0))
Chicken Pie January 1 1 20 20 =INDEX($D$15:$F$18, MATCH(C36, $C$15:$C$18, 0), MATCH(D36, $D$14:$F$14, 0))

Exercise

Have a go at creating the same formulas you have just seen above in the grey cells below:

Product January February March


Chicken Pie 20 25 30
Lamb Pie 70 10 60
Vegetarian Pie 40 35 30
Pork pie 50 40 20

Product Month Match row Match col Index Combined


Pork pie March

Solution

Have a go at creating the same formulas you have just seen above in the grey cells below:

Product January February March


Chicken Pie 20 25 30
Lamb Pie 70 10 60
Vegetarian Pie 40 35 30
Pork pie 50 40 20

Product Month Match row Match col Index Combined


Pork pie March 4 3 20 20

Note: this is exactly what the nested XLOOKUP allowed us to do. It's still good to know INDEX MATCH though as you will, for some time yet we suspect, face issues of backwards compatibility (people you deal with have old versions of Excel that don't recognis

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Exercise 6

Sarah has some sales data from her sales till system. She also has some reference data on the Inputs_2 tab that inc
Sarah would like to enrich the table of data on this tab with the reference data on the Inputs_2 tab to create one sing
The column headers describe what data you being asked to create. INDEX and MATCH to enrich the data as requir

Market date Location Product Quantity Produced Quantity Sold


02/01/18 London Chicken Pies 180 171
02/01/18 London Lamb Pies 75 72
02/01/18 London Vegetarian Pies 30 29
04/01/18 London Chicken Pies 180 178
04/01/18 London Lamb Pies 75 72
04/01/18 London Vegetarian Pies 30 24
06/01/18 London Chicken Pies 180 175
06/01/18 London Lamb Pies 75 67
06/01/18 London Vegetarian Pies 30 28
09/01/18 London Chicken Pies 180 179
09/01/18 London Lamb Pies 75 72
09/01/18 London Vegetarian Pies 30 28
11/01/18 London Chicken Pies 180 172
11/01/18 London Lamb Pies 75 62
11/01/18 London Vegetarian Pies 30 29
13/01/18 London Chicken Pies 180 179
13/01/18 London Lamb Pies 75 74
13/01/18 London Vegetarian Pies 30 27
16/01/18 London Chicken Pies 180 180
16/01/18 London Lamb Pies 75 73
16/01/18 London Vegetarian Pies 30 29
18/01/18 London Chicken Pies 180 178
18/01/18 London Lamb Pies 75 72
18/01/18 London Vegetarian Pies 30 28
20/01/18 London Chicken Pies 180 180
20/01/18 London Lamb Pies 75 75
20/01/18 London Vegetarian Pies 30 30
23/01/18 London Chicken Pies 180 173
23/01/18 London Lamb Pies 75 67
23/01/18 London Vegetarian Pies 30 26
25/01/18 London Chicken Pies 180 180
25/01/18 London Lamb Pies 75 74
25/01/18 London Vegetarian Pies 30 29
27/01/18 London Chicken Pies 180 180
27/01/18 London Lamb Pies 75 75
27/01/18 London Vegetarian Pies 30 26
30/01/18 London Chicken Pies 180 168
30/01/18 London Lamb Pies 75 73
30/01/18 London Vegetarian Pies 30 24
01/02/18 London Chicken Pies 180 179
01/02/18 London Lamb Pies 75 71
01/02/18 London Vegetarian Pies 30 23
03/02/18 London Chicken Pies 180 180
03/02/18 London Lamb Pies 75 75
03/02/18 London Vegetarian Pies 30 30
06/02/18 London Chicken Pies 180 173
06/02/18 London Lamb Pies 75 72
06/02/18 London Vegetarian Pies 30 26
08/02/18 London Chicken Pies 180 178
08/02/18 London Lamb Pies 75 74
08/02/18 London Vegetarian Pies 30 29
10/02/18 London Chicken Pies 180 180
10/02/18 London Lamb Pies 75 75
10/02/18 London Vegetarian Pies 30 29
13/02/18 London Chicken Pies 180 163
13/02/18 London Lamb Pies 75 71
13/02/18 London Vegetarian Pies 30 27
15/02/18 London Chicken Pies 180 178
15/02/18 London Lamb Pies 75 72
15/02/18 London Vegetarian Pies 30 25
17/02/18 London Chicken Pies 180 180
17/02/18 London Lamb Pies 75 75
17/02/18 London Vegetarian Pies 30 29
20/02/18 London Chicken Pies 180 171
20/02/18 London Lamb Pies 75 64
20/02/18 London Vegetarian Pies 30 25
22/02/18 London Chicken Pies 180 179
22/02/18 London Lamb Pies 75 74
22/02/18 London Vegetarian Pies 30 23
24/02/18 London Chicken Pies 180 180
24/02/18 London Lamb Pies 75 75
24/02/18 London Vegetarian Pies 30 30
27/02/18 London Chicken Pies 180 178
27/02/18 London Lamb Pies 75 64
27/02/18 London Vegetarian Pies 30 22
01/03/18 London Chicken Pies 180 178
01/03/18 London Lamb Pies 75 70
01/03/18 London Vegetarian Pies 30 23
03/03/18 London Chicken Pies 180 180
03/03/18 London Lamb Pies 75 75
03/03/18 London Vegetarian Pies 30 30
06/03/18 London Chicken Pies 180 174
06/03/18 London Lamb Pies 75 72
06/03/18 London Vegetarian Pies 30 22
08/03/18 London Chicken Pies 180 180
08/03/18 London Lamb Pies 75 72
08/03/18 London Vegetarian Pies 30 28
10/03/18 London Chicken Pies 180 180
10/03/18 London Lamb Pies 75 75
10/03/18 London Vegetarian Pies 30 25
13/03/18 London Chicken Pies 180 178
13/03/18 London Lamb Pies 75 72
13/03/18 London Vegetarian Pies 30 21
15/03/18 London Chicken Pies 180 180
15/03/18 London Lamb Pies 75 72
15/03/18 London Vegetarian Pies 30 27
17/03/18 London Chicken Pies 180 180
17/03/18 London Lamb Pies 75 75
17/03/18 London Vegetarian Pies 30 28
20/03/18 London Chicken Pies 180 178
20/03/18 London Lamb Pies 75 74
20/03/18 London Vegetarian Pies 30 20
22/03/18 London Chicken Pies 180 178
22/03/18 London Lamb Pies 75 69
22/03/18 London Vegetarian Pies 30 27
24/03/18 London Chicken Pies 180 180
24/03/18 London Lamb Pies 75 75
24/03/18 London Vegetarian Pies 30 30
27/03/18 London Chicken Pies 180 178
27/03/18 London Lamb Pies 75 72
27/03/18 London Vegetarian Pies 30 23
29/03/18 London Chicken Pies 180 180
29/03/18 London Lamb Pies 75 74
29/03/18 London Vegetarian Pies 30 27
31/03/18 London Chicken Pies 180 180
31/03/18 London Lamb Pies 75 74
31/03/18 London Vegetarian Pies 30 27
03/04/18 London Chicken Pies 180 174
03/04/18 London Lamb Pies 75 71
03/04/18 London Vegetarian Pies 30 26
05/04/18 London Chicken Pies 180 180
05/04/18 London Lamb Pies 75 75
05/04/18 London Vegetarian Pies 30 24
07/04/18 London Chicken Pies 180 180
07/04/18 London Lamb Pies 75 75
07/04/18 London Vegetarian Pies 30 30
10/04/18 London Chicken Pies 180 178
10/04/18 London Lamb Pies 75 71
10/04/18 London Vegetarian Pies 30 28
12/04/18 London Chicken Pies 180 180
12/04/18 London Lamb Pies 75 75
12/04/18 London Vegetarian Pies 30 30
14/04/18 London Chicken Pies 180 180
14/04/18 London Lamb Pies 75 75
14/04/18 London Vegetarian Pies 30 28
17/04/18 London Chicken Pies 180 180
17/04/18 London Lamb Pies 75 74
17/04/18 London Vegetarian Pies 30 26
19/04/18 London Chicken Pies 180 178
19/04/18 London Lamb Pies 75 71
19/04/18 London Vegetarian Pies 30 24
21/04/18 London Chicken Pies 180 180
21/04/18 London Lamb Pies 75 75
21/04/18 London Vegetarian Pies 30 30
24/04/18 London Chicken Pies 180 168
24/04/18 London Lamb Pies 75 67
24/04/18 London Vegetarian Pies 30 20
26/04/18 London Chicken Pies 180 180
26/04/18 London Lamb Pies 75 74
26/04/18 London Vegetarian Pies 30 28
28/04/18 London Chicken Pies 180 180
28/04/18 London Lamb Pies 75 75
28/04/18 London Vegetarian Pies 30 30
01/05/18 London Chicken Pies 180 178
01/05/18 London Lamb Pies 75 71
01/05/18 London Vegetarian Pies 30 28
03/05/18 London Chicken Pies 180 180
03/05/18 London Lamb Pies 75 70
03/05/18 London Vegetarian Pies 30 23
05/05/18 London Chicken Pies 180 180
05/05/18 London Lamb Pies 75 75
05/05/18 London Vegetarian Pies 30 30
08/05/18 London Chicken Pies 180 177
08/05/18 London Lamb Pies 75 70
08/05/18 London Vegetarian Pies 30 23
10/05/18 London Chicken Pies 180 180
10/05/18 London Lamb Pies 75 74
10/05/18 London Vegetarian Pies 30 27
12/05/18 London Chicken Pies 180 180
12/05/18 London Lamb Pies 75 75
12/05/18 London Vegetarian Pies 30 30
15/05/18 London Chicken Pies 180 180
15/05/18 London Lamb Pies 75 71
15/05/18 London Vegetarian Pies 30 25
17/05/18 London Chicken Pies 180 174
17/05/18 London Lamb Pies 75 70
17/05/18 London Vegetarian Pies 30 28
19/05/18 London Chicken Pies 180 180
19/05/18 London Lamb Pies 75 75
19/05/18 London Vegetarian Pies 30 30
22/05/18 London Chicken Pies 180 180
22/05/18 London Lamb Pies 75 75
22/05/18 London Vegetarian Pies 30 30
24/05/18 London Chicken Pies 180 180
24/05/18 London Lamb Pies 75 75
24/05/18 London Vegetarian Pies 30 28
26/05/18 London Chicken Pies 180 180
26/05/18 London Lamb Pies 75 75
26/05/18 London Vegetarian Pies 30 22
29/05/18 London Chicken Pies 180 177
29/05/18 London Lamb Pies 75 70
29/05/18 London Vegetarian Pies 30 22
31/05/18 London Chicken Pies 180 180
31/05/18 London Lamb Pies 75 70
31/05/18 London Vegetarian Pies 30 25
02/06/18 London Chicken Pies 180 180
02/06/18 London Lamb Pies 75 75
02/06/18 London Vegetarian Pies 30 30
05/06/18 London Chicken Pies 180 180
05/06/18 London Lamb Pies 75 70
05/06/18 London Vegetarian Pies 30 25
07/06/18 London Chicken Pies 180 180
07/06/18 London Lamb Pies 75 72
07/06/18 London Vegetarian Pies 30 27
09/06/18 London Chicken Pies 180 180
09/06/18 London Lamb Pies 75 70
09/06/18 London Vegetarian Pies 30 25
12/06/18 London Chicken Pies 180 180
12/06/18 London Lamb Pies 75 70
12/06/18 London Vegetarian Pies 30 22
14/06/18 London Chicken Pies 180 180
14/06/18 London Lamb Pies 75 75
14/06/18 London Vegetarian Pies 30 28
16/06/18 London Chicken Pies 180 180
16/06/18 London Lamb Pies 75 75
16/06/18 London Vegetarian Pies 30 30
19/06/18 London Chicken Pies 180 180
19/06/18 London Lamb Pies 75 70
19/06/18 London Vegetarian Pies 30 21
21/06/18 London Chicken Pies 180 180
21/06/18 London Lamb Pies 75 70
21/06/18 London Vegetarian Pies 30 25
23/06/18 London Chicken Pies 180 180
23/06/18 London Lamb Pies 75 75
23/06/18 London Vegetarian Pies 30 30
26/06/18 London Chicken Pies 180 180
26/06/18 London Lamb Pies 75 73
26/06/18 London Vegetarian Pies 30 27
28/06/18 London Chicken Pies 180 180
28/06/18 London Lamb Pies 75 75
28/06/18 London Vegetarian Pies 30 29
30/06/18 London Chicken Pies 180 180
30/06/18 London Lamb Pies 75 75
30/06/18 London Vegetarian Pies 30 30
ta on the Inputs_2 tab that includes each product's price, cost and category.
puts_2 tab to create one single data set that she can use for reporting
CH to enrich the data as required below.

Product Match Pie Category Unit Price Unit Cost


Sales Cost of Sales Gross Margin
Model reference data

Product reference data

Pie Description Pie Category Unit Price Unit Cost


Chicken Pies Meat Pie £ 8.00 £ 1.20
Lamb Pies Meat Pie £ 8.50 £ 1.95
Vegetarian Pies Veggie Pie £ 7.50 £ 1.00
Exercise 6

Sarah has some sales data from her sales till system. She also has some reference data on the Inputs_2 tab that inc
Sarah would like to enrich the table of data on this tab with the reference data on the Inputs_2 tab to create one sing
The column headers describe what data you being asked to create. INDEX and MATCH to enrich the data as requir
How does this compare to using XLOOKUP?

Market date Location Product Quantity Produced Quantity Sold


02/01/18 London Chicken Pies 180 171
02/01/18 London Lamb Pies 75 72
02/01/18 London Vegetarian Pies 30 29
04/01/18 London Chicken Pies 180 178
04/01/18 London Lamb Pies 75 72
04/01/18 London Vegetarian Pies 30 24
06/01/18 London Chicken Pies 180 175
06/01/18 London Lamb Pies 75 67
06/01/18 London Vegetarian Pies 30 28
09/01/18 London Chicken Pies 180 179
09/01/18 London Lamb Pies 75 72
09/01/18 London Vegetarian Pies 30 28
11/01/18 London Chicken Pies 180 172
11/01/18 London Lamb Pies 75 62
11/01/18 London Vegetarian Pies 30 29
13/01/18 London Chicken Pies 180 179
13/01/18 London Lamb Pies 75 74
13/01/18 London Vegetarian Pies 30 27
16/01/18 London Chicken Pies 180 180
16/01/18 London Lamb Pies 75 73
16/01/18 London Vegetarian Pies 30 29
18/01/18 London Chicken Pies 180 178
18/01/18 London Lamb Pies 75 72
18/01/18 London Vegetarian Pies 30 28
20/01/18 London Chicken Pies 180 180
20/01/18 London Lamb Pies 75 75
20/01/18 London Vegetarian Pies 30 30
23/01/18 London Chicken Pies 180 173
23/01/18 London Lamb Pies 75 67
23/01/18 London Vegetarian Pies 30 26
25/01/18 London Chicken Pies 180 180
25/01/18 London Lamb Pies 75 74
25/01/18 London Vegetarian Pies 30 29
27/01/18 London Chicken Pies 180 180
27/01/18 London Lamb Pies 75 75
27/01/18 London Vegetarian Pies 30 26
30/01/18 London Chicken Pies 180 168
30/01/18 London Lamb Pies 75 73
30/01/18 London Vegetarian Pies 30 24
01/02/18 London Chicken Pies 180 179
01/02/18 London Lamb Pies 75 71
01/02/18 London Vegetarian Pies 30 23
03/02/18 London Chicken Pies 180 180
03/02/18 London Lamb Pies 75 75
03/02/18 London Vegetarian Pies 30 30
06/02/18 London Chicken Pies 180 173
06/02/18 London Lamb Pies 75 72
06/02/18 London Vegetarian Pies 30 26
08/02/18 London Chicken Pies 180 178
08/02/18 London Lamb Pies 75 74
08/02/18 London Vegetarian Pies 30 29
10/02/18 London Chicken Pies 180 180
10/02/18 London Lamb Pies 75 75
10/02/18 London Vegetarian Pies 30 29
13/02/18 London Chicken Pies 180 163
13/02/18 London Lamb Pies 75 71
13/02/18 London Vegetarian Pies 30 27
15/02/18 London Chicken Pies 180 178
15/02/18 London Lamb Pies 75 72
15/02/18 London Vegetarian Pies 30 25
17/02/18 London Chicken Pies 180 180
17/02/18 London Lamb Pies 75 75
17/02/18 London Vegetarian Pies 30 29
20/02/18 London Chicken Pies 180 171
20/02/18 London Lamb Pies 75 64
20/02/18 London Vegetarian Pies 30 25
22/02/18 London Chicken Pies 180 179
22/02/18 London Lamb Pies 75 74
22/02/18 London Vegetarian Pies 30 23
24/02/18 London Chicken Pies 180 180
24/02/18 London Lamb Pies 75 75
24/02/18 London Vegetarian Pies 30 30
27/02/18 London Chicken Pies 180 178
27/02/18 London Lamb Pies 75 64
27/02/18 London Vegetarian Pies 30 22
01/03/18 London Chicken Pies 180 178
01/03/18 London Lamb Pies 75 70
01/03/18 London Vegetarian Pies 30 23
03/03/18 London Chicken Pies 180 180
03/03/18 London Lamb Pies 75 75
03/03/18 London Vegetarian Pies 30 30
06/03/18 London Chicken Pies 180 174
06/03/18 London Lamb Pies 75 72
06/03/18 London Vegetarian Pies 30 22
08/03/18 London Chicken Pies 180 180
08/03/18 London Lamb Pies 75 72
08/03/18 London Vegetarian Pies 30 28
10/03/18 London Chicken Pies 180 180
10/03/18 London Lamb Pies 75 75
10/03/18 London Vegetarian Pies 30 25
13/03/18 London Chicken Pies 180 178
13/03/18 London Lamb Pies 75 72
13/03/18 London Vegetarian Pies 30 21
15/03/18 London Chicken Pies 180 180
15/03/18 London Lamb Pies 75 72
15/03/18 London Vegetarian Pies 30 27
17/03/18 London Chicken Pies 180 180
17/03/18 London Lamb Pies 75 75
17/03/18 London Vegetarian Pies 30 28
20/03/18 London Chicken Pies 180 178
20/03/18 London Lamb Pies 75 74
20/03/18 London Vegetarian Pies 30 20
22/03/18 London Chicken Pies 180 178
22/03/18 London Lamb Pies 75 69
22/03/18 London Vegetarian Pies 30 27
24/03/18 London Chicken Pies 180 180
24/03/18 London Lamb Pies 75 75
24/03/18 London Vegetarian Pies 30 30
27/03/18 London Chicken Pies 180 178
27/03/18 London Lamb Pies 75 72
27/03/18 London Vegetarian Pies 30 23
29/03/18 London Chicken Pies 180 180
29/03/18 London Lamb Pies 75 74
29/03/18 London Vegetarian Pies 30 27
31/03/18 London Chicken Pies 180 180
31/03/18 London Lamb Pies 75 74
31/03/18 London Vegetarian Pies 30 27
03/04/18 London Chicken Pies 180 174
03/04/18 London Lamb Pies 75 71
03/04/18 London Vegetarian Pies 30 26
05/04/18 London Chicken Pies 180 180
05/04/18 London Lamb Pies 75 75
05/04/18 London Vegetarian Pies 30 24
07/04/18 London Chicken Pies 180 180
07/04/18 London Lamb Pies 75 75
07/04/18 London Vegetarian Pies 30 30
10/04/18 London Chicken Pies 180 178
10/04/18 London Lamb Pies 75 71
10/04/18 London Vegetarian Pies 30 28
12/04/18 London Chicken Pies 180 180
12/04/18 London Lamb Pies 75 75
12/04/18 London Vegetarian Pies 30 30
14/04/18 London Chicken Pies 180 180
14/04/18 London Lamb Pies 75 75
14/04/18 London Vegetarian Pies 30 28
17/04/18 London Chicken Pies 180 180
17/04/18 London Lamb Pies 75 74
17/04/18 London Vegetarian Pies 30 26
19/04/18 London Chicken Pies 180 178
19/04/18 London Lamb Pies 75 71
19/04/18 London Vegetarian Pies 30 24
21/04/18 London Chicken Pies 180 180
21/04/18 London Lamb Pies 75 75
21/04/18 London Vegetarian Pies 30 30
24/04/18 London Chicken Pies 180 168
24/04/18 London Lamb Pies 75 67
24/04/18 London Vegetarian Pies 30 20
26/04/18 London Chicken Pies 180 180
26/04/18 London Lamb Pies 75 74
26/04/18 London Vegetarian Pies 30 28
28/04/18 London Chicken Pies 180 180
28/04/18 London Lamb Pies 75 75
28/04/18 London Vegetarian Pies 30 30
01/05/18 London Chicken Pies 180 178
01/05/18 London Lamb Pies 75 71
01/05/18 London Vegetarian Pies 30 28
03/05/18 London Chicken Pies 180 180
03/05/18 London Lamb Pies 75 70
03/05/18 London Vegetarian Pies 30 23
05/05/18 London Chicken Pies 180 180
05/05/18 London Lamb Pies 75 75
05/05/18 London Vegetarian Pies 30 30
08/05/18 London Chicken Pies 180 177
08/05/18 London Lamb Pies 75 70
08/05/18 London Vegetarian Pies 30 23
10/05/18 London Chicken Pies 180 180
10/05/18 London Lamb Pies 75 74
10/05/18 London Vegetarian Pies 30 27
12/05/18 London Chicken Pies 180 180
12/05/18 London Lamb Pies 75 75
12/05/18 London Vegetarian Pies 30 30
15/05/18 London Chicken Pies 180 180
15/05/18 London Lamb Pies 75 71
15/05/18 London Vegetarian Pies 30 25
17/05/18 London Chicken Pies 180 174
17/05/18 London Lamb Pies 75 70
17/05/18 London Vegetarian Pies 30 28
19/05/18 London Chicken Pies 180 180
19/05/18 London Lamb Pies 75 75
19/05/18 London Vegetarian Pies 30 30
22/05/18 London Chicken Pies 180 180
22/05/18 London Lamb Pies 75 75
22/05/18 London Vegetarian Pies 30 30
24/05/18 London Chicken Pies 180 180
24/05/18 London Lamb Pies 75 75
24/05/18 London Vegetarian Pies 30 28
26/05/18 London Chicken Pies 180 180
26/05/18 London Lamb Pies 75 75
26/05/18 London Vegetarian Pies 30 22
29/05/18 London Chicken Pies 180 177
29/05/18 London Lamb Pies 75 70
29/05/18 London Vegetarian Pies 30 22
31/05/18 London Chicken Pies 180 180
31/05/18 London Lamb Pies 75 70
31/05/18 London Vegetarian Pies 30 25
02/06/18 London Chicken Pies 180 180
02/06/18 London Lamb Pies 75 75
02/06/18 London Vegetarian Pies 30 30
05/06/18 London Chicken Pies 180 180
05/06/18 London Lamb Pies 75 70
05/06/18 London Vegetarian Pies 30 25
07/06/18 London Chicken Pies 180 180
07/06/18 London Lamb Pies 75 72
07/06/18 London Vegetarian Pies 30 27
09/06/18 London Chicken Pies 180 180
09/06/18 London Lamb Pies 75 70
09/06/18 London Vegetarian Pies 30 25
12/06/18 London Chicken Pies 180 180
12/06/18 London Lamb Pies 75 70
12/06/18 London Vegetarian Pies 30 22
14/06/18 London Chicken Pies 180 180
14/06/18 London Lamb Pies 75 75
14/06/18 London Vegetarian Pies 30 28
16/06/18 London Chicken Pies 180 180
16/06/18 London Lamb Pies 75 75
16/06/18 London Vegetarian Pies 30 30
19/06/18 London Chicken Pies 180 180
19/06/18 London Lamb Pies 75 70
19/06/18 London Vegetarian Pies 30 21
21/06/18 London Chicken Pies 180 180
21/06/18 London Lamb Pies 75 70
21/06/18 London Vegetarian Pies 30 25
23/06/18 London Chicken Pies 180 180
23/06/18 London Lamb Pies 75 75
23/06/18 London Vegetarian Pies 30 30
26/06/18 London Chicken Pies 180 180
26/06/18 London Lamb Pies 75 73
26/06/18 London Vegetarian Pies 30 27
28/06/18 London Chicken Pies 180 180
28/06/18 London Lamb Pies 75 75
28/06/18 London Vegetarian Pies 30 29
30/06/18 London Chicken Pies 180 180
30/06/18 London Lamb Pies 75 75
30/06/18 London Vegetarian Pies 30 30
the Inputs_2 tab that includes each product's price, cost and category.
2 tab to create one single data set that she can use for reporting
enrich the data as required below.

Product Match Pie Category Unit Price Unit Cost


1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
1 Meat Pie 8.00 1.20
2 Meat Pie 8.50 1.95
3 Veggie Pie 7.50 1.00
Sales Cost of Sales Gross Margin
1,368.00 205.20 1,162.80
612.00 140.40 471.60
217.50 29.00 188.50
1,424.00 213.60 1,210.40
612.00 140.40 471.60
180.00 24.00 156.00
1,400.00 210.00 1,190.00
569.50 130.65 438.85
210.00 28.00 182.00
1,432.00 214.80 1,217.20
612.00 140.40 471.60
210.00 28.00 182.00
1,376.00 206.40 1,169.60
527.00 120.90 406.10
217.50 29.00 188.50
1,432.00 214.80 1,217.20
629.00 144.30 484.70
202.50 27.00 175.50
1,440.00 216.00 1,224.00
620.50 142.35 478.15
217.50 29.00 188.50
1,424.00 213.60 1,210.40
612.00 140.40 471.60
210.00 28.00 182.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,384.00 207.60 1,176.40
569.50 130.65 438.85
195.00 26.00 169.00
1,440.00 216.00 1,224.00
629.00 144.30 484.70
217.50 29.00 188.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
195.00 26.00 169.00
1,344.00 201.60 1,142.40
620.50 142.35 478.15
180.00 24.00 156.00
1,432.00 214.80 1,217.20
603.50 138.45 465.05
172.50 23.00 149.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,384.00 207.60 1,176.40
612.00 140.40 471.60
195.00 26.00 169.00
1,424.00 213.60 1,210.40
629.00 144.30 484.70
217.50 29.00 188.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
217.50 29.00 188.50
1,304.00 195.60 1,108.40
603.50 138.45 465.05
202.50 27.00 175.50
1,424.00 213.60 1,210.40
612.00 140.40 471.60
187.50 25.00 162.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
217.50 29.00 188.50
1,368.00 205.20 1,162.80
544.00 124.80 419.20
187.50 25.00 162.50
1,432.00 214.80 1,217.20
629.00 144.30 484.70
172.50 23.00 149.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,424.00 213.60 1,210.40
544.00 124.80 419.20
165.00 22.00 143.00
1,424.00 213.60 1,210.40
595.00 136.50 458.50
172.50 23.00 149.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,392.00 208.80 1,183.20
612.00 140.40 471.60
165.00 22.00 143.00
1,440.00 216.00 1,224.00
612.00 140.40 471.60
210.00 28.00 182.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
187.50 25.00 162.50
1,424.00 213.60 1,210.40
612.00 140.40 471.60
157.50 21.00 136.50
1,440.00 216.00 1,224.00
612.00 140.40 471.60
202.50 27.00 175.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
210.00 28.00 182.00
1,424.00 213.60 1,210.40
629.00 144.30 484.70
150.00 20.00 130.00
1,424.00 213.60 1,210.40
586.50 134.55 451.95
202.50 27.00 175.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,424.00 213.60 1,210.40
612.00 140.40 471.60
172.50 23.00 149.50
1,440.00 216.00 1,224.00
629.00 144.30 484.70
202.50 27.00 175.50
1,440.00 216.00 1,224.00
629.00 144.30 484.70
202.50 27.00 175.50
1,392.00 208.80 1,183.20
603.50 138.45 465.05
195.00 26.00 169.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
180.00 24.00 156.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,424.00 213.60 1,210.40
603.50 138.45 465.05
210.00 28.00 182.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
210.00 28.00 182.00
1,440.00 216.00 1,224.00
629.00 144.30 484.70
195.00 26.00 169.00
1,424.00 213.60 1,210.40
603.50 138.45 465.05
180.00 24.00 156.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,344.00 201.60 1,142.40
569.50 130.65 438.85
150.00 20.00 130.00
1,440.00 216.00 1,224.00
629.00 144.30 484.70
210.00 28.00 182.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,424.00 213.60 1,210.40
603.50 138.45 465.05
210.00 28.00 182.00
1,440.00 216.00 1,224.00
595.00 136.50 458.50
172.50 23.00 149.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,416.00 212.40 1,203.60
595.00 136.50 458.50
172.50 23.00 149.50
1,440.00 216.00 1,224.00
629.00 144.30 484.70
202.50 27.00 175.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,440.00 216.00 1,224.00
603.50 138.45 465.05
187.50 25.00 162.50
1,392.00 208.80 1,183.20
595.00 136.50 458.50
210.00 28.00 182.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
210.00 28.00 182.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
165.00 22.00 143.00
1,416.00 212.40 1,203.60
595.00 136.50 458.50
165.00 22.00 143.00
1,440.00 216.00 1,224.00
595.00 136.50 458.50
187.50 25.00 162.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,440.00 216.00 1,224.00
595.00 136.50 458.50
187.50 25.00 162.50
1,440.00 216.00 1,224.00
612.00 140.40 471.60
202.50 27.00 175.50
1,440.00 216.00 1,224.00
595.00 136.50 458.50
187.50 25.00 162.50
1,440.00 216.00 1,224.00
595.00 136.50 458.50
165.00 22.00 143.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
210.00 28.00 182.00
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,440.00 216.00 1,224.00
595.00 136.50 458.50
157.50 21.00 136.50
1,440.00 216.00 1,224.00
595.00 136.50 458.50
187.50 25.00 162.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
1,440.00 216.00 1,224.00
620.50 142.35 478.15
202.50 27.00 175.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
217.50 29.00 188.50
1,440.00 216.00 1,224.00
637.50 146.25 491.25
225.00 30.00 195.00
The SUMIFS Function

Syntax =SUMIFS(sum_range, criteria_range1,criteria1,[criteria_range2],[criteria2]…)

sum_range - the range to be summed


criteria_range1 - the first range to be evaluated
criteria1 - the criteria to use for range 1
criteria_range2 - the second range to be evaluated
criteria1 - the criteria to use for range 2

Key points
The SUMIFS function sums the values in a range that meet a specified criteria, or set of criteria.
This function is not compatible with Excel 2003 or earlier versions.
We advise that you use SUMIFS over SUMIF in all instances (even when you have just one criteria). The order of function elements switches for SUMIF, and this can be confusing if you use both within a model.

Let's start with a simple data set

Below is a summary of market sales recorded by Sarah.


We'll use a simple SUM formula below the table, and then move on to use SUMIFS in a number of ways:

Month Day of week Product Quantity Sold


Jan Tuesday Chicken Pies 871
Jan Tuesday Lamb Pies 357
Jan Tuesday Vegetarian Pies 136
Jan Thursday Chicken Pies 708
Jan Thursday Lamb Pies 280
Jan Thursday Vegetarian Pies 110
Jan Saturday Chicken Pies 714
Jan Saturday Lamb Pies 291
Jan Saturday Vegetarian Pies 111
Feb Tuesday Chicken Pies 685
Feb Tuesday Lamb Pies 271
Feb Tuesday Vegetarian Pies 100
Feb Thursday Chicken Pies 714
Feb Thursday Lamb Pies 291
Feb Thursday Vegetarian Pies 100
Feb Saturday Chicken Pies 720
Feb Saturday Lamb Pies 300
Feb Saturday Vegetarian Pies 118
Mar Tuesday Chicken Pies 708
Mar Tuesday Lamb Pies 290
Mar Tuesday Vegetarian Pies 86
Mar Thursday Chicken Pies 896
Mar Thursday Lamb Pies 357
Mar Thursday Vegetarian Pies 132
Mar Saturday Chicken Pies 900
Mar Saturday Lamb Pies 374
Mar Saturday Vegetarian Pies 140
Apr Tuesday Chicken Pies 700
Apr Tuesday Lamb Pies 283
Apr Tuesday Vegetarian Pies 100
Apr Thursday Chicken Pies 718
Apr Thursday Lamb Pies 295
Apr Thursday Vegetarian Pies 106
Apr Saturday Chicken Pies 720
Apr Saturday Lamb Pies 300
Apr Saturday Vegetarian Pies 118
May Tuesday Chicken Pies 892
May Tuesday Lamb Pies 357
May Tuesday Vegetarian Pies 128
May Thursday Chicken Pies 894
May Thursday Lamb Pies 359
May Thursday Vegetarian Pies 131
May Saturday Chicken Pies 720
May Saturday Lamb Pies 300
May Saturday Vegetarian Pies 112
Jun Tuesday Chicken Pies 720
Jun Tuesday Lamb Pies 283
Jun Tuesday Vegetarian Pies 95
Jun Thursday Chicken Pies 720
Jun Thursday Lamb Pies 292
Jun Thursday Vegetarian Pies 109
Jun Saturday Chicken Pies 900
Jun Saturday Lamb Pies 370
Jun Saturday Vegetarian Pies 145

The total number of pies sold is 21,627 =SUM(F23:F76)

To start with let's look at using SUMIFS with one criteria

Rather than calculating the total quantity of pies sold, Sarah would like to know the total sales for a specific month:

We can use the SUMIFS function with a single criteria range for the month:

Month Jan 3,578 =SUMIFS($F$23:$F$76, $C$23:$C$76, D87)

Let's break the formula above down into its key elements

The syntax for SUMIFS is "=SUMIFS(sum_range, criteria_range1,criteria1,…)"

sum_range This is the range that contains the numbers that you want to sum up. In this case this is the range for the quantity sold in $F$23:$F$76
criteria_range1 This is the first range that contains the criteria that you want the sum calculation to be driven by. In this case this is the month range $C$23:$C$76
criteria1 This is the criteria for the first range that you want to base your sum calculation on. In this case this is month entered into cell D87

We could also list out the full results by month for Sarah:

Jan 3,578 =SUMIFS($F$23:$F$76, $C$23:$C$76, D100)


Feb 3,299 =SUMIFS($F$23:$F$76, $C$23:$C$76, D101)
Mar 3,883 =SUMIFS($F$23:$F$76, $C$23:$C$76, D102)
Apr 3,340 =SUMIFS($F$23:$F$76, $C$23:$C$76, D103)
May 3,893 =SUMIFS($F$23:$F$76, $C$23:$C$76, D104)
Jun 3,634 =SUMIFS($F$23:$F$76, $C$23:$C$76, D105)
TOTAL 21,627 =SUM(F100:F105)

What if Sarah wanted to see which day of the week has been best for sales:

Tuesday 7,062 =SUMIFS($F$23:$F$76, $D$23:$D$76, D110)


Thursday 7,212 =SUMIFS($F$23:$F$76, $D$23:$D$76, D111)
Saturday 7,353 =SUMIFS($F$23:$F$76, $D$23:$D$76, D112)
TOTAL 21,627

Or which product has sold the highest volume:

Chicken Pies 13,900 =SUMIFS($F$23:$F$76, $E$23:$E$76, D118)


Lamb Pies 5,650 =SUMIFS($F$23:$F$76, $E$23:$E$76, D119)
Vegetarian Pies 2,077 =SUMIFS($F$23:$F$76, $E$23:$E$76, D120)
TOTAL 21,627

Note that in all of the examples above the range that we want to sum remains the same - $F$23:$F$76

It is the criteria range that we are changing each time:


For months we are referencing the range $C$23:$C$76
For days we are referencing the range $D$23:$D$76
For products we are referencing the range $E$23:$E$76

Additionally, it's worth noting that all of these SUMIFS solutions can be set up with ranged lookup inputs (and spilled array outputs) as well:

Jan 3,578 {=SUMIFS($F$23:$F$76, $C$23:$C$76, D135:D140)}


Feb 3,299
Mar 3,883
Apr 3,340
May 3,893
Jun 3,634
TOTAL #NAME? =SUM(_xlfn.anchorarray(F135))

Tuesday 7,062 {=SUMIFS($F$23:$F$76, $D$23:$D$76, D145:D147)}


Thursday 7,212
Saturday 7,353
TOTAL #NAME? =SUM(_xlfn.anchorarray(F145))

Chicken Pies 13,900 {=SUMIFS($F$23:$F$76, $E$23:$E$76, D153:D155)}


Lamb Pies 5,650
Vegetarian Pies 2,077
TOTAL #NAME? =SUM(_xlfn.anchorarray(F153))

You're going to see models, and modellers, using both the static and new dynamic approaches for a while yet, so it's worth remembering both.

Now let's look at how to use two criteria

What if Sarah would like to know the total sales for chicken pies on a Tuesday?

We now need to build a formula using SUMIFS with two criteria rather than just one:

Tuesday
Chicken Pies 4,576 =SUMIFS($F$23:$F$76, $D$23:$D$76, D167, $E$23:$E$76, D168)

Let's break the formula above down into its key elements

The syntax for SUMIFS is "=SUMIFS(sum_range, criteria_range1,criteria1,criteria_range2,criteria2)"

sum_range This is the range that contains the numbers that you want to sum up. In this case this is the quantity sold range $F$23:$F$76
criteria_range1 This is the first range that contains the criteria you want your sum calculation to be driven by. In this case this is the day of week range $D$23:$D$76
criteria1 This is the criteria for the first range that you want to base your sum calculation on. In this case this is day entered into cell D137
criteria_range2 This is the second range that contains the criteria you want your sum calculation to be driven by. In this case this is the product range $E$23:$E$76
criteria2 This is the criteria for the second range that you want to base your sum calculation on. In this case this is product entered into cell D138

It would be really useful to build out a table for Sarah so that she can see the sales by day and by product.

Day / Product Chicken Pies Lamb Pies Vegetarian Pies Total


Tuesday 4,576 1,841 645 7,062
Thursday 4,650 1,874 688 7,212
Saturday 4,674 1,935 744 7,353
Total 13,900 5,650 2,077 21,627

Note that the use of the $ signs to fix column and row references are important here if you want to copy and paste the formula from the top left to the rest of the table area.

Finally let's look at how to use three criteria

What if Sarah would like to know the total sales for chicken pies on a Tuesday in February?

We now need to build a formula using SUMIFS with three criteria. We follow exactly the same logic we have implemented so far:

Tuesday
Chicken Pies
Feb 685 =SUMIFS($F$23:$F$76, $D$23:$D$76, D198, $E$23:$E$76, D199, $C$23:$C$76, D200)

Let's break the formula above down into its key elements

The syntax for SUMIFS is "=SUMIFS(sum_range, criteria_range1,criteria1,criteria_range2,criteria2,criteria_range3,criteria3)"

sum_range This is the range that contains the numbers that you want to sum up. In this case this is the quantity sold range $F$23:$F$76
criteria_range1 This is the first range that contains the criteria you want your sum calculation to be driven by. In this case this is the day of week range $D$23:$D$76
criteria1 This is the criteria for the first range that you want to base your sum calculation on. In this case this is day entered into cell D168
criteria_range2 This is the second range that contains the criteria you want your sum calculation to be driven by. In this case this is the product range $E$23:$E$76
criteria2 This is the criteria for the second range that you want to base your sum calculation on. In this case this is product entered into cell D169
criteria_range3 This is the third range that contains the criteria you want your sum calculation to be driven by. In this case this is the month range $C$23:$C$76
criteria3 This is the criteria for the third range that you want to base your sum calculation on. In this case this is month entered into cell D170

Sarah would now like to see the sales by day and by product, with a month filter:

Feb

Day / Product Chicken Pies Lamb Pies Vegetarian Pies Total


Tuesday 685 271 100 1,056
Thursday 714 291 100 1,105
Saturday 720 300 118 1,138
Total 2,119 862 318 3,299

Note that there is a drop down list available in cell D186 which holds the names of the relevant months.
This is an example of the use of Data Validation, and we will come on to look at this later in the course.

Exercise

1) Market Footfall

Week Number Day of week Weather Market Footfall


1 Tuesday Sunny 1,000
1 Thursday Rainy 575

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
1 Saturday Grey 698
2 Tuesday Grey 758
2 Thursday Sunny 1,207
2 Saturday Rainy 694
3 Tuesday Grey 797
3 Thursday Sunny 1,035
3 Saturday Sunny 1,190
4 Tuesday Rainy 597
4 Thursday Sunny 970
4 Saturday Sunny 1,397

Week Number 4

Footfall Sunny Grey Rainy Total


Tuesday
Thursday
Saturday
Total

Create a formula that returns the market footfall volume based on the relevant day, weather and week number values

Exercise Solution

1) Market Footfall

Week Number Day of week Weather Market Footfall


1 Tuesday Sunny 1,000
1 Thursday Rainy 575
1 Saturday Grey 698
2 Tuesday Grey 758
2 Thursday Sunny 1,207
2 Saturday Rainy 694
3 Tuesday Grey 797
3 Thursday Sunny 1,035
3 Saturday Sunny 1,190
4 Tuesday Rainy 597
4 Thursday Sunny 970
4 Saturday Sunny 1,397

Week Number 4

Footfall Sunny Grey Rainy Total


Tuesday - - 597 597
Thursday 970 - - 970
Saturday 1,397 - - 1,397
Total 2,367 - 597 2,964

Create a formula that returns the market footfall volume based on the relevant day, weather and week number values

And here's a more dynamic, "modern Excel" version

Footfall Sunny Grey Rainy Total


Tuesday - - 597 #NAME?
Thursday 970 - - #NAME?
Saturday 1,397 - - #NAME?
Total #NAME? #NAME? #NAME? #NAME?

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The COUNTIFS Function

Syntax =COUNTIFS(criteria_range1,criteria1,[criteria_range2],[criteria2]…)

criteria_range1 - the first range to be evaluated


criteria1 - the criteria to use for range 1
criteria_range2 - the second range to be evaluated
criteria1 - the criteria to use for range 2

Key points
The COUNTIFS function counts the number of cells in a range that meet a specified criteria, or set of criteria.
Unlike SUMIFS, this function only needs the criteria pairs (criteria range and criteria). There is no separate range to sum up.
COUNTIFS is available to users of Office 365 or Excel 2019.
We advise that you use COUNTIFS over COUNTIF in all instances (even when you have just one criteria). Although the structure of the two functions are similar, it keeps things more consistent to just apply one function at all times.

Let's start with a simple data set

Below is a summary of market sales recorded by Sarah


We'll use a simple COUNT function first just to count the number of entries in our data set, before moving on to use COUNTIFS in a number of ways:

Month Day of week Product Quantity Sold


Jan Tuesday Chicken Pies 871
Jan Tuesday Lamb Pies 357
Jan Tuesday Vegetarian Pies 136
Jan Thursday Chicken Pies 708
Jan Thursday Lamb Pies 280
Jan Thursday Vegetarian Pies 110
Jan Saturday Chicken Pies 714
Jan Saturday Lamb Pies 291
Jan Saturday Vegetarian Pies 111
Feb Tuesday Chicken Pies 685
Feb Tuesday Lamb Pies 271
Feb Tuesday Vegetarian Pies 100
Feb Thursday Chicken Pies 714
Feb Thursday Lamb Pies 291
Feb Thursday Vegetarian Pies 100
Feb Saturday Chicken Pies 720
Feb Saturday Lamb Pies 300
Feb Saturday Vegetarian Pies 118
Mar Tuesday Chicken Pies 708
Mar Tuesday Lamb Pies 290
Mar Tuesday Vegetarian Pies 86
Mar Thursday Chicken Pies 896
Mar Thursday Lamb Pies 357
Mar Thursday Vegetarian Pies 132
Mar Saturday Chicken Pies 900
Mar Saturday Lamb Pies 374
Mar Saturday Vegetarian Pies 140
Apr Tuesday Chicken Pies 700
Apr Tuesday Lamb Pies 283
Apr Tuesday Vegetarian Pies 100
Apr Thursday Chicken Pies 718
Apr Thursday Lamb Pies 295
Apr Thursday Vegetarian Pies 106
Apr Saturday Chicken Pies 720
Apr Saturday Lamb Pies 300
Apr Saturday Vegetarian Pies 118
May Tuesday Chicken Pies 892
May Tuesday Lamb Pies 357
May Tuesday Vegetarian Pies 128
May Thursday Chicken Pies 894
May Thursday Lamb Pies 359
May Thursday Vegetarian Pies 131
May Saturday Chicken Pies 720
May Saturday Lamb Pies 300
May Saturday Vegetarian Pies 112
Jun Tuesday Chicken Pies 720
Jun Tuesday Lamb Pies 283
Jun Tuesday Vegetarian Pies 95
Jun Thursday Chicken Pies 720
Jun Thursday Lamb Pies 292
Jun Thursday Vegetarian Pies 109
Jun Saturday Chicken Pies 900
Jun Saturday Lamb Pies 370
Jun Saturday Vegetarian Pies 145

The total number of rows is 54 =COUNT(F22:F75)

To start with let's look at using COUNTIFS with one criteria

Rather than counting the overall number of entries, Sarah would like to know the number of entries for a specified month:

We can use the COUNTIFS function with a single criteria range of month:

Month Jan 9 =COUNTIFS($C$22:$C$75, D86)

Let's break the formula above down into its key elements

The syntax for COUNTIFS is "=COUNTIFS(criteria_range1,criteria1,…)

criteria_range1 This is the first range that contains the criteria you want your count calculation to be drive by. In this case this is the month range $C$22:$C$75
criteria1 This is the chosen criteria for the first range you want to base your count calculation on. In this case this is month entered into cell D86

We could also list out the full results by month for Sarah:

Jan 9 =COUNTIFS($C$22:$C$75, D98)


Feb 9 =COUNTIFS($C$22:$C$75, D99)
Mar 9 =COUNTIFS($C$22:$C$75, D100)
Apr 9 =COUNTIFS($C$22:$C$75, D101)
May 9 =COUNTIFS($C$22:$C$75, D102)
Jun 9 =COUNTIFS($C$22:$C$75, D103)
TOTAL 54 =SUM(F98:F103)

What if Sarah wanted to see which day has the most rows:

Tuesday 18 =COUNTIFS($D$22:$D$75, D108)


Thursday 18 =COUNTIFS($D$22:$D$75, D109)
Saturday 18 =COUNTIFS($D$22:$D$75, D110)
TOTAL 54

Or which product had the most entries:

Chicken Pies 18 =COUNTIFS($E$22:$E$75, D116)


Lamb Pies 18 =COUNTIFS($E$22:$E$75, D117)
Vegetarian Pies 18 =COUNTIFS($E$22:$E$75, D118)
TOTAL 54

Note that the criteria range we are referencing changes each time:
For months we are referencing the range $C$22:$C$75
For days we are referencing the range $D$22:$D$75
For products we are referencing the range $E$22:$E$75

Now let's look at how to use two criteria

What if Sarah would like to know the number of entries for chicken pies sold on a Tuesday?

We now need to build a formula using COUNTIFS with two criteria rather than just one:

Tuesday
Chicken Pies 6 =COUNTIFS($D$22:$D$75, D133, $E$22:$E$75, D134)

Let's break the formula above down into its key elements

The syntax for COUNTIFS is "=COUNTIFS(criteria_range1,criteria1,criteria_range2,criteria2)"

criteria_range1 This is the first range that contains the criteria you want your count calculation to be driven by. In this case this is the day of week range $D$22:$D$75
criteria1 This is the chosen criteria for the first range you want to base your count calculation on. In this case this is day entered into cell D133
criteria_range2 This is the second range that contains the criteria you want your count calculation to be driven by. In this case this is the product range $E$22:$E$75
criteria2 This is the chosen criteria for the second range you want to base your count calculation on. In this case this is product entered into cell D134

It would be really useful to build out a table for Sarah so that she can see the count by day and by product

Day / Product Chicken Pies Lamb Pies Vegetarian Pies Total


Tuesday 6 6 6 18
Thursday 6 6 6 18
Saturday 6 6 6 18
Total 18 18 18 54

If any entries were missing, Sarah would be able to spot the issue quickly (i.e. if one of the counts for pies on a particular day of the week was less than or more than 6)

Finally let's look at how to use three criteria

What if Sarah would like to know the total rows for chicken pies on a Tuesday in February?

We now need to build a formula using COUNTIFS with three criteria rather than two:

Tuesday
Chicken Pies
Feb 1 =COUNTIFS($D$22:$D$75, D163, $E$22:$E$75, D164, $C$22:$C$75, D165)

Let's break the formula above down into its key elements

The syntax for COUNTIFS is "=COUNTIFS(criteria_range1,criteria1,criteria_range2,criteria2,criteria_range3,criteria3)"

criteria_range1 This is the first range that contains the criteria you want your count calculation to be driven by. In this case this is the day of week range $D$22:$D$75
criteria1 This is the chosen criteria for the first range you want to base your count calculation on. In this case this is day entered into cell D163
criteria_range2 This is the second range that contains the criteria you want your count calculation to be driven by. In this case this is the product range $E$22:$E$75
criteria2 This is the chosen criteria for the second range you want to base your count calculation on. In this case this is product entered into cell D134
criteria_range3 This is the third range that contains the criteria you want your count calculation to be driven by. In this case this is the month range $C$22:$C$75
criteria3 This is the chosen criteria for the third range you want to base your count calculation on. In this case this is month entered into cell D135

Sarah would now like to see the count of entries by day and by product, with a month filter:

Feb

Day / Product Chicken Pies Lamb Pies Vegetarian Pies Total


Tuesday 1 1 1 3
Thursday 1 1 1 3
Saturday 1 1 1 3
Total 3 3 3 9

Exercise

1) Market Footfall

Week Number Day of week Weather Market Footfall


1 Tuesday Sunny 1,000
1 Thursday Rainy 575
1 Saturday Grey 698
2 Tuesday Grey 758
2 Thursday Sunny 1,207
2 Saturday Rainy 694
3 Tuesday Grey 797
3 Thursday Sunny 1,035
3 Saturday Sunny 1,190
4 Tuesday Rainy 597
4 Thursday Sunny 970
4 Saturday Sunny 1,397

Footfall Sunny Grey Rainy Total


Tuesday
Thursday
Saturday
Total

Create a formula that counts the number of entries for each day and weather combination from the table above
Try to build the formula in the top left cell of the table and copy it across the rest of the table (you need to use your $ signs carefully)

Exercise Solution

1) Market Footfall

Week Number Day of week Weather Market Footfall


1 Tuesday Sunny 1,000
1 Thursday Rainy 575
1 Saturday Grey 698
2 Tuesday Grey 758
2 Thursday Sunny 1,207
2 Saturday Rainy 694
3 Tuesday Grey 797
3 Thursday Sunny 1,035
3 Saturday Sunny 1,190
4 Tuesday Rainy 597
4 Thursday Sunny 970
4 Saturday Sunny 1,397

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Footfall Sunny Grey Rainy Total
Tuesday 1 2 1 4
Thursday 3 - 1 4
Saturday 2 1 1 4
Total 6 3 3 12

Create a formula that counts the number of entries for each day and weather combination from the table above
Try to build the formula in the top left cell of the table and copy it across the rest of the table (you need to use your $ signs carefully)

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The SUMPRODUCT Function

Syntax =SUMPRODUCT(array1, [array2], …)

array 1 - The first array / range to multiply


[array2] - The second array / range to multiply (optional)
…- An indication that you can add multiple, optional additional arrays / ranges

Key points
The SUMPRODUCT function allows you to multiply arrays together
SUMPRODUCT is an incredibly powerful and versatile function, but it's usefulness has been diminished as a result of the more recent upgrades to Excel
Specifically, the evolution of Excel's array functions and capabilities means that much of what could only be achieved through the use of SUMPRODUCT (or CTRL + SHIFT + ENTER) can now be done with simple formulas like SUM
However, you'll still see modellers using SUMPRODUCT, and we still (for now at least) think it's well worth the time and effort to master
We still love it though, and think it's well worth your time to learn

Let's get straight into the fundamentals of SUMPRODUCT

Below is a summary of market sales recorded by Sarah


We'll use SUMPRODUCT to calculate the total revenue first

Month Day of week Product Quantity Sold Product Price Total Revenue: £77,481 =SUMPRODUCT(F23:F76, G23:G76)
Jan Tuesday Chicken Pies 871 £3.50
Jan Tuesday Lamb Pies 357 £4.00 You could also achieve the same result by using an older CTRL + SHIFT + ENTER array:
Jan Tuesday Vegetarian Pies 136 £3.00 Total Revenue: £77,481 {=SUM(F23:F76 * G23:G76)}
Jan Thursday Chicken Pies 708 £3.50
Jan Thursday Lamb Pies 280 £4.00 See the curly brackets in the formula above?
Jan Thursday Vegetarian Pies 110 £3.00 That's what you get when you press CTRL + SHIFT + ENTER
Jan Saturday Chicken Pies 714 £3.50 instead of just pressing ENTER once you've built your formula
Jan Saturday Lamb Pies 291 £4.00
Jan Saturday Vegetarian Pies 111 £3.00 If you're using what we call "modern Excel", you can actually achieve the same result now with a simple SUM:
Feb Tuesday Chicken Pies 685 £3.50 Total Revenue: £77,481 {=SUM(F23:F76 * G23:G76)}
Feb Tuesday Lamb Pies 271 £4.00
Feb Tuesday Vegetarian Pies 100 £3.00 Why does SUM work when it didn't in years gone by?
Feb Thursday Chicken Pies 714 £3.50 It's because Excel now allows an array to SPILL, and therefore be picked up by other functions:
Feb Thursday Lamb Pies 291 £4.00
Feb Thursday Vegetarian Pies 100 £3.00 Total Revenue: £3,049 {=(F23:F33 * G23:G33)}
Feb Saturday Chicken Pies 720 £3.50 1428
Feb Saturday Lamb Pies 300 £4.00 408
Feb Saturday Vegetarian Pies 118 £3.00 2478
Mar Tuesday Chicken Pies 708 £3.50 1120
Mar Tuesday Lamb Pies 290 £4.00 330
Mar Tuesday Vegetarian Pies 86 £3.00 2499
Mar Thursday Chicken Pies 896 £3.50 1164
Mar Thursday Lamb Pies 357 £4.00 333
Mar Thursday Vegetarian Pies 132 £3.00 2397.5
Mar Saturday Chicken Pies 900 £3.50 1084
Mar Saturday Lamb Pies 374 £4.00
Mar Saturday Vegetarian Pies 140 £3.00 The formula above just uses a partial range of data from the data set on the left (so it fits above), but what you see there
Apr Tuesday Chicken Pies 700 £3.50 is the spilled array results of the formula we've been using so far without any function bolted on at the front.
Apr Tuesday Lamb Pies 283 £4.00 Put a simple SUM upfront and it'll sum all of those spilled values in the array
Apr Tuesday Vegetarian Pies 100 £3.00
Apr Thursday Chicken Pies 718 £3.50 For the sake of completeness, and on the assumption that you may well still come across models with SUMPRODUCT,
Apr Thursday Lamb Pies 295 £4.00 let's pretend we're using a version of Excel that doesn't allow you to pick up spilled arrays for the remainder of this worksheet.
Apr Thursday Vegetarian Pies 106 £3.00
Apr Saturday Chicken Pies 720 £3.50
Apr Saturday Lamb Pies 300 £4.00
Apr Saturday Vegetarian Pies 118 £3.00
May Tuesday Chicken Pies 892 £3.50
May Tuesday Lamb Pies 357 £4.00
May Tuesday Vegetarian Pies 128 £3.00
May Thursday Chicken Pies 894 £3.50
May Thursday Lamb Pies 359 £4.00
May Thursday Vegetarian Pies 131 £3.00
May Saturday Chicken Pies 720 £3.50
May Saturday Lamb Pies 300 £4.00
May Saturday Vegetarian Pies 112 £3.00
Jun Tuesday Chicken Pies 720 £3.50
Jun Tuesday Lamb Pies 283 £4.00
Jun Tuesday Vegetarian Pies 95 £3.00
Jun Thursday Chicken Pies 720 £3.50
Jun Thursday Lamb Pies 292 £4.00
Jun Thursday Vegetarian Pies 109 £3.00
Jun Saturday Chicken Pies 900 £3.50
Jun Saturday Lamb Pies 370 £4.00
Jun Saturday Vegetarian Pies 145 £3.00

Now let's look at SUMPRODUCT with multiple functional arguments

Month Day of week Product Quantity Produced Quantity Sold Product Price
Jan Tuesday Chicken Pies 900 896 £3.50
Jan Tuesday Lamb Pies 400 365 £4.00 SUMPRODUCT can perform advanced COUNTS:
Jan Tuesday Vegetarian Pies 150 136 £3.00
Jan Thursday Chicken Pies 708 600 £3.50 Count the number of times any individual product sells out 15
Jan Thursday Lamb Pies 280 279 £4.00
Jan Thursday Vegetarian Pies 110 110 £3.00 Count the number of times each product below sells out:
Jan Saturday Chicken Pies 714 711 £3.50 Chicken Pies 4
Jan Saturday Lamb Pies 291 291 £4.00 Lamb Pies 5
Jan Saturday Vegetarian Pies 111 95 £3.00 Vegetarian Pies 6
Feb Tuesday Chicken Pies 685 685 £3.50
Feb Tuesday Lamb Pies 271 271 £4.00
Feb Tuesday Vegetarian Pies 100 100 £3.00 Calculate the revenue earned by product for the day listed below:
Feb Thursday Chicken Pies 714 701 £3.50
Feb Thursday Lamb Pies 291 280 £4.00 Tuesday
Feb Thursday Vegetarian Pies 100 60 £3.00 Chicken Pies 16,027
Feb Saturday Chicken Pies 720 720 £3.50 Lamb Pies 7,324
Feb Saturday Lamb Pies 300 300 £4.00 Vegetarian Pies 1,890
Feb Saturday Vegetarian Pies 118 118 £3.00
Mar Tuesday Chicken Pies 708 700 £3.50
Mar Tuesday Lamb Pies 290 284 £4.00 Count the number of times each product below sells out on a particular day:
Mar Tuesday Vegetarian Pies 86 86 £3.00
Mar Thursday Chicken Pies 896 860 £3.50 Tuesday Thursday Saturday
Mar Thursday Lamb Pies 357 357 £4.00 Chicken Pies 1 - 3
Mar Thursday Vegetarian Pies 132 125 £3.00 Lamb Pies 1 1 3
Mar Saturday Chicken Pies 900 801 £3.50 Vegetarian Pies 2 1 3
Mar Saturday Lamb Pies 374 370 £4.00
Mar Saturday Vegetarian Pies 140 140 £3.00
Apr Tuesday Chicken Pies 700 697 £3.50 You can use SUMPRODUCT to perform more bespoke calculations:
Apr Tuesday Lamb Pies 283 280 £4.00
Apr Tuesday Vegetarian Pies 100 97 £3.00 Weekday sales 13,994
Apr Thursday Chicken Pies 718 717 £3.50 Weekend sales 7,214
Apr Thursday Lamb Pies 295 292 £4.00 Total sales 21,208
Apr Thursday Vegetarian Pies 106 103 £3.00 Check -
Apr Saturday Chicken Pies 720 720 £3.50
Apr Saturday Lamb Pies 300 300 £4.00 In the example above, the + symbols acts like an OR function
Apr Saturday Vegetarian Pies 118 118 £3.00
May Tuesday Chicken Pies 892 891 £3.50
May Tuesday Lamb Pies 357 350 £4.00
May Tuesday Vegetarian Pies 128 120 £3.00
May Thursday Chicken Pies 894 890 £3.50
May Thursday Lamb Pies 359 351 £4.00
May Thursday Vegetarian Pies 131 128 £3.00
May Saturday Chicken Pies 720 719 £3.50
May Saturday Lamb Pies 300 289 £4.00
May Saturday Vegetarian Pies 112 110 £3.00
Jun Tuesday Chicken Pies 720 710 £3.50
Jun Tuesday Lamb Pies 283 281 £4.00
Jun Tuesday Vegetarian Pies 95 91 £3.00
Jun Thursday Chicken Pies 720 710 £3.50
Jun Thursday Lamb Pies 292 291 £4.00
Jun Thursday Vegetarian Pies 109 100 £3.00
Jun Saturday Chicken Pies 900 900 £3.50
Jun Saturday Lamb Pies 370 369 £4.00
Jun Saturday Vegetarian Pies 145 143 £3.00

Understanding the TRUE / FALSE , 1 / 0 calculation logic

Month Day of week Product Quantity Produced Quantity Sold Product Price
Jan Tuesday Chicken Pies 900 896 £3.50
Jan Tuesday Lamb Pies 400 365 £4.00 So, SUMPRODUCT can be used to perform relatively complex calculations based on multiple criteria:
Jan Tuesday Vegetarian Pies 150 136 £3.00 But there are multiple approaches you'll see modellers take. Look at the individual formulas in the three options below:
Jan Thursday Chicken Pies 708 600 £3.50
Jan Thursday Lamb Pies 280 279 £4.00 Revenue By Product: Option 1 Option 2 Option 3
Jan Thursday Vegetarian Pies 110 110 £3.00 Chicken Pies £47,698 £47,698 £47,698
Jan Saturday Chicken Pies 714 711 £3.50 Lamb Pies £22,400 £22,400 £22,400
Jan Saturday Lamb Pies 291 291 £4.00 Vegetarian Pies £5,940 £5,940 £5,940
Jan Saturday Vegetarian Pies 111 95 £3.00
Feb Tuesday Chicken Pies 685 685 £3.50
Feb Tuesday Lamb Pies 271 271 £4.00 Option 1: using "--" {=SUMPRODUCT(--($E$141:$E$194=$J146), $G$141:$G$194, $H$141:$H$194)}
Feb Tuesday Vegetarian Pies 100 100 £3.00 Option 2: using "N" {=SUMPRODUCT(N($E$141:$E$194=$J146), $G$141:$G$194, $H$141:$H$194)}
Feb Thursday Chicken Pies 714 701 £3.50 Option 3: using (( )) {=SUMPRODUCT(($E$141:$E$194=$J146) * $G$141:$G$194 * $H$141:$H$194)}
Feb Thursday Lamb Pies 291 280 £4.00
Feb Thursday Vegetarian Pies 100 60 £3.00 There's a lot to unpack here, but essentially you have three options available to you to ensure your SUMPRODUCT
Feb Saturday Chicken Pies 720 720 £3.50 returns the numerical values you're looking for.
Feb Saturday Lamb Pies 300 300 £4.00
Feb Saturday Vegetarian Pies 118 118 £3.00
Mar Tuesday Chicken Pies 708 700 £3.50 Whenever you have a functional argument (like we do above with the first array that's looking for a particular type of pie)
Mar Tuesday Lamb Pies 290 284 £4.00 we have to do some work to turn a TRUE / FALSE result into a 1 / 0 (so it will multiply out properly)
Mar Tuesday Vegetarian Pies 86 86 £3.00
Mar Thursday Chicken Pies 896 860 £3.50 "--" and "N" are two common approaches you'll see being used
Mar Thursday Lamb Pies 357 357 £4.00 An alternative with SUMPRODUCT is to use the brackets around the functional argument,
Mar Thursday Vegetarian Pies 132 125 £3.00 and to replace the comma with the * (multiplication) sign.
Mar Saturday Chicken Pies 900 801 £3.50 The * does the work to convert the TRUE / FALSE to a 1 / 0 for us
Mar Saturday Lamb Pies 374 370 £4.00
Mar Saturday Vegetarian Pies 140 140 £3.00
Apr Tuesday Chicken Pies 700 697 £3.50
Apr Tuesday Lamb Pies 283 280 £4.00
Apr Tuesday Vegetarian Pies 100 97 £3.00
Apr Thursday Chicken Pies 718 717 £3.50
Apr Thursday Lamb Pies 295 292 £4.00
Apr Thursday Vegetarian Pies 106 103 £3.00
Apr Saturday Chicken Pies 720 720 £3.50
Apr Saturday Lamb Pies 300 300 £4.00
Apr Saturday Vegetarian Pies 118 118 £3.00
May Tuesday Chicken Pies 892 891 £3.50
May Tuesday Lamb Pies 357 350 £4.00
May Tuesday Vegetarian Pies 128 120 £3.00
May Thursday Chicken Pies 894 890 £3.50
May Thursday Lamb Pies 359 351 £4.00
May Thursday Vegetarian Pies 131 128 £3.00
May Saturday Chicken Pies 720 719 £3.50
May Saturday Lamb Pies 300 289 £4.00
May Saturday Vegetarian Pies 112 110 £3.00
Jun Tuesday Chicken Pies 720 710 £3.50
Jun Tuesday Lamb Pies 283 281 £4.00
Jun Tuesday Vegetarian Pies 95 91 £3.00
Jun Thursday Chicken Pies 720 710 £3.50
Jun Thursday Lamb Pies 292 291 £4.00
Jun Thursday Vegetarian Pies 109 100 £3.00
Jun Saturday Chicken Pies 900 900 £3.50
Jun Saturday Lamb Pies 370 369 £4.00
Jun Saturday Vegetarian Pies 145 143 £3.00

Using SUMPRODUCT with other functions

SUMPRODUCT does also create little pockets of magic when it's used with other functions as well.
For example, let's say we wanted to count the number of characters across all of our text strings below.
You probably know already that we could add a column with a LEN formula and SUM the results in that new column.
But there's a shortcut…

1573f821-af6e-4826-8bd7-63c10f701efb 214 {=SUMPRODUCT(LEN(C205:E210))}


f46a8843-41cf-4ef6-at56-e37067a67149 That's a useful shortcut to help shortcut the helper column we'd need otherwise
3b27d9e0-41f7-408c-98fe-6038eeab7261 But there's more! Remember our SUBSTITUTE calculation to add up the number of instances a specific character occurs?
c4t30530-91d8-4508-b355-fb58a28046d3 We can use SUMPRODUCT to create another shortcut here as well:
d11512d1-150b-47dr-990e-b134323debbf
bd40b730-f76d-26db-857d-f1692b6fb8 24 {=SUMPRODUCT(LEN(C205:C210) - LEN(SUBSTITUTE(C205:C210, "-", "")))}
That's the total number of instances the hyphen character "-" occurs across the entire text string data set on the left

Note: both of the examples above can also now be calculated with a simple SUM:

214 {=SUM(LEN(C205:E210))}
24 {=SUM(LEN(C205:C210) - LEN(SUBSTITUTE(C205:C210, "-", "")))}

Exercise

Week Number Day of week Weather Market Footfall


1 Tuesday Sunny 1,000 Use SUMPRODUCT to count the number of Sunny days
1 Thursday Rainy 575
1 Saturday Grey 698
2 Tuesday Grey 758 Use SUMPRODUCT to sum the overall market footfall on each of the weather types listed below:
2 Thursday Sunny 1,207 Sunny
2 Saturday Rainy 694 Grey
3 Tuesday Grey 797 Rainy
3 Thursday Sunny 1,035 Total footfall -
3 Saturday Sunny 1,190 Check 10,918
4 Tuesday Rainy 597
4 Thursday Sunny 970 Use SUMPRODUCT to sum the overall market footfall on each of the weather types and week days listed below:
4 Saturday Sunny 1,397 Sunny Grey Rainy Total
Tuesday -
Thursday -
Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Saturday -
Total - - - -

Exercise Solution

Week Number Day of week Weather Market Footfall


1 Tuesday Sunny 1,000 Use SUMPRODUCT to count the number of Sunny days
1 Thursday Rainy 575 6
1 Saturday Grey 698
2 Tuesday Grey 758 Use SUMPRODUCT to sum the overall market footfall on each of the weather types listed below:
2 Thursday Sunny 1,207 Sunny 6,799
2 Saturday Rainy 694 Grey 2,253
3 Tuesday Grey 797 Rainy 1,866
3 Thursday Sunny 1,035 Total footfall 10,918
3 Saturday Sunny 1,190 Check -
4 Tuesday Rainy 597
4 Thursday Sunny 970 Use SUMPRODUCT to sum the overall market footfall on each of the weather types and week days listed below:
4 Saturday Sunny 1,397 Sunny Grey Rainy Total
Tuesday 1,000 1,555 597 3,152
Thursday 3,212 - 575 3,787
Saturday 2,587 698 694 3,979
Total 6,799 2,253 1,866 10,918

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Exercise 7

When she's not baking, Sarah is a big fan of squirrels. Below is a table of squirrel sightings that Sarah and her friend John have logged:

Location Marshall Species No. of Sightings


Hales Wood John Grey 5
Hales Wood John Red 56
Green Wood John Grey 214
Green Wood John Red 1
Hake Wood John Grey 7
Forest of Dean John Red 54
Forest of Dean John Grey 210
Forest of Dean John Red -
Pile Wood John Grey 4
Pile Wood John Red 60
Quantock Wood John Grey 180
Quantock Wood John Red -
Hales Wood Sarah Grey 8
Hales Wood Sarah Red 62
Green Wood Sarah Grey 180
Green Wood Sarah Red 2
Hake Wood Sarah Grey 9
Hake Wood Sarah Red 40
Forest of Dean Sarah Grey 200
Forest of Dean Sarah Red -
Pile Wood Sarah Grey 2
Pile Wood Sarah Red 45
Pile Wood Sarah Grey 22
Forest of Dean John Grey 100
Forest of Dean John Grey 85
Pile Wood John Grey 120
Quantock Wood Sarah Grey 175
Quantock Wood Sarah Red -

1. Which location had the most squirrel sightings recorded?

Forest of Dean
Green Wood
Hake Wood
Hales Wood
Pile Wood
Quantock Wood

Answer:

2. Which person recorded the most squirrel sightings?

Sarah
John

Answer:

3. How many grey squirrels were sighted?

Grey

4. How many red squirrels were sighted in Hake wood?

Red
Hake Wood

5. How many red squirrels were sighted in Hake wood by Sarah?

Red
Hake Wood
Sarah

6. How many grey squirrels were sighted in Quantock wood by John?

Grey
Quantock Wood
John

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Solution 7

When she's not baking Sarah is a big fan of squirrels. Below is a table of squirrel sightings that Sarah and her friend John have logged:

Location Marshall Species No. of Sightings


Hales Wood John Grey 5
Hales Wood John Red 56
Green Wood John Grey 214
Green Wood John Red 1
Hake Wood John Grey 7
Forest of Dean John Red 54
Forest of Dean John Grey 210
Forest of Dean John Red -
Pile Wood John Grey 4
Pile Wood John Red 60
Quantock Wood John Grey 180
Quantock Wood John Red -
Hales Wood Sarah Grey 8
Hales Wood Sarah Red 62
Green Wood Sarah Grey 180
Green Wood Sarah Red 2
Hake Wood Sarah Grey 9
Hake Wood Sarah Red 40
Forest of Dean Sarah Grey 200
Forest of Dean Sarah Red -
Pile Wood Sarah Grey 2
Pile Wood Sarah Red 45
Pile Wood Sarah Grey 22
Forest of Dean John Grey 100
Forest of Dean John Grey 85
Pile Wood John Grey 120
Quantock Wood Sarah Grey 175
Quantock Wood Sarah Red -

1. Which location had the most squirrel sightings recorded?

Forest of Dean 649


Green Wood 397
Hake Wood 56
Hales Wood 131
Pile Wood 253
Quantock Wood 355

Answer: Forest of Dean

2. Which person recorded the most squirrel sightings?

Sarah 745
John 1,096

Answer: John

3. How many grey squirrels were sighted?

Grey 1,521

4. How many red squirrels were sighted in Hake wood?

Red
Hake Wood 40

5. How many red squirrels were sighted in Hake wood by Sarah?

Red
Hake Wood
Sarah 40

6. How many grey squirrels were sighted in Quantock wood by John?

Grey
Quantock Wood
John 180

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Exercise 8

Weekday Weekday Weekday Weekday Weekday Weekend Weekend


Units Sold Monday Tuesday Wednesday Thursday Friday Saturday Sunday Unit Sales Price
Week 1 444 1685 1707 404 742 1455 1943 £9.50
Week 2 674 1931 209 1793 1423 912 1100 £7.50
Week 3 269 1641 364 211 557 1672 621 £8.00
Week 4 1812 340 638 1296 115 1445 1993 £6.00
Week 5 889 1109 380 1563 1467 805 795 £7.00
Week 6 253 1495 1852 1439 117 154 867 £7.75
Week 7 1070 517 407 1034 1469 888 308 £8.50
Week 8 924 1916 739 1772 745 1436 221 £10.00
Week 9 1778 1121 1733 641 1354 1425 466 £6.00
Week 10 1736 1239 175 1101 421 1926 1590 £8.00

1. Calculate the total revenue earned by week, without any helper columns, as set out below:
Week 1
Week 2
Week 3
Week 4
Week 5
Week 6
Week 7
Week 8
Week 9
Week 10
Total Revenue

2. Calculate the total weekday and weekend revenue, without any helper columns, as set out below:
Weekday
Weekend
Total Revenue £0
Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Exercise 8

Weekday Weekday Weekday Weekday Weekday Weekend Weekend


Units Sold Monday Tuesday Wednesday Thursday Friday Saturday Sunday Unit Sales Price
Week 1 444 1685 1707 404 742 1455 1943 £9.50
Week 2 674 1931 209 1793 1423 912 1100 £7.50
Week 3 269 1641 364 211 557 1672 621 £8.00
Week 4 1812 340 638 1296 115 1445 1993 £6.00
Week 5 889 1109 380 1563 1467 805 795 £7.00
Week 6 253 1495 1852 1439 117 154 867 £7.75
Week 7 1070 517 407 1034 1469 888 308 £8.50
Week 8 924 1916 739 1772 745 1436 221 £10.00
Week 9 1778 1121 1733 641 1354 1425 466 £6.00
Week 10 1736 1239 175 1101 421 1926 1590 £8.00

1. Calculate the total revenue earned by week, without any helper columns, as set out below:
Week 1 £79,610 £79,610
Week 2 £60,315 £60,315
Week 3 £42,680 £42,680
Week 4 £45,834 £45,834
Week 5 £49,056 OR £49,056
Week 6 £47,872 £47,872
Week 7 £48,391 £48,391
Week 8 £77,530 £77,530
Week 9 £51,108 £51,108
Week 10 £65,504 £65,504
Total Revenue £567,899 £567,899

2. Calculate the total weekday and weekend revenue, without any helper columns, as set out below:
Weekday £396,234 £396,234
Weekend £171,666 OR £171,666
Total Revenue £567,899 £567,899
Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The MOD Function

Syntax = MOD(number, divisor)

number - the number to be divided


divisor - the number to divide by

Key points
The MOD function returns the remainder of a division calculation
In its simplest form, it requires just two numeric values: the number and divisor
However, MOD can be used in more targeted ways to support advanced modelling challenges

Let's start with a simple example

Number Divisor Remainder


8 3 2 =MOD(C17, D17) In this example, 3 divides into 8 two whole times (i.e. 6 divided by 3 = 2). This leave a remainder of 2
13 10 3 In this example, 10 divides into 13 just once. This leave a remainder of 3
535 100 35 In this example, 100 divides into 535 five times (i.e. 500 divided by 100 = 5). This leave a remainder of 35
24 12 - In this example, 12 divides exactly 2 times into 24. This leaves no remainder
53 50 3 [You get the point by now I suspect…]
77 5 2
4 3 1

In plain English:
When you divide the Number by the Divisor, the MOD function will return just the remainder from this calculation
The remainder is the numerical value that is left after accounting for the number of times the Divisor divides fully into the Number

Using MOD to support model period logic

Model Period Counter 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


Model Year - Month Counter 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3
Quarter Counter 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3

OR

Model Year - Month Counter 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3


Quarter Counter 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3

You can reverse the use of MOD to generate flags

Quarterly Payment Flag 0 FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE
Converted to 1s and 0s 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 TRUE

And don't forget that all of this model timeline logic can be set up more dynamically now with functions like SEQUENCE at our disposal

No. of Period 27

Model Period Counter #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
Model Year - Month Counter #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
Quarter Counter #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The QUOTIENT Function

Syntax =QUOTIENT(numerator, denominator)

numerator - the number to be divided


denominator - the number to divide by

Key points
The QUOTIENT function does the opposite of the MOD function
It returns the integer portion of a division calculation, discarding the remainder
In its simplest form, the QUOTIENT function requires just two numeric values
However, much like the MOD function, it can also be used to support and overcome more advanced modelling challenges

Let's start with a simple example

Number Divisor Integer


8 3 2 =QUOTIENT(C17, D17In this example, 3 divides into 8 two whole times (i.e. 6 divided by 3 = 2). QUOTIENT discards the remaining 2, leaving 2 as the number of times 3 goes into 8 in full
13 10 1 In this example, 10 divides into 13 just once. The remainder of 3 is discarded
535 100 5 In this example, 100 divides into 535 five times (i.e. 500 divided by 100 = 5). The remainder of 35 is discarded
24 12 2 In this example, 12 divides exactly 2 times into 24. This leaves no remainder, so nothing is discarded
53 50 1 [You get the point by now I suspect…]
77 5 15
4 3 1

In plain English:
The QUOTIENT function returns the number of times the Denominator divides into the Numerator in full.
The remainder - the numerical value that is left after accounting for the number of times the Denominator divides into the Numerator - is discarded

Using QUOTIENT to support model period logic

Model Period Counter 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


Model Year 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3
Quarter Counter 1 1 1 2 2 2 3 3 3 4 4 4 1 1 1 2 2 2 3 3 3 4 4 4 1 1 1

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The INT Function

Syntax =INT(number)

number - the number you wish to return an integer from

Key points
The INT function returns a whole integer from a numerical value, discarding the remainder (much like QUOTIENT), but performs a round down BEFORE the remainder is discarded
Be aware that negative numbers will become more negative if that are used within the INT function
The syntax could not be simpler: you have just one element to add - the number you wish to return the integer for
Modellers seeking to avoid the round down step can use the TRUNC function instead
Or they could just use some of the functions on the next worksheet instead! But let's stick with INT for now…

Let's start with a simple example

Number 3.756 3.000 =INT(D17) The INT function discards the remainder
(3.756) (4.000) =INT(D18) With negative numbers, the initial round down step becomes clearer
(3.756) (3.000) =TRUNC(D19) The negative round down issue can be overcome by using the TRUNC function instead of INT

Number Divisor N/D INT


8 3 2.67 2.00 =INT(E24)
13 10 1.30 1.00
535 100 5.35 5.00
24 12 2.00 2.00
53 50 1.06 1.00
77 5 15.40 15.00
-4 3 (1.33) (2.00)

In plain English:
The INT function returns a whole number when you reference a decimal number
The function will round down, which doesn't cause any noticeable issues for positive numbers, but does throw up potentially confusing results for negative numbers

Let's use the INT function to return the age of a team of people

Name Date of Birth Age


John 3/1/2002 22 =INT(YEARFRAC(D42,TODAY()))
Samantha 3/24/1994 30
Diane 9/15/1959 65
Tim 11/30/2004 19
Alex 4/2/1994 30
Sarah 1/1/2000 24
Sharon 9/14/1967 57

The YEARFRAC function used above simply converts the time difference between two dates into a decimal number
The TODAY function generates today's date (which is then used as one half of the calculation for the YEARFRAC calculation
INT leaves us with just the whole number of years for each individual's age

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The ROUND, ROUNDUP & ROUNDDOWN Functions

Syntax =ROUND(number, num_digits)

number - the number to round


num_digits - the place at which the number should be rounded

Syntax =ROUNDDOWN(number, num_digits)

number - the number you wish to round down


num_digits - the place at which the number should be rounded down

Syntax =ROUNDUP(number, num_digits)

number - the number you wish to round up


num_digits - the place at which the number should be rounded up

Key points
We won't dwell on these functions too long as they couldn't really be much clearer
ROUND, ROUNDDOWN, and ROUNDUP do exactly what you would expect them to do
Using these functions, instead of INT (and potentially TRUNC), offers a simpler solution to the negative values issue highlighted on the last worksheet

Let's start with a simple example

Number 3.756 4.000 =ROUND(D28,0)


3.756 3.800 =ROUND(D29,1)
495,844 496,000 =ROUND(D30,-3)
3.756 3.700 =ROUNDDOWN(D31,1)
3.756 3.800 =ROUNDUP(D32,1)
(3.756) (4.000) =ROUND(D33,0)
(3.756) (3.700) =ROUNDDOWN(D34,1)
(3.756) (3.800) =ROUNDUP(D35,1)

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The OFFSET function

Syntax =OFFSET(ref, rows, cols, [height], [width])

ref - The cell to offset from


rows - The number of rows to offset by (+vs down, -ve up)
cols - The number of columns to offset by (+vs right, -ve left)
height - Used to select a range. Number of rows high.
width - Used to select a range. Number of columns wide

Key points
The OFFSET function is one of the most unique, potentially powerful, and potentially dangerous functions in Excel
As a volatile function (one that recalculates with each workbook change), and one that can be extremely difficult to review and follow, it must be very carefully considered before it is used
We consider it an advanced function for these reasons, but one that modellers should be aware of and lean on when it can add real value

When using OFFSET we first identify a starting cell reference and then choose row and / or column numbers to offset (move) from that reference point

Starting Position HERE - START


Number of rows to move 3
Number of columns to move 3
End Position HERE - END HERE - END

The formula in cell D21 returns the value in cell G21, as the OFFSET function has shifted the reference 3 rows down from D18 (negative numbers would shift the reference up), and 3 columns right (negative numbers shift the reference left)

Let's look at another example with a simple table of data

We want to select the value in cell D32 below (Swindon)

Product Site Net Sales


Chicken Pie Bristol 2,000
Chicken Pie Cardiff 5,000
Chicken Pie Swindon 6,000
Chicken Pie Bath 7,000
Lamb Pie Bristol 2,000
Lamb Pie Bath 6,000
Lamb Pie Swindon 5,000
Lamb Pie Cardiff 4,000
Vegetarian Pie Cardiff 20,000
Vegetarian Pie Swindon 9,000

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Pork pie Bath 10,000
Pork pie Bristol 20,000
Pork pie Cardiff 30,000

Let's set our reference point at D29.

We then need to offset by 3 rows to move to cell D32 Swindon =OFFSET(D29,3,0)

In plain English:
Starting from cell D29, offset by 3 rows and 0 columns

So let's set our reference point at C29.

and lets enter our offset values in the cells below:

Rows 3
Cols 1 Swindon =OFFSET(C29,D56,D57)
Height 1
Width 1

Using OFFSET with SUM

We can combine OFFSET with the SUM function to create a dynamic range

Product Site Net Sales


Chicken Pie Bristol 2,000
Chicken Pie Cardiff 5,000
Chicken Pie Swindon 6,000
Chicken Pie Bath 7,000
Lamb Pie Bristol 2,000
Lamb Pie Bath 6,000
Lamb Pie Swindon 5,000
Lamb Pie Cardiff 4,000
Vegetarian Pie Cardiff 20,000
Vegetarian Pie Swindon 9,000
Pork pie Bath 10,000
Pork pie Bristol 20,000
Pork pie Cardiff 30,000

Let's set our reference point at C66.

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Row offset 3
Column offset 2
Height 3
Width 1

Result: 15,000 =SUM((OFFSET(C66,D83,D84,D85,D86)))

Can you work out which cells are being summed up?
It's pretty difficult isn't it.

In plain English:
Starting from cell C66 offset by 3 rows and 2 columns for a range that is three cells high and 1 cell wide

Application

Time & Payment Profiles

The examples above give you a generic view of the way OFFSET works, but not a great example of why you would ever choose to use it

Let's try to bring OFFSET to life a bit with an example of some very basic tax workings within a Timeline

No. of months delay to payment 1

Column counter 1 2 3 4 5 6 7 8 9 10 11 12
Tax period end value - - 100,000 - - - - - - - - -
Tax payment - - - 100,000 - - - - - - - -

In this example we use OFFSET to refer one column backwards (negative values within OFFSET move left, positive values move right)

We can take this tax example further to showcase the way OFFSET can be used to refer to a dynamic range

No. of periods per tax submission 3


No. of months delay to payment 1

Column counter 1 2 3 4 5 6 7 8 9 10 11 12
Periodic tax values 30,000 40,000 30,000 24,000 40,000 35,000 37,000 28,000 16,000 23,000 29,000 32,000
Tax period end flag - - 1 - - 1 - - 1 - - 1
Tax period end value Err:502 Err:502 Err:502 Err:502 Err:502 Err:502 Err:502 Err:502 Err:502 Err:502 Err:502 Err:502
Tax payment Tax period end value Err:502 Err:502 Err:502 Err:502 Err:502 Err:502 Err:502 Err:502 Err:502 Err:502 Err:502

Can you see the error that has been created above due to the movement in the OFFSET function?
Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
The INDIRECT function

Syntax =INDIRECT(ref_text, [a1])

ref_text - An address reference provided as text


a1 - Define the method to use. TRUE = A1 style is FALSE = R1C1 style

Key points
The INDIRECT function returns the reference specified by a text string.
The INDIRECT function is another volatile and potentially difficult function to interpret, which means it should be used carefully.
We consider it an advanced function for these reasons, but one that modellers should be aware of.

Let's start with a simple example

We want to select the value in cell D20 below

Product Price
Chicken Pie £ 2.75
Lamb Pie £ 3.00
Vegetarian Pie £ 3.25
Pork pie £ 3.15

ref_text D20 £ 3.00 {=INDIRECT(D24,TRUE())}

In plain English:
The INDIRECT function returns the value in the cell with the cell reference contained in D24 (D20)

Using INDIRECT to select a named range

We can also use named ranges in an INDIRECT function in conjunction with other functions.
In the example below the cells with sales figures from Jan to Mar for each bakery have been given a named range matching the description of the bakery.
Review the Name Manager on the Formulas ribbon if you would like to check the named ranges

Ref Jan Sales Feb Sales Mar Sales


Bakery_A 1,000 1,200 1,100 named range: D37:F37 "Bakery_A"
Bakery_B 1,600 1,800 1,400 named range: D38:F38 "Bakery_B"

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Bakery_C 2,000 1,000 1,600 named range: D39:F39 "Bakery_C"
Bakery_D 600 900 600 named range: D40:F40 "Bakery_D"
Bakery_E 1,100 1,900 2,000 named range: D41:F41 "Bakery_E"

Now we can use INDIRECT and the bakery dropdown list below to return the SUM of all sales for the chosen bakery

Bakery_B 4,800 =SUM(INDIRECT(C46))

Using INDIRECT to select a range or cell from other worksheets

We can also use INDIRECT to return a value from different worksheets. This can bring some sense of consistency and reduce the number of unique formulas in some instances:
Below we use INDIRECT in the grey cells to return the Syntax from each listed worksheet within this workbook, with one unique formula.

Worksheet Cell ref Syntax List


OFFSET B3 Syntax =OFFSET(ref, rows, cols, [height], [width]) {=INDIRECT("'" & D55 & "'!" & E55)}
INDEX B3 Syntax =INDEX(array, row_num, col_num) {=INDIRECT("'" & D56 & "'!" & E56)}
MATCH B3 Syntax =MATCH(lookup_value, lookup_array, match_type) {=INDIRECT("'" & D57 & "'!" & E57)}
INDEX MATCH B3 Syntax =INDEX(array, MATCH(lookup_value, lookup_array, match_{=INDIRECT("'" & D58 & "'!" & E58)}
INDEX 2D B3 Syntax =INDEX(array, row_num, col_num) {=INDIRECT("'" & D59 & "'!" & E59)}
INDEX MATCH B3 Syntax =INDEX(array, MATCH(lookup_value, lookup_array, match_{=INDIRECT("'" & D60 & "'!" & E60)}
OFFSET B3 Syntax =OFFSET(ref, rows, cols, [height], [width]) {=INDIRECT("'" & D61 & "'!" & E61)}

Using INDIRECT to create dependent lists

Below we have a set of lists that are set up as Excel Tables (do not worry about the details behind Excel Tables if you are unfamiliar with them - we will cover these later on in the course).
One table lists the name of each Bakery (column C), and the other tables list the names of the staff members that work at each bakery.
Within each table, the range of bakery staff names have also been set up as a named range.

Table Name: tbl_Bakeries tbl_StaffBakery1 tbl_StaffBakery2 tbl_StaffBakery3


Range Name: Bakeries Bakery_1 Bakery_2 Bakery_3

Staff Names
Bakeries Bakery_1 Bakery_2 Bakery_3
Bakery_1 Sally H Sharon R Paula E
Bakery_2 Paul B Ross L Dave B
Bakery_3 John E Tom F
Sue P

Now we can use these named ranges and the INDIRECT function to create a dependent drop down list:

1) Choose the Bakery from the first drop down list: Bakery_2
Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
2) Choose from the staff name list in this dynamic second drop down list: Ross L This cell has a drop down list that is dynamic.
INDIRECT has been added to Data Validation to make it so.
Try changing the bakery selected in step one and see what happens to the drop down list in step two

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY
Using Flags in modelling

Key points
A flag is a value in a cell that indicates a simple, binary outcome
They are typically represented as TRUE or FALSE, 1 or 0, "On" or "Off", or "Yes" or "No" (often depending on mod
Flags can be used as visual aids using a "Yes" or "No" for example, often combined with conditional formatting
The most powerful use of flags is often a simple 1 or 0 when being applied within a formula. This is because multip
Mastering the use of flags in your modelling is one of the most important steps you can make in your modelling ca

Let's start with a simple example

Sarah would like to know the value of all sales on a Monday

Using a simple logical test we can flag all rows with a


Monday with a TRUE:
Day Value Is Monday
Monday 450 TRUE
Tuesday 500 FALSE
Wednesday 600 FALSE
Thursday 500 FALSE
Friday 900 FALSE
Saturday 1,200 FALSE
Sunday 1,300 FALSE
Monday 504 TRUE
Tuesday 560 FALSE
Wednesday 672 FALSE
Thursday 560 FALSE
Friday 1,008 FALSE
Saturday 1,344 FALSE
Sunday 1,456 FALSE
Monday 432 TRUE
Tuesday 480 FALSE
Wednesday 576 FALSE
Thursday 480 FALSE
Friday 864 FALSE
Saturday 1,152 FALSE
Sunday 1,248 FALSE

There are many alternative approaches you'll see modellers taking to reach the same outcom
The key point is that you understand the power of being able to create 1 and 0 flags, and you

It might seem a little strange but you actually do not need the step to switch the TRUE to a 1 a

Day Value Is Monday Monday Value


Monday 450 1 450
Tuesday 500 FALSE 0
Wednesday 600 FALSE 0
Thursday 500 FALSE 0
Friday 900 FALSE 0
Saturday 1,200 FALSE 0
Sunday 1,300 FALSE 0
Monday 504 TRUE 504
Tuesday 560 FALSE 0
Wednesday 672 FALSE 0
Thursday 560 FALSE 0
Friday 1,008 FALSE 0
Saturday 1,344 FALSE 0
Sunday 1,456 FALSE 0
Monday 432 TRUE 432
Tuesday 480 FALSE 0
Wednesday 576 FALSE 0
Thursday 480 FALSE 0
Friday 864 FALSE 0
Saturday 1,152 FALSE 0
Sunday 1,248 FALSE 0
1,386

In modelling, because we should always be thinking of the end user, it is generally accepted th

Let's look at a more complex example

Sarah would like to sum up the total revenue for market days where is was sunny
Market Day 1 Tuesday
Market Day 2 Thursday
Market Day 3 Saturday

Day Weather Revenue Is Market Day


Monday Sunny 450 0
Tuesday Grey 500 1
Wednesday Grey 600 0
Thursday Sunny 500 1
Friday Sunny 900 0
Saturday Rainy 1,200 1
Sunday Rainy 1,300 0
Monday Grey 504 0
Tuesday Sunny 560 1
Wednesday Grey 672 0
Thursday Sunny 560 1
Friday Sunny 1,008 0
Saturday Sunny 1,344 1
Sunday Grey 1,456 0

Now let's take a look at a financial modelling example

In financial modelling flags are typically used in a single row to indicate whether something is ac

We would like to identify the first period in the model with a flag of one

Firstly let's create the formula in a tabular (vertical) form as we have above

First Period (EoM) 6/30/2022

Date Flag
1/31/2022 0
2/28/2022 0
3/31/2022 0
4/30/2022 0
5/31/2022 0
6/30/2022 1
7/31/2022 0
8/31/2022 0
9/30/2022 0
10/31/2022 0
11/30/2022 0
12/31/2022 0

Now let's flip the data over onto a horizonal layout as we would see in a financial model

First Period (EoM) 6/30/2022

Model period ending 1/31/2022 2/28/2022


Initial balance date flag 0 0

We can also create a flag to determine whether the period is in scope of the forecast or not

First Period (EoM) 6/30/2022

Model period ending 1/31/2022 2/28/2022


Pre-forecast vs forecast 0 0

We can then use this flag to control whether a value is included or not

Pre-forecast vs forecast 0 - -
Monthly cost 50 50
Result - -
r "Yes" or "No" (often depending on modeller preference)
combined with conditional formatting
d within a formula. This is because multiplying by a 1 returns a value, whilst multiplying by 0 always returns 0
teps you can make in your modelling career

Using the IF function we can convert the We can then add a simple formula to
TRUE to a 1 and the FALSE to 0 flag and add them up
Day Value Is Monday Day
Monday 450 1 Monday
Tuesday 500 0 Tuesday
Wednesday 600 0 Wednesday
Thursday 500 0 Thursday
Friday 900 0 Friday
Saturday 1,200 0 Saturday
Sunday 1,300 0 Sunday
Monday 504 1 Monday
Tuesday 560 0 Tuesday
Wednesday 672 0 Wednesday
Thursday 560 0 Thursday
Friday 1,008 0 Friday
Saturday 1,344 0 Saturday
Sunday 1,456 0 Sunday
Monday 432 1 Monday
Tuesday 480 0 Tuesday
Wednesday 576 0 Wednesday
Thursday 480 0 Thursday
Friday 864 0 Friday
Saturday 1,152 0 Saturday
Sunday 1,248 0 Sunday

taking to reach the same outcome here.


to create 1 and 0 flags, and you can use them effectively in your modelling logic.

e step to switch the TRUE to a 1 and the FALSE to a zero. Excel already sees TRUE as 1 and FALSE as 0:

nd user, it is generally accepted that it is better to use 1s and 0s instead of TRUE and FALSE simply becaus

s where is was sunny


Is Sunny Sunny Market Day
1 0
0 0
0 0
1 500 Notice that where both the "Is Market Day" and "Is S
1 0
0 0 Where either "Is Market Day" or "Is Sunny" are 0s th
0 0
0 0 Where both "Is Market Day" or "Is Sunny" are 0s the
1 560
0 0
1 560
1 0
1 1344
0 0
2,964

example

indicate whether something is active or inactive (TRUE or FALSE, on or off) across the time period

have above
see in a financial model

3/31/2022 4/30/2022 5/31/2022 6/30/2022 7/31/2022


0 0 0 1 0

in scope of the forecast or not

3/31/2022 4/30/2022 5/31/2022 6/30/2022 7/31/2022


0 0 0 1 1

ed or not

- - - 1 1
100 100 80 80 90
- - - 80 90
ways returns 0

n then add a simple formula to multiply the value by the


nd add them up
Value Is Monday Monday Value
450 1 450
500 0 0
600 0 0
500 0 0
900 0 0
1,200 0 0
1,300 0 0
504 1 504
560 0 0
672 0 0
560 0 0
1,008 0 0
1,344 0 0
1,456 0 0
432 1 432
480 0 0
576 0 0
480 0 0
864 0 0
1,152 0 0
1,248 0 0
1,386

TRUE as 1 and FALSE as 0:

UE and FALSE simply because it's easier to understand for most users.
h the "Is Market Day" and "Is Sunny" are 1s the value is brought through into column H

et Day" or "Is Sunny" are 0s then 0 is brought through into column H

t Day" or "Is Sunny" are 0s then 0 is brought through into column H

cross the time period


8/31/2022 9/30/2022 10/31/2022 11/30/2022 12/31/2022
0 0 0 0 0

8/31/2022 9/30/2022 10/31/2022 11/30/2022 12/31/2022


1 1 1 1 1

1 1 1 1 1
90 100 120 150 120
90 100 120 150 120
Some Specific Battle Ideas To Round This Off!

Think outside the box


The Excel Battle experience is unique for many reasons, not least because you find yourself under such extreme time pressure!
But it's more than that. The logical challenges you'll face in these battles will expose you to data, data structures, and logical challenges that you may never deal with in a traditional finance or modelling role
What we'll do here is just sow the seed for some of the slightly unusual ways you could start using some of the functions we've presented so far

Think of function ranges in grids

You have a lot of structural flexibility available to you when it comes to formulas like SUMIFS, COUNTIFS, even SUM to be honest, and the ranges you set up within the function's parameters.

Let's take a really basic game to walk through this in more detail:

Key: Suit Points


♣ 10
♥ 20
♠ 30
♦ 40

Random Game Board

A B C D E F G H

1 ♥ ♦ ♠ ♣ ♥ ♦ ♥ ♠
2 ♣ ♣ ♦ ♣ ♦ ♠ ♠ ♣
3 ♠ ♠ ♠ ♠ ♥ ♣ ♦ ♦
4 ♦ ♥ ♦ ♥ ♦ ♣ ♠ ♣
5 ♣ ♠ ♣ ♣ ♠ ♠ ♥ ♦
6 ♦ ♦ ♠ ♥ ♠ ♣ ♥ ♠
7 ♥ ♠ ♠ ♦ ♦ ♣ ♠ ♦
8 ♦ ♥ ♥ ♣ ♣ ♦ ♥ ♣

Let's say we have a random, simple game we want to play.


The exact rules don't really matter here as we're not going to run any simulations of the game itself.
What we will do is ask some simple questions (much like ones you may see in rounds 1-3 of the Excel Battle Series), and we'll see if we can answer them

Round 1:
What is the count of each suit in the board position referenced below plus those cells directly surrounding them (including diagonals):

Board Ref ♣ ♥ ♠ ♦
B4 2 1 4 2 {=COUNTIFS($C$27:$E$29, D$43:$G$43)}
E7 4 1 1 3 {=COUNTIFS($F$30:$H$32, D$43:$G$43)}
H1 1 1 2 0 {=COUNTIFS($I$22:$K$26, D$43:$G$43)}

Take a moment to look at the ranges we're setting up in the formulas within the grey cells above.
We're using ranges that surround a cell reference, to count the number of times each suit appears around it.
Note: we can count symbols / emojis just like we would a letter or number.

What if round 2 in the battle asked us to convert these cell positions (let's say the player "lands" on B4, E7 and H1 during the game) into points, based on the suit & points key presented above
You'll have to add the points from the suit of the cell landed on plus the points from the suits of all surrounding cells (the same logic as in round 1)

We might choose to create a second board and convert suits to points:

Random Game Board Converted to Points:

A B C D E F G H

1 #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?


2 #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
3 #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
4 #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
5 #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
6 #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
7 #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
8 #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?

Note that is the formulas in the second grid above, we're using one cell reference that links back to the first board grid, with no absolute referencing, and a fixed lookup reference to the suits points key.

Now we could use SUM to add up all the relevant points:


♣ ♥ ♠ ♦ Total
B4 #NAME? #NAME? #NAME? #NAME? #NAME? {=SUM(($C$27:$E$29 = D$76) * $C$65:$E$67)}
E7 #NAME? #NAME? #NAME? #NAME? #NAME? {=SUM(($C$27:$E$29 = D$76) * $F$68:$H$70)}
H1 #NAME? #NAME? #NAME? #NAME? #NAME? {=SUM(($C$27:$E$29 = D$76) * $I$62:$K$64)}

Or we could have made our lives much easier and avoided the need for the second grid altogether:

♣ ♥ ♠ ♦ Total
B4 #NAME? #NAME? #NAME? #NAME? #NAME?
E7 #NAME? #NAME? #NAME? #NAME? #NAME?
H1 #NAME? #NAME? #NAME? #NAME? #NAME?

What if we wanted to build out a solution, maybe to start answering some of the more complex battle questions, that allowed us to dynamically change the player's board position and calculate the score?
Assume the scoring remains the same: it's the sum of the suit the player lands on plus the points from all surrounding boards spaces based on the first board grid we showed above.

There are a few ways we could go about this (no doubt experienced players will know of more as well!)
Let's start with a neat trick to produce a grid of the board position references

A1 B1 C1 D1 E1 F1 G1 H1 {=C22:J22 & A25:A32}


A2 B2 C2 D2 E2 F2 G2 H2
A3 B3 C3 D3 E3 F3 G3 H3
A4 B4 C4 D4 E4 F4 G4 H4
A5 B5 C5 D5 E5 F5 G5 H5
A6 B6 C6 D6 E6 F6 G6 H6
A7 B7 C7 D7 E7 F7 G7 H7
A8 B8 C8 D8 E8 F8 G8 H8

That's pretty useful, but we could also cut this step and convert this to a list, with the suits listed alongside each board position reference:

2 24 Count Count Count Count Points Points Points Points


Board Ref Suit (no Board Letter Board Number Letter Char Position Excel Position Excel Position Cell
colours) Column Row Ref ♣ ♥ ♠ ♦ ♣ ♥ ♠ ♦ Total
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME? #NAME?

Clarity Consultancy Services Ltd [email protected]

Registered in the UK (6619745). Registered Office: Suite 6 Bourne Gate, Bourne Valley Rd, Poole, BH12 1DY

You might also like