Go Premium for a chance to win a PS4. Enter to Win

x
Solved

# Pivot Range Question

Posted on 2014-11-17
Medium Priority
89 Views
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
Question by:Jagwarman
• 2
• 2

LVL 50

Expert Comment

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

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 34

Expert Comment

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 34

Accepted Solution

Rob Henson earned 2000 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

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

## Featured Post

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calculâ€¦
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
###### Suggested Courses
Course of the Month12 days, 8 hours left to enroll