Formula Ranges automated?

hollytrab

New Member
Joined
Jan 29, 2025
Messages
12
Office Version
  1. 365
Platform
  1. Windows
=FILTER(A5:A913,NOT(COUNTIF(G5:G916,A5:A913)))
=UNIQUE(VSTACK(A5:A914,G5:G916))

I am using both of the formulas above for separate purposes. They are tethered to a pivot table that grows and shrinks through processing. I want the formulas ranges to grow and shrink automatically, instead of manually changing the ranges. Is there a way to do this?
 
So you have something more than GrandTotal row at the bottom of your Pivot table?
Because I expected first that there is Pivot table in A1 with a filter on the top, then row headers start at A5
1738238865100.png

and similar till A913
And then in A914 "Grand Total"

But what is in G914:G916?

You may try to adopt something similar to:

Excel Formula:
=LET(LastStdRow,MATCH("Grand Total",A:A,0)-1,UNIQUE(VSTACK(TAKE(A5:A1048576,LastStdRow-3),TAKE(G5:G1048576,LastStdRow-1))))
For your second formula

And if that works, use similar approach for the first one.



prot (12).csv
ABCDEFGHIJ
1FilterField(All)00
211
3Count of Values2Column Labels22
4Row Labels2344,55Grand Total33
5011244
6111255
7211266
831177
941188
1052299
1163141010
127131161111
13813151212
149331181313
15101341414
16112241515
171222151717
181311131818
1914121151919
201511114Grand TotalGrand Total
2117116363
2218112121121
2319112
prot (12)
Cell Formulas
RangeFormula
I1:I22I1=UNIQUE(VSTACK(A5:A24,G5:G26))
J1:J22J1=LET(LastStdRow,MATCH("Grand Total",A:A,0)-1,UNIQUE(VSTACK(TAKE(A5:A1048576,LastStdRow-3),TAKE(G5:G1048576,LastStdRow-1))))
Dynamic array formulas.
 
Upvote 0
Thank you Kaper. For the second formula, it works but includes the Grand Total in the stack. Any way to not include?

For the first formula. The intent is to compare two lists and display any differences. First list is A5:A913, second list is G5:G916.
 
Upvote 0
So you have something more than GrandTotal row at the bottom of your Pivot table?
Because I expected first that there is Pivot table in A1 with a filter on the top, then row headers start at A5
View attachment 121817
and similar till A913
And then in A914 "Grand Total"

But what is in G914:G916?

You may try to adopt something similar to:

Excel Formula:
=LET(LastStdRow,MATCH("Grand Total",A:A,0)-1,UNIQUE(VSTACK(TAKE(A5:A1048576,LastStdRow-3),TAKE(G5:G1048576,LastStdRow-1))))
For your second formula

And if that works, use similar approach for the first one.



prot (12).csv
ABCDEFGHIJ
1FilterField(All)00
211
3Count of Values2Column Labels22
4Row Labels2344,55Grand Total33
5011244
6111255
7211266
831177
941188
1052299
1163141010
127131161111
13813151212
149331181313
15101341414
16112241515
171222151717
181311131818
1914121151919
201511114Grand TotalGrand Total
2117116363
2218112121121
2319112
prot (12)
Cell Formulas
RangeFormula
I1:I22I1=UNIQUE(VSTACK(A5:A24,G5:G26))
J1:J22J1=LET(LastStdRow,MATCH("Grand Total",A:A,0)-1,UNIQUE(VSTACK(TAKE(A5:A1048576,LastStdRow-3),TAKE(G5:G1048576,LastStdRow-1))))
Dynamic array formulas.
Thank you Kaper. For the second formula, it works but includes the Grand Total in the stack. Any way to not include?

For the first formula. The intent is to compare two lists and display any differences. First list is A5:A913, second list is G5:G916.
 
Upvote 0
"First list is A5:A913, second list is G5:G916"

Now it is, but these will be different ranges when new data is added and pivot refreshed

Not seeing your table it is not easy to answer.

As for Grand Total excluded in second formula try to remove one more row from first of vstacked elements, so:
Excel Formula:
=LET(LastStdRow,MATCH("Grand Total",A:A,0)-1,UNIQUE(VSTACK(TAKE(A5:A1048576,LastStdRow-4),TAKE(G5:G1048576,LastStdRow-1))))
 
Upvote 0

Forum statistics

Threads
1,226,795
Messages
6,193,046
Members
453,772
Latest member
aastupin

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