Solved

Pivot Range Question

Posted on 2014-11-17
5
77 Views
Last Modified: 2014-11-19
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
0
Comment
Question by:Jagwarman
  • 2
  • 2
5 Comments
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 40446789
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
0
 

Author Comment

by:Jagwarman
ID: 40446806
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.
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 40446956
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
0
 
LVL 32

Accepted Solution

by:
Rob Henson earned 500 total points
ID: 40447245
So if I am extrapolating correctly:

Bref  refers to:

=OFFSET($M$6,0,0,COUNTA($M:$M),1)

Sub refers to:

=OFFSET($P$6,0,0,COUNTA($P:$P),1)

Source refers to:

=OFFSET($I$6,0,0,COUNTA($I:$I),1)

This assumes there is nothing above row 6 in each of the columns.

Formula would then be:

=1/SUMPRODUCT(--(Bref=M6),--(Sub=P6),--(Source=I6))

Thanks
Rob H
0
 

Author Comment

by:Jagwarman
ID: 40447266
Thanks Rob that is what I needed. Can't close from this PC will close later.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now