#NUM Error Help Needed

BrettOlbrys1

Board Regular
Joined
May 1, 2018
Messages
128
Office Version
  1. 365
Platform
  1. Windows
I have the following formula:

=INDEX(SORT(FILTER(Activations,(Activations[Qty]>=(LARGE(IF(Activations[Product]=D34,Activations[Qty]),5)))*(Activations[Product]=D34)),3,-1),SEQUENCE(5),{1})

The result of this formula is a list of the 5 largest values from a dataset. The two numbers in red font tell the formula to find and list only the top 5 values. But if there are LESS THAN 5 values that meet the criteria within the formula, I get a #NUM error because it is looking for 5 values.

What I want to happen is to find and list no more than the 5 largest values, but if there are only 4, 3, 2, or 1 value that meets the criteria in the formula, I want it to be listed, not a #NUM error.

How can I resolve this issue?

Thanks

Brett
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Do you have the TAKE function yet?
 
Upvote 0
Ok, how about
Excel Formula:
=LET(f,SORT(FILTER(Activations,Activations[Product]=D34),3,-1),INDEX(f,SEQUENCE(MIN(ROWS(f),5)),1))
 
Upvote 0
Ok, how about
Excel Formula:
=LET(f,SORT(FILTER(Activations,Activations[Product]=D34),3,-1),INDEX(f,SEQUENCE(MIN(ROWS(f),5)),1))
Sorry, I didn't realize you responded for some reason. Thanks for the formula, what does "f" represent?
 
Upvote 0
It's just a variable that stores the result of the sort/filter formula, so it's only calculated once rather than twice.
 
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,893
Members
449,194
Latest member
JayEggleton

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