Pivot Range Dynamic by Column & Row Length

wmp8b79

New Member
Joined
Oct 4, 2010
Messages
7
Hello,

I am hoping that someone can tell me why I am able to attach a pivot table to the named range "PivotRange1" and not to "PivotRange2". While in Name Manager they produce same range so I don't understand why I get a message "Range not valid" for PivotRange2 and PivotRange1 works just fine.

Here's what I have coded in for the named range of each

PivotRange1: =INDIRECT("Sheet1!A1:R"&COUNTA(Sheet1!$C:$C))

this produces a dynamic range by row for a pivot table but column length is static to column R

Pivot Range2: =INDIRECT("Sheet1!A1:"&ADDRESS(COUNTA(Sheet1!$C:$C),COUNTA(Sheet1!$1:$1),4))

this produces a dynamic range by both row and column but returns a range not valid error when I try to attach the pivot table

Thanks for the help!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I still would like help with this, does anyone have a suggestion or an idea why the second named formula does not attach to a pivot table?
 
Upvote 0
Ended up finding a better way to do a dynamic range by row and column to attach to a pivot... here's the formula to attach to a named range

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

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top