Академический Документы
Профессиональный Документы
Культура Документы
Tips
Files
Products
Newsletter
Blog
Introduction
In Excel, you can add a Scroll Bar, and use it to change the values in worksheet cells. In
this example, the Scroll Bar will change the end date in a summary report, so you can
scroll through the months, and see the data change.
This technique does not require any programming.
A pivot table is on a separate worksheet, and is based on the sales order table. The order
month is in the row area, region is in the column area, and quantity is in the values area.
Create a List of Dates
On a separate worksheet, named AdminDates, you'll set up a list of dates, and named
cells to calculate which date has been selected in the scroll bar.
In this example, we want to be able to scroll to any date in the past 12 months, so you'll
use formulas to create a list of 12 month end dates:
=DATE(YEAR(TODAY()),MONTH(TODAY())+1,1)-1
3. In cell F3, enter the following formula, to calculate the last date in the previous
month
=DATE(YEAR(F2),MONTH(F2),1)-1
4. Select cell F3, and copy its formula down to cell F13, to create a list of 12 month end
dates.
4. Type the number 12 in cell C2 -- later, the Scroll Bar will automatically put a
number in this cell
5. In cell C3, enter the following INDEX / MATCH formula, to pull the selected date
from the list of dates. This will find the selected number in column E, and return
the date from that row.
=INDEX(F2:F13,MATCH(ScrollBarSel,E2:E13,0))
6. Format cell C3 as a date, so you can check that the correct date is showing
1. You'll add formulas in the next step, and for now, just type dates in the heading
row, and put fake numbers in the value cells.
2. Add SUM formulas in the Total column and Total row, to calculate the monthly
totals and region totals.
TIP: After you enter the fake numbers, select cells C6:F8, and click the
AutoSum command on the Ribbon, to automatically create the SUM
formulas.
1. On the Summary sheet, in cell E5, type a formula to link to the selected date cell:
=DateSel
2. In cell C5, type a formula to calculate the previous month's end date, and copy
across to cell D5:
=DATE(YEAR(D5),MONTH(D5),1)-1
Add Formulas to the Value Cells
Next, you'll add formulas to the value cells in the summary table, to pull data from the
pivot table..
3. Press Enter, to complete the GETPIVOTDATA formula. I've added line breaks in
this example, to make the formula easier to read. The formula refers to a specific
date and region, and you'll change those to cell references.
4. In the formula, select "East", including the quote marks, and click on cell B6, where
the East label is. Add a $ in front of the B, to make the column an absolute
reference -- $B6.
5. Next, change the DATE formula within the GETPIVOTDATA formula, so it refers to
the date heading in cell C5. For this reference, use an absolute reference to the row,
and a relative reference to the column -- C$5
DATE(YEAR(C$5),MONTH(C$5),DAY(C$5))
6. Next, wrap the GETPIVOTDATA formula with an ERRORIF formula, and return a
0 if there is an error. Here is the final formula.
=IFERROR(GETPIVOTDATA("Quantity",'Region Pivot'!$B$3,
"OrderMth",DATE(YEAR(C$5),MONTH(C$5),DAY(C$5)),
"Region",$B6),0)
7. Finally, copy the formula across to column E, and down to row 7, to complete the
table.
8. The table will show the correct quantity for each month and region.
2. On the Summary sheet, above the date headings, draw a scroll bar.
3. Right-click on the scroll bar, and click Format Control
4. In the Format Control window, on the Control tab, change the settings so the values
are:
o Current Value: 1
o Minimum Value: 1
o Maximum Value: 12
o Incremental Change: 1
o Page Change: 3
o Cell Link: ScrollBarSel
5. Click OK, to complete the settings
Use the Scroll Bar
Before you can test the Scroll bar, click on the worksheet, to unselect the Scroll bar.
Then, to use the Scroll Bar:
click the arrow at either end of the Scroll Bar, to go up or down 1 month
drag the scroll box, to move quickly through the months
click in the Scroll Bar, to go up or down a page (3 months)
More Tutorials
INDEX / MATCH formula
TEXT function
GetPivotData
Search Contextures Sites
More Links
INDEX / MATCH formula
TEXT function
GetPivotData
Copyright © Contextures Inc. 2019
Privacy Policy
Debra Dalgleish
Last updated: November 29, 2018 3:22 PM
Contextures RSS Feed