Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
544 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Find out how dynamic arrays in Excel will change your (working) life! Part four of a six-part series of blogs |
---|
Dynamic arrays are a new feature being rolled out in Excel 365. This blog explains how they work, and why they will make so many things in Excel easier.
|
In this blog
For this page, assume that I've created three range names called House, Character and Rating (shown coloured separately below):
You can do this by selecting A1:C11, pressing SHIFT + CTRL + F3 and choosing Top row.
The new UNIQUE function takes the following 3 arguments:
Argument | Type | Use |
---|---|---|
1 | Compulsory | The block of cells from which you want to pick out unique values. |
2 | Optional | Whether you want to pick out unique rows (in the selected range above there aren't any, since the combination of each character's house, name and rating is unique) or unique values. |
3 | Optional | Whether you want to pick out values which appear exactly once (in the above example there aren't any, as each house has at least two values). |
Here's an example to pick out the unique Hogwarts' houses:
If you miss out the second and third arguments, you'll get one version of each house referenced.
When you enter the above formula, you'll get this:
The function creates a spill range containing (as things stand) 4 entries.
You can use the SORT function to sort dynamic arrays. It takes these arguments:
Argument | Type | Use |
---|---|---|
1 | Compulsory | The column or range you want to sort. |
2 | Optional | The column number in this range you want to sort by. |
3 | Optional | The sort order (1 is ascending, -1 is descending). |
4 | Optional | Whether you are sorting by column or by row. |
For our example we'd like the houses to appear in alphabetical (and, coincidentally, moral) order:
Here we're sorting the house names alphabetically (the default). The formula is =SORT(UNIQUE(House)).
Supposing you now decide that you want to sort the characters according to the rating given. To do this, you can use the SORTBY function, which takes these arguments:
Argument | Type | Use |
---|---|---|
1 | Compulsory | The column or range you're sorting |
2 | Compulsory | The values you're sorting by |
3 | Optional | The sort order (1 is ascending, -1 is descending). |
4 | Optional | Additional array and sort order pairs (allowing you to create additional sort keys). |
Here's an example of a SORTBY function in use:
This formula is sorting the Harry Potter characters into descending order by their rating. Luna Lovegood has the highest rating, so comes at the top of the list.
Typically you would use the SORTBY function for sorting tables of data and the SORT function for sorting single columns.
You can also use dynamic arrays to pick out the rows you want, using the FILTER function. This takes the following arguments:
Argument | Type | Use |
---|---|---|
1 | Compulsory | The array to be filtered |
2 | Compulsory | An expression to evaluate for each row |
3 | Optional | What to return if the filter would return no data |
So for our example, you could show all the people in Slytherin (hiss!):
This formula would filter the list of characters to pick out all the ones in Slytherin.
Here's what this would show:
The two people in Slytherin returned by the FILTER function.
If you look for the people in the Treetops house, you'll get an error:
If a FILTER function returns no data, you get a #CALC! error.
You can get round this by using the third argument:
You can use the third argument to return something in the cell containing your formula.
You can combine two or more filters like this:
This function returns the characters in Gryffindor house who have a Wise Owl rating of 8 or more.
The syntax for this seems a bit ugly to me - I wonder why you can't include extra filters as additional arguments?
Parts of this blog |
---|
|
Some other pages relevant to the above blogs include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.