UNIQUE(FILTER(INDIRECT formula

craigexcel

Active Member
Joined
Jun 28, 2006
Messages
298
Office Version
  1. 2016
Platform
  1. Windows
Using Office 365.

It appears I must have a syntax error in my formula, but I haven't been able to resolve yet.
While this version works, where I specifically reference the range of data to use (i.e. Row 1185) ....
=SORT(UNIQUE(FILTER(combined!B6:C1185,NOT(ISNUMBER(SEARCH("Total",combined!B6:B1185))))),{1,2},1,FALSE)

this dynamic version (since the source is a pivot table in an adjacent sheet) does NOT work, and returns #VALUE! .....
=SORT(UNIQUE(FILTER(INDIRECT("combined!B6:C"&COUNT(combined!D6:D5000)),NOT(ISNUMBER(SEARCH("Total",combined!B6:B5000))))),{1,2},1,FALSE)

I also tried changing INDIRECT("combined!B6:C"&COUNT(combined!D6:D5000 ..... to ..... INDIRECT("combined!B6:C"&COUNTA(combined!B6:B5000 thinking maybe the Column needed to be in sync, but that didn't work either.
{Column B in the "combined" sheet pivot table has text; Column D has values.}

I chose Row 5000 as that should always be a sufficiently large range. I assume the issue is with the use of the INDIRECT function, as the SORT and UNIQUE seem reasonably straightforward.
Can someone provide an extra set of eyes to pinpoint the issue?? This has to be something simple.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
The issue you're encountering is due to the two arrays being different sizes. INDIRECT is relying on a COUNT to define the lower end of the range...and the range begins on row 6. Yet the NOT(ISNUMBER array is an array consisting of 4995 (5000-6+1) elements. The two arrays need to be the same length. What are you attempting to do?...construct a dynamic range for the FILTER function?
 
Upvote 0
You might try an approach like this to form dynamic ranges without using a volatile function like INDIRECT. Here, two dynamic ranges are constructed for the FILTER function, and the -5 accounts for beginning the range at row 6. Other information on the sheet might affect the approach to form these arrays, so test carefully.
Book1
BCDEFG
5Unique
6aD6aD
7bC7bC
8cB8cB
9TotalA9cZ
10aD6dA
11bC7dG
12cZ8
13dA9
14TotalD6
15bC7
16cB8
17dG9
combined
Cell Formulas
RangeFormula
F6:G11F6=SORT(UNIQUE(FILTER($B$6:INDEX($C$6:$C$5000,MAX((D:D<>"")*(ROW(D:D)))-5),NOT(ISNUMBER(SEARCH("Total",$B$6:INDEX($B$6:$B$5000,MAX((D:D<>"")*(ROW(D:D)))-5)))))),{1,2},1,FALSE)
Dynamic array formulas.
 
Upvote 0
I had another look and you might be able to avoid forming dynamic ranges altogether if you are able to eliminate the blank entries in columns B:C, as done here in the example labeled "Alternative"...where (B6:B5000<>"") will keep only those rows in the range of interest.
Book1
BCDEFGHIJ
5UniqueAlternative
6aD6aDaD
7bC7bCbC
8cB8cBcB
9TotalA9cZcZ
10aD6dAdA
11bC7dGdG
12cZ8
13dA9
14TotalD6
15bC7
16cB8
17dG9
combined
Cell Formulas
RangeFormula
F6:G11F6=SORT(UNIQUE(FILTER($B$6:INDEX($C$6:$C$5000,MAX((D:D<>"")*(ROW(D:D)))-5),NOT(ISNUMBER(SEARCH("Total",$B$6:INDEX($B$6:$B$5000,MAX((D:D<>"")*(ROW(D:D)))-5)))))),{1,2},1,FALSE)
I6:J11I6=SORT(UNIQUE(FILTER(B6:C5000,(B6:B5000<>"")*NOT(ISNUMBER(SEARCH("Total",B6:B5000))))),{1,2},1,FALSE)
Dynamic array formulas.
 
Upvote 0
Solution
Thx KRice for your extra set of eyes & your replies. I appreciate it. I opted to use the formula shared in the previous post, for cell [I6].
I see what I overlooked, with the ranges I was referencing.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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