SOLVED
Home

Limiting the length of results from Dynamic / Spill Arrays

%3CLINGO-SUB%20id%3D%22lingo-sub-1058869%22%20slang%3D%22en-US%22%3ELimiting%20the%20length%20of%20results%20from%20Dynamic%20%2F%20Spill%20Arrays%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1058869%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20figure%20out%20a%20way%20to%20limit%20the%20number%20of%20results%20returned%20from%20a%20dynamic%20array%20such%20as%20%3DUNIQUE%20or%20%3DFILTER.%20So%20for%20example%2C%20say%20I%20want%20to%20only%20want%20to%20return%20the%20first%2010%20unique%20values%20from%20a%20list%20in%20column%20A.%20Using%20%3DUNIQUE(A%3AA)%20alone%20will%20return%20all%20unique%20values.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20best%20solution%20I%20have%20is%20to%20do%20something%20like%20wrap%20the%20UNIQUE%20formula%20in%20an%20INDEX%20formula%3A%20%3DINDEX(UNIQUE(A%3AA)%2CROW()%2C1)%2C%20and%20copy%20that%20down%2010%20rows%2C%20but%20I%20imagine%20this%20is%20very%20performance%20heavy%20as%20it%20is%20effectively%20calculating%2010%20%22UNIQUE%22%20formulas%2C%20rather%20than%201%20that%20spills.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20any%20native%20way%20to%20return%20a%20specific%20number%20of%20results%20from%20a%20Dynamic%20Array%20%2F%20Spill%20formula%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1058869%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1059008%22%20slang%3D%22en-US%22%3ERe%3A%20Limiting%20the%20length%20of%20results%20from%20Dynamic%20%2F%20Spill%20Arrays%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1059008%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F484442%22%20target%3D%22_blank%22%3E%40chastain1337%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%3E%3D%20INDEX(%20UNIQUE(ColumnA)%2C%20SEQUENCE(10)%20)%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CFONT%3Ewould%20return%2010%20values%20and%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%3E%3CSTRONG%3E%3CFONT%3E%3D%20INDEX(%20UNIQUE(ColumnA)%2C%20SEQUENCE(1%2C10)%20)%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%3Ewould%20transpose%20the%20result%20array.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1060123%22%20slang%3D%22en-US%22%3ERe%3A%20Limiting%20the%20length%20of%20results%20from%20Dynamic%20%2F%20Spill%20Arrays%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1060123%22%20slang%3D%22en-US%22%3EPeter%2C%3CBR%20%2F%3E%3CBR%20%2F%3EThat%20did%20the%20trick!%20Thanks%20for%20the%20help.%3C%2FLINGO-BODY%3E
Highlighted
chastain1337
New Contributor

I am trying to figure out a way to limit the number of results returned from a dynamic array such as =UNIQUE or =FILTER. So for example, say I want to only want to return the first 10 unique values from a list in column A. Using =UNIQUE(A:A) alone will return all unique values.

 

The best solution I have is to do something like wrap the UNIQUE formula in an INDEX formula: =INDEX(UNIQUE(A:A),ROW(),1), and copy that down 10 rows, but I imagine this is very performance heavy as it is effectively calculating 10 "UNIQUE" formulas, rather than 1 that spills.

 

Is there any native way to return a specific number of results from a Dynamic Array / Spill formula?

2 Replies
Solution

@chastain1337 

 

= INDEX( UNIQUE(ColumnA), SEQUENCE(10) )

would return 10 values and 

= INDEX( UNIQUE(ColumnA), SEQUENCE(1,10) )

would transpose the result array.

 

Peter,

That did the trick! Thanks for the help.
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
50 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
32 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
15 Replies
Discussion - Updating our interface with Fluent touches
Elliot Kirk in Discussions on
102 Replies