wlwebb

asked on

# Excel Dynamic Range Name to update Pivot Table Source Data

I am attempting to dynamically update the range for a Named Range in Excel that is used by a Pivot Table. I have seen some examples but mine is giving me an error {Reference Is not valid.}.

My data source table Starts in cell A4 and Ends in column H. I named the range "PayDatesDataAll" and following is the Refers To: statement

PayDatesDataAll

="'Pay Dates Data'!$A$4:INDEX('Pay Dates Data'!$4:$1048576,COUNTA('Pay Dates Data'!$A:$A),COUNTA('Pay Dates Data'!$1:1))"

However, when I go to my Pivot Table (which currently just has a static range "a4:H6" and try to replace it with the named range PayDatesDataAll I get an error.

Columns A, C, and H are formatted as Dates if it makes any difference

My data source table Starts in cell A4 and Ends in column H. I named the range "PayDatesDataAll" and following is the Refers To: statement

PayDatesDataAll

="'Pay Dates Data'!$A$4:INDEX('Pay Dates Data'!$4:$1048576,COUNTA('

However, when I go to my Pivot Table (which currently just has a static range "a4:H6" and try to replace it with the named range PayDatesDataAll I get an error.

Columns A, C, and H are formatted as Dates if it makes any difference

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER

Copied and pasted on the Pay Dates Data Table into cell j18

=INDEX('Pay Dates Data'!$4:$1048576,COUNTA('Pay Dates Data'!$A:$A),COUNTA('Pay Dates Data'!$1:1))

The answer I got was 0 (zero)

=INDEX('Pay Dates Data'!$4:$1048576,COUNTA('

The answer I got was 0 (zero)

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER

If I do just CountA(a4:a15) I get 6 which is the number of lines that have data

The answer I got was 0 (zero)

And hence the error. Check teylyns's formula.

Sid

And hence the error. Check teylyns's formula.

Sid

Can you post a sample workbook?

Sid

Sid

ASKER

teylyn

My data starts in a4 and goes over to column H and then down however many rows have data

My data starts in a4 and goes over to column H and then down however many rows have data

ASKER

ASKER

when I paste teylen's the following I still get 0

=INDEX('Pay Dates Data'!$4:$1048576,COUNTA('Pay Dates Data'!$A:$A),COUNTA('Pay Dates Data'!$4:$4))

=INDEX('Pay Dates Data'!$4:$1048576,COUNTA('

ASKER

Just got it to work with Teylyn's formula with one other variation. When I went back to my Name Manager to paste her's in mine also had quotations (") at the beginning and end of the reference. Once I removed those it works.

Thanks to both of you!

Thanks to both of you!

ASKER

I split the points 300 Teylyn/200 Sid since both of you were very helpful but Teylyn's was the exact working reference.

When you copy and paste a formula from EE into the Refers to box of the Name Manager, it will always have " marks that you need to delete. It's not a flaw in the formula but due to the copy and paste from HTML.

cheers, teylyn

cheers, teylyn

Ah I see the error.

To understand it better Here is how Index Formula works...

It gets you the value in the intersection of the row and the column. However your

COUNTA('Pay Dates Data'!$A:$A) = 12

and COUNTA('Pay Dates Data'!$1:1)=0

That is why it is not able to find a value.

If you use a basic index formula

=INDEX('Pay Dates Data'!$4:$1048576,11,8)

Then it will give you "41090"

The syntax of Index() is

INDEX(array,row_num,column_num)

Sid

To understand it better Here is how Index Formula works...

It gets you the value in the intersection of the row and the column. However your

COUNTA('Pay Dates Data'!$A:$A) = 12

and COUNTA('Pay Dates Data'!$1:1)=0

That is why it is not able to find a value.

If you use a basic index formula

=INDEX('Pay Dates Data'!$4:$1048576,11,8)

Then it will give you "41090"

The syntax of Index() is

INDEX(array,row_num,column

Sid

Oops I am late for the party :)

Sid

Sid

The formula was fine, basically. But it was counting in Row 1 for the last parameter instead of row 4, where the data to be counted actually sits.

cheers, teylyn

cheers, teylyn

Absolutely.

Sid

Sid

=INDEX('Pay Dates Data'!$4:$1048576,COUNTA('

What is the value/error that you are getting?

Sid