Dynamic Arrays - Top 5 values

Leticia

New Member
Joined
Jun 9, 2021
Messages
45
Office Version
  1. 365
Platform
  1. Windows
Hi! I am having some difficulties with my dynamic arrays

I need to create two different dynamic arrays, in which I extract the Top 5 values aggregated by "Case".

In the first scenario, I would need to obtain the Top 5 values when SUMIFS(TEST!$F:$F;TEST!$C:$C;"MISSING";TEST!$A:$A;"<="&$F$4)+SUMIFS(TEST!$F:$F;TEST!$A:$A;"<="&$F$4;TEST!$D:$D;">"&$F$4)
In the second scenario, I would need to obtain the Top 5 values when SUMIFS(TEST!$F:$F;TEST!$C:$C;"MISSSING";TEST!$A:$A;"<="&$F$4)+SUMIFS(TEST!$F:$F;TEST!$E:$E;"<>R.";TEST!$E:$E;"<>7250";TEST!$A:$A;"<="&$F$4;TEST!$D:$D;">"&$F$4;TEST!$D:$D;"<"&EDATE($F$4;1))

However, when creating my dynamic arrays, I am not capable of creating one for each scenario. Instead I created 3 different dynamic arrays which are not useful as omit part of the equation.
Excel Formula:
=IFERROR(INDEX(SORTBY(CHOOSE({1\2};UNIQUE(FILTER(TEST!$B:$B;((TEST!$C:$C="MISSING")*(TEST!$A:$A<=$F$4))));SUMIFS(TEST!$F:$F;TEST!$C:$C;"MISSING";TEST!$A:$A;"<="&$F$4;TEST!$B:$B;UNIQUE(FILTER(TEST!$B:$B;((TEST!C:C="MISSING")*(TEST!$A:$A<=$F$4))))));SUMIFS(TEST!$F:$F;TEST!$C:$C;"MISSING";TEST!$A:$A;"<="&$F$4;TEST!$B:$B;UNIQUE(FILTER(TEST!$B:$B;((TEST!$C:$C="MISSING")*(TEST!$A:$A<=$F$4)))));-1);SEQUENCE(5;1;1);{1\2});"-")

Excel Formula:
=IFERROR(INDEX(SORT(CHOOSE({1\2};UNIQUE(FILTER(TEST!$B:$B;((TEST!$D:$D>$F$4)*(TEST!$A:$A<=$F$4))));SUMIFS(TEST!$F:$F;TEST!$A:$A;"<="&$F$4;TEST!$D:$D;">"&$F$4;TEST!$B:$B;UNIQUE(FILTER(TEST!$B:$B;((TEST!$D:$D>$F$4)*(TEST!$A:$A<=$F$4))))));2;-1);SEQUENCE(5;1;1);{1\2});"-")

Excel Formula:
=IFERROR(INDEX(SORT(CHOOSE({1\2};UNIQUE(FILTER(TEST!$B:$B;((TEST!$D:$D>$F$4)*(TEST!$A:$A<=$F$4)*(TEST!$D:$D<EDATE($F$4;1))*(TEST!$E:$E<>"R.")*(TEST!$E:$E<>"7250"))));SUMIFS(TEST!$F:$F;TEST!$A:$A;"<="&$F$4;TEST!$D:$D;">"&$F$4;TEST!$D:$D;"<"&EDATE($F$4;1);TEST!$E:$E;"<>R.";TEST!$E:$E;"<>7250";TEST!$B:$B;UNIQUE(FILTER(TEST!$B:$B;((TEST!$D:$D>$F$4)*(TEST!$A:$A<=$F$4)*(TEST!$D:$D<EDATE($F$4;1))*(TEST!$E:$E<>"R.")*(TEST!$E:$E<>"7250"))))));2;-1);SEQUENCE(5;1;1);{1\2});"-")

My results obtained are as following:
1625506587554.png


What I would want to obtain is (I did the table by summing the values manually - I would need it automatic)
1625506781378.png


I copy the test table in case it is useful
DATE (A)CASE (B)CHECK (C)SOLUTION (D)TYPE (E)VALUE (F)
21/05/2021PDONE28/05/20214,85
21/05/2021PDONE02/06/2021R.8.893,96
22/05/2021CAMISSING400.000,00
22/05/2021PDONE28/05/20211,67
22/05/2021CSDONE02/06/2021R.355.791,00
22/05/2021CSDONE02/06/2021R.358,64
22/05/2021CSDONE02/06/2021R.358,64
22/05/2021CSDONE02/06/2021R.355.791,00
22/05/2021CADONE15/06/2021400.000,00
25/05/2021CODONE28/05/2021100.000,00
25/05/2021PDONE01/06/20215,25
25/05/2021FDONE02/06/2021R.7.300.000,00
26/05/2021CADONE16/06/20211.718.000,00
26/05/2021CODONE01/06/2021422.832,98
26/05/2021CODONE02/06/2021R.1.086,77
26/05/2021CODONE02/06/2021R.1.086,77
26/05/2021CODONE02/06/2021R.983,74
26/05/2021CODONE03/06/202172509.244.707,41
26/05/2021CODONE03/06/202172508.336.807,00
26/05/2021CADONE15/06/20211.500.000,00
27/05/2021CAMISSING480.000,00
27/05/2021PDONE01/06/202115,75
27/05/2021CADONE02/06/2021R.4.363,23
27/05/2021CADONE02/06/2021R.4.363,23
27/05/2021CADONE15/06/2021400.000,00
28/05/2021PFDONE01/06/20210,97
28/05/2021FVDONE02/06/2021R.714.000,00
28/05/2021CADONE15/06/20211.428.000,00

Thank you very much.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You're welcome & thanks for the feedback.
 
Upvote 0
Thinking about it, as you are only returning 5 rows you could use conditional formatting to show a - instead of a 0
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

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