Help limiting length results of results from Filter Formula without #REF!

%3CLINGO-SUB%20id%3D%22lingo-sub-2055049%22%20slang%3D%22en-US%22%3EHelp%20limiting%20length%20results%20of%20results%20from%20Filter%20Formula%20without%20%23REF!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2055049%22%20slang%3D%22en-US%22%3E%3CP%3EHey%2C%20I%20am%20building%20a%20new%20Excel%20(365)%20app%20to%20track%20our%20operations.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20the%20job%20specific%20pages%2C%20I%20am%20trying%20to%20return%20(via%20Filter%20Formula)%20just%20the%20first%20'up%20to%2010%20rows%22%20of%20data%20from%20another%20range.%26nbsp%3B%20Jobs%20will%20differ%20from%201%20row%20to%2050%20rows%2C%20thus%20I%20am%20limiting%20this%20summary%20to%20the%20first%2010%20only.%26nbsp%3B%20And%20I%26nbsp%3Bhave%20allowed%20space%20for%20a%20'Spill'%20of%20up%20to%20the%20first%2010%20relevant%20rows.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20following%20formula%20works%20well%20except%20in%20the%20cases%20that%20there%20are%20less%20than%2010%20rows%20of%20data%20in%20the%20filtered%20results.%26nbsp%3B%20In%20those%20cases%20it%20returns%20a%20%23REF!%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20if%20for%20a%20given%20job%2C%20there%20are%20only%207%20rows%20of%20data%20returned%20to%20this%20summary%2C%20then%20rows%208%2C9%20%26amp%3B%2010%20will%20show%20%23REF!%26nbsp%3B%26nbsp%3BThe%20%23REF!%20then%20causes%20other%20errors%20as%20well.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20solution%20ideas%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20my%20filter%20formula%20currently%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DINDEX(FILTER('WO%20Labor%20Index'!%24A%243%3A%24A%2410000%2C'WO%20Labor%20Index'!%24B%243%3A%24B%2410000%3DA2)%2CSEQUENCE(10))%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2055049%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-2055089%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20limiting%20length%20results%20of%20results%20from%20Filter%20Formula%20without%20%23REF!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2055089%22%20slang%3D%22en-US%22%3EI%20don't%20have%20the%20newest%20functions%20to%20test%20this%2C%20but%20could%20you%20replace%2010%20with%20MIN(10%2C%20countif())%20where%20countif%20returns%20the%20number%20of%20items%20matching%20your%20condition%3F%3CBR%20%2F%3E%3CBR%20%2F%3EOr%2C%20could%20you%20wrap%20the%20index%20function%20with%20iferror%20and%20return%20either%20blank%20or%20zero%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2056154%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20limiting%20length%20results%20of%20results%20from%20Filter%20Formula%20without%20%23REF!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2056154%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F926952%22%20target%3D%22_blank%22%3E%40Cohutta68%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20FILTER()%20returns%20less%20than%2010%20rows%2C%20INDEX%20returns%20REF%20since%20you%20try%20to%20reference%20not%20existing%20rows.%20Variant%20could%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DLET(%0A%20filt%2C%20FILTER('WO%20Labor%20Index'!%24A%243%3A%24A%2410000%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20'WO%20Labor%20Index'!%24B%243%3A%24B%2410000%3DA2)%2C%0A%20n%2C%20ROWS(filt)%2C%20INDEX(filt%2CSEQUENCE(n))%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2056665%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20limiting%20length%20results%20of%20results%20from%20Filter%20Formula%20without%20%23REF!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2056665%22%20slang%3D%22en-US%22%3EThank%20You!!!%20I%20got%20this%20resolved.%3C%2FLINGO-BODY%3E
Occasional Contributor

Hey, I am building a new Excel (365) app to track our operations.

 

On the job specific pages, I am trying to return (via Filter Formula) just the first 'up to 10 rows" of data from another range.  Jobs will differ from 1 row to 50 rows, thus I am limiting this summary to the first 10 only.  And I have allowed space for a 'Spill' of up to the first 10 relevant rows.

 

The following formula works well except in the cases that there are less than 10 rows of data in the filtered results.  In those cases it returns a #REF! 

 

So if for a given job, there are only 7 rows of data returned to this summary, then rows 8,9 & 10 will show #REF!  The #REF! then causes other errors as well. 

 

Any solution ideas?

 

Here is my filter formula currently;

 

=INDEX(FILTER('WO Labor Index'!$A$3:$A$10000,'WO Labor Index'!$B$3:$B$10000=A2),SEQUENCE(10))

6 Replies
I don't have the newest functions to test this, but could you replace 10 with MIN(10, countif()) where countif returns the number of items matching your condition?

Or, could you wrap the index function with iferror and return either blank or zero?

@Cohutta68 

If FILTER() returns less than 10 rows, INDEX returns REF since you try to reference not existing rows. Variant could be

=LET(
 filt, FILTER('WO Labor Index'!$A$3:$A$10000,
              'WO Labor Index'!$B$3:$B$10000=A2),
 n, ROWS(filt), INDEX(filt,SEQUENCE(n))
)
Thank You!!! I got this resolved.
Thank You Sergei!!! I got this resolved.

Thank you for your help!

I ended up restructuring the landing page to allow for up to the entire 100 possible rows of data.  This solution actually worked better as I realized the landing page needed all that data to allocate other expenses against.  Thanks again!

@Cohutta68