Link to home
Start Free TrialLog in
Avatar of Jagwarman
Jagwarman

asked on

Pivot Range Question

Rob Henson solved a previous question for me relating to the issue of ranges changing when new data is imported into the spreadsheet. The answer was:

=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),COUNTA(Sheet1!$1:1))

I figured I would be able to make a slight change to this when the range is a single column [Wrong]

So experts, please explain how to make a named range in a single column always pick up up all of the data.

And just to clarify I have 3 ranges Bref, Sub and Source which I then refer to in the below formula.

=1/SUMPRODUCT(--($M$6:Bref=M6),--($P$6:Sub=P6),--($I$6:Source=I6))

and my problem is that if the total number of rows imported last was say 260 when I import today and there are 320 the ranges do not increase to 320.

Thanks
Avatar of Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Flag of New Zealand image

Hello,

the formula provided above will create a range that starts in A1 and spans all used columns.

If you only need one column and you know the column letter, say column C, you could use

=OFFSET(Sheet1!$c$1,0,0,COUNTA(Sheet1!$c:$c),1)

If column C may contain blanks, but column A always has data in each row, you may want to use column A for the vertical sizing of the column, like this:

=OFFSET(Sheet1!$c$1,0,0,COUNTA(Sheet1!$a:$a),1)

In words that formula means: Start in cell C1, go 0 cells down, go 0 cells to the right. Make the selection as high as there are populated cells in column A and make the selection one column wide.

Note that with the CountA function the returned range will be too short if there are blank cells in column A. There are other ways to determine the last used cell in column A (or C). You should be fine if there are no blanks in the data.

cheers, teylyn
Avatar of Jagwarman
Jagwarman

ASKER

Hi teylyn

I tried to put this in so that my formula would look at it. [my formula is =1/SUMPRODUCT(--($M$6:Bref=M6),--($P$6:Sub=P6),--($I$6:Source=I6))  ]

So I presumed I would change Bref in Name Manager to =OFFSET....... but this does not work.

Clearly this is not what I should be doing.
Jagwarman

Your SUMPRODUCT formula is effectively trying to create a range with 3 parameters

M6:RangeStart:RangeFinish

If Bref is creating a Range then you would only need (Bref=M6) for that part of the formula.

if you want the Range to start at M6 then the OFFSET function would start:

=OFFSET(M6,....

Thanks
Rob H
ASKER CERTIFIED SOLUTION
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Rob that is what I needed. Can't close from this PC will close later.