![]()
Excel -- Names -- Use Range Names in Formulas
Create a Table
Create the first Dynamic Range
Create the remaining Dynamic Ranges
Create the Date Range selection cells
Create the Summary formulas
Create the Chart
Test the ChartYou can use a dynamic formula to define a range. As new items are added, the range will automatically expand.
In this example, dynamic range names are used in formulas that summarize a list of sales records, and a chart is based on the result. When new records are added, or a different date range is selected, the chart is immediately updated.
Download the zipped sample file
Create a Table
- In a new workbook, delete all except two worksheets.
- Rename Sheet1 as SalesData
- Rename Sheet2 as Chart
- On the SalesData sheet, in cells A1:D1, add the headings, Date, Item, Colour, Units, as shown at the right.
- Enter sample data in each column, or use the data in the zipped sample file.
Create the Date Range selection cells
Use Data Validation to create dropdown lists for the chart start and end dates.
- On the Chart sheet, select cells C2 and E2.
- Choose Data | Validation
- From the Allow dropdown, choose List
- In the Source box, type: =DateList
- Click OK
- Add a border to the cells, to highlight them.
- Select a sample date in each list, to be used in the Summary formulas.
- Format the dates as desired (Format | Cells, Number tab)
Use the SUMPRODUCT function to total the sales for each colour.
- On the Chart sheet, in cells B15:B18, type the list of colours sold.
- In cell C15, enter the following formula:
=SUMPRODUCT(--(ColourList=B15),(UnitsList),--(DateList>=$C$2),--(DateList<=$E$2))- Copy the formula down to row 18.
Create a chart from the summary list.
- On the Chart sheet, select cells B15:C18.
- On the toolbar, click the Chart Wizard button
- Create a column chart from the data
- Remove the chart legend, and adjust the chart size so it fits in the space between the date selection cells, and the summary list.
- Click on the series to select it
- Click on the Red column, to select it.
- Double-click on the Red column, to open the Format Data Point dialog box
- For Area, select the red colour, then click the OK button.
- Double-click on each of the remaining columns, and colour them.
- From the Date Range selection cells, select different dates.
- The chart should update immediately, to reflect the new date range.
For more information on Excel Charts, see Jon Peltier's site.
Download the zipped sample file
1. Names -- Naming Ranges
2. Names -- Using Names in Formulas
Last updated: July 18, 2008 11:42 PM