Whatever the timeframe being reported, this can mean a lot of time editing chart sources and formulas to show the right data.

This blog post looks at creating a dynamic rolling chart to show the last 6 months of data, so when new data is added to the table, the chart automatically updates to report the last 6 rows (months).

To create a rolling chart, we will first create two dynamic named ranges. These will automatically capture the last 6 months data. One named range for the chart data, and the other for its labels. We will then use these named names for our chart source.

The OFFSET function will be used to make the named ranges dynamic. This function enables you to reference ranges, relative to another range of a sheet. So this can be used to capture the last 6 rows.

Let’s first create the chart data named range.

- Click the
**Formulas**tab of the Ribbon and then the**Define Name**button. - Enter a name for the defined name. You can use whatever name you wish. I have called this one
*ChartData*. - In the
**Refers to**area, enter the formula below. The different parts of this formula can be edited to meet your needs.

This formula starts from cell B1. It then moves to the bottom of the column. The column bottom is found by counting how many values in column B. The -6 and 1 on the end of the formula are used to return the last 6 rows and 1 column from that cell.

=OFFSET(Sheet1!$B$1,COUNT(Sheet1!$B:$B),0,-6,1)

We now need to create another dynamic named range for the chart labels. The OFFSET function below will be used.

This function uses the previous defined name and selects a range of equal height that is one column to the left. In this example, that is column A.

=OFFSET(ChartData,0,-1)

The chart new needs to be edited to use the named ranges for its data and its labels.

- Click the
**Design**tab under**Chart Tools**on the Ribbon. - Click the
**Select Data**button.

- Click the
**Edit**button from the Series section on the left. - Cell B1 has been selected for the
**Series name**. This uses the Sales header for the name of the data series (in this example that is kind of redundant as I only have one series, but you may have more). - For
**Series Values**, the*ChartData*named range has been entered. Be sure to keep the sheet name in there too like in the image below.

- Click
**Ok**, and then click the**Edit**button for the Labels section on the right. - In the
**Axis label range**area, the*ChartLabels*named range has been entered. Once again be sure to keep the sheet name in the reference. And click**Ok**.

The dynamic rolling chart is created. If you add more rows to the table, the chart automatically updates to show the last 6 months.

Highlight the max and min values of a column chart

Create a scrollable chart for your Excel dashboards

]]>Excel contains 400+ functions and this list is constantly growing. There are functions to perform almost any task from financial, date and time, statistical etc.

This learn how to use Excel post looks at 3 little known special Excel functions that will take your skills to another level and make you the envy of your work colleagues.

The CHOOSE function in Excel returns a value or performs an action from a list of values based on a specified position. For example it may sum a range or lookup a different table based on user selection.

The syntax for the CHOOSE function is:

*=CHOOSE(index_num, value1, [value2], …)*

**index_num** – Specifies which value in the list of values that you want. It can be entered as a number between 1 and 254, a cell reference or a formula.

**value** – 1 to 254 values that the *index_num* will be selected from. They can be numbers, text, cell references, named ranges or formulas.

The example below shows the CHOOSE function (cell E3) being used to sum the fruit sales by quarter dependent on the user selection in cell E2.

=SUM(CHOOSE($E$2,B6:B10,C6:C10,D6:D10,E6:E10))

The CHOOSE function is brilliant to use with form controls on an Excel worksheet such as combo boxes and option buttons. Because the option selected by a user is returned as an index number, the CHOOSE function is perfect for making other things happen based on this selection.

The second of these special Excel functions is the DGET function. The DGET function is a database function in Excel that will look up and retrieve data from a table. It is very powerful and can retrieve data based on multiple conditions making it more effective than the likes of the more famous VLOOKUP function.

The DGET function is written as below.

*=DGET(database, field, criteria)*

**Database** – The range of cells where you want to search for and retrieve the data. The first row must contains the headings for each column.

**Field** – The column containing the information that you want to return. This can be entered as the column’s index number i.e. 5, or you can use the column heading enclosed with quotation marks e.g. “Salesperson”.

**Criteria** – The range of cells that contain the conditions for your search. The first row must contain the column heading.

The following formula returns the salesperson that took order 11248.

=DGET($A$1:$F$800,1,$H$2:$H$3)

The formula looks within range A1:F800 and returns whatever data it finds in the first column. The criteria for the search is stored in range H2:H3. H2 contains the column heading of Order ID. This exactly matches the one found in row 1 of the database. Cell H3 contains the content to search for, in this case 11248.

The OFFSET function can be a confusing one to get your head around, but once you have it sussed it will take your Excel spreadsheets to new levels.

The OFFSET function returns a cell or range of cells that are a specified number of rows and columns from a starting reference.

Make sense? No? It didn’t to me either at first. Let’s break the function down and then see an example of its use.

The formula is written as below;

=OFFSET(reference, rows, columns, height, width)

**Reference:** This is the starting point.

**Rows:** This is the number of rows you want to move from the starting point. Use a positive number to move down, or a negative number to move up.

**Columns:** This is the number of columns you want to move from the starting point. Use a positive number to move to the right, or a negative number to move to the left.

**Height:** The number of rows high that the range of cells you want to return is.

**Width:** The number of columns wide that the range of cells you want to return is.

The height and width arguments are optional. If they are not used then the width and height of the returned reference is the same as the starting reference.

Ok. Let’s see an example of the OFFSET function in action.

The most popular reason for using this function in Excel is to create a dynamic range. A range that will increase automatically as you add new rows or columns to your table of data. The video below shows it being used to create a dynamic SUM formula.

Rather than nesting the function inside an existing formula such as SUM. Using the OFFSET function to create a dynamic range name is an awesome technique. Formulas and charts can then be based on this range name and will automatically update as the table of data changes.

Browse to Computergaga website to learn how to use Excel fast.

]]>