say I had the followeing:
Book1 |
---|
|
---|
| B | C | D | E |
---|
1 | Date | Value | | |
---|
2 | 1/01/2001 | 1 | | |
---|
3 | 1/02/2001 | 2 | | |
---|
4 | 1/03/2001 | 3 | | |
---|
5 | 1/04/2001 | 4 | | |
---|
6 | 1/05/2001 | 5 | | |
---|
7 | 1/06/2001 | 6 | | |
---|
8 | 1/07/2001 | 7 | | |
---|
9 | 1/08/2001 | 8 | | |
---|
10 | 1/09/2001 | 9 | | |
---|
11 | 1/10/2001 | 10 | | |
---|
12 | 1/11/2001 | 11 | | |
---|
13 | 1/12/2001 | 12 | | |
---|
14 | 1/01/2002 | 13 | | |
---|
15 | 1/02/2002 | 14 | | |
---|
16 | 1/03/2002 | 15 | | |
---|
|
---|
...& wanted to set a range to cover only the last 12 entries. Defined ranges are st up using einsert | name | define. Define a name pivot_range to equal:
=OFFSET(Sheet1!$B$1,COUNTA(Sheet1!$B:$B)-12,0,12,2)
Bit-by-bit:
=OFFSET(
Sheet1!$B$1
- so we're starting from B1
=OFFSET(Sheet1!$B$1,
COUNTA(Sheet1!$B:$B)
- & we're going down as many many rows as are counted to have something in them - which should be the end of the list if there's no gaps in the data
=OFFSET(Sheet1!$B$1,COUNTA(Sheet1!$B:$B)
-12
- then taking 12 off to move back up the list 12 rows to get the start point
=OFFSET(Sheet1!$B$1,COUNTA(Sheet1!$B:$B)-12,
0,
- not offsetting any columns
=OFFSET(Sheet1!$B$1,COUNTA(Sheet1!$B:$B)-12,0,
12,
- and the range we want is 12 rows "high" from the start point established above
=OFFSET(Sheet1!$B$1,COUNTA(Sheet1!$B:$B)-12,0,12,
2)
- & my example has 2 columns, so we want the range 2 columns wide.
Set up a similar example yourself, to get the hang of it. check the range defined by hitting ctrl + G & going to pivot_range. Add some data to the bottom of the list & do it again.
To use this in a pivot, just set the pivot's target range as pivot_range in step 2 of the pivot wizard.