## Two New Cases

### 06 02 2015

Here are two new Excel based cases I have just prepared that I know some of you will appreciate.

UK Petrol Prices

I downloaded a file of all retail petrol and diesel prices for the UK from 2003 to 2014. The task is to prepare an interactive table so that the user just enters a date in one cell and the table then shows the

• retail pump price per litre
• duty per litre
• VAT percentage
• calculation of the cost of the petrol net of duty and VAT

This case involves the use of a variety of techniques including

• VLOOKUP()
• Data Validation
• IFERROR()
• Paste Special Multiply

Here’s an example of my output:

This video summarises the case:

Sleep Requirements.

In today’s Borneo Bulletin newspaper there is an article on the sleep requirements of people of all ages. They give the requirements such as, a new born baby needs from 14 to 17 hours a day … someone over 65 years of age needs from 7 to 8 hours sleep a day.

The task is to turn a photo of the data into a table and a chart that communicates as effectively as possible: I prepared the following:

Please feel free to write to me at any time to ask for the spreadsheets that accompany these cases. At the moment they are live cases and I won’t release them generally until the course has finished in a week’s time..

Duncan Williamson

## Reverse Pivot Magic

### 11 11 2013

UPDATE: 13th September 2019 I can imagine some of my visitors will still find this page of use if they are using a very old version of Excel. However, if you are using Excel 2016 or 2013 or even 2010, you should be able to use a much newer and more powerful technique for unpivoting data. Of course, I already have a page for that and here it is: Power Query Unpivoting

UPDATE: 16th January 2014: I have been using this technique since I last reported and I have found some limitations AND solutions to this reverse pivot technique. I will prepare a page and video to demonstrate what I have found.

2nd December 2013

Watch the video and then imagine that you have downloaded a five year set of financial statements for a company. Nothing wrong with the data or the database they came from but imagine you want to set up a pivot table from them. Probably not possible unless you are lucky enough to have a data provider who has designed their output with this in mind.

Let’s cut a long story short: open this file amazon_case_reverse_pivot and try to apply the reverse pivot technique in my video to the data you will see there. Good luck and it will be worth any effort you put into it! PLEASE READ THE NOTES in this work book re copyright …

I didn’t invent this technique but I learned it a couple of weeks ago and used it in earnest just now … watch the video!

I had a table that had months across the top, years down the left hand side and data in between. What I wanted was the data in a list in three columns:

year month value

transposing, rotating, copying and pasting can give you what you want but it will take a long time. My original table covered all twelve months and five years …

Reversing a Pivot table is what it’s called and this is how to do it:

1. Press Alt + D then P to call up the pivot table wizard and select Create a “Multiple Consolidation Ranges PivotTable.”
2. Select “I will create my own page fields”.
3. Select your data range and choose 0 page fields
4. When you see your pivot table, double click on the intersection of Row Grand and Column Grand, in the bottom right hand corner of your pivot table
5. You will be presented with your new table in the form of a list … that is, from pivot table style to list style … it’s magic!

The video

Duncan Williamson

## AGGREGATE Function Templates

### 11 11 2013

I know I learned this function a while ago but then I forgot about it. The aggregate function was newly created for Excel 2010 and it provides us with some interesting functionality: overcoming shortfalls in the performance of such functions as AVERAGE, MIN, MAX, LARGE, SMALL and a few more … 19 of them altogether. The trouble is, good as it is, it is not that simple to apply. What I have done then is  to create templates that will help you to use the aggregate function in one or both of the formats in which it might be used.

From the Excel Help File:

Returns an aggregate in a list or database. The AGGREGATE function can apply different aggregate functions to a list or database with the option to ignore hidden rows and error values.

Syntax

Reference form

AGGREGATE(function_num, options, ref1, [ref2], …)

Array form

AGGREGATE(function_num, options, array, [k])

The AGGREGATE function syntax has the following arguments (argument:

Function Number

Required. A number from 1 to 19 that specifies which function to use

Options

Required. A numerical value that determines which values to ignore in the evaluation range for the function

Ref 1

Required. The first numeric argument for functions that take multiple numeric arguments for which you want the aggregate value

Ref 2

Optional. Numeric arguments 2 to 253 for which you want the aggregate value

For functions that take an array, ref1 is an array, an array formula, or a reference to a range of cells for which you want the aggregate value. Ref2 is a second argument that is required for certain functions. The following functions require a ref2 argument:

• LARGE(array,k)
• SMALL(array,k)
• PERCENTILE.INC(array,k)
• QUARTILE.INC(array,quart)
• PERCENTILE.EXC(array,k)
• QUARTILE.EXC(array,quart)

The AGGREGATE function is designed for columns of data, or vertical ranges. It is not designed for rows of data, or horizontal ranges. For example, when you subtotal a horizontal range using option 1, such as AGGREGATE(1, 1, ref1), hiding a column does not affect the aggregate sum value. But, hiding a row in vertical range does affect the aggregate.

My templates will tell you if you are trying to use the wrong format of aggregate and has then been set up to ensure you don’t make any other mistakes when using it. This includes providing combobox guidance for choosing which functions and options you need to use.

The Excel file is available here: aggregate_function … just click!

All feedback is warmly received as are suggestions for improvement.

Duncan Williamson