Converting old school formula to dynamic array

Berek

New Member
Joined
Apr 11, 2012
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hey there,
I use Microsoft 365 on Windows 10 Home

Can these two old school formulae be converted into dynamic arrays so that they catch new names in the unique list and spill down so that I don't need to use locked cell references?

The table I have is updated weekly and be be up to 300,000 rows over the year. It takes about 30 minutes to run through the calcuations. I figured if they can be coverted to dynamic arrays and not have to use locked cell references it might take less time.


=COUNT(IF(I$4:I$300=N4,IF(ROW(I$4:I$300)>=LARGE(IF(I$4:I$300=N4,ROW(I$4:I$300)),MIN(COUNTIF(I$4:I$300,N4),$N$2)),0)))


=COUNT(IF($K$4:$K$300=1,IF($I$4:$I$300=N4,IF(ROW(I$4:I$300)>=LARGE(IF($I$4:$I$300=N4,ROW(I$4:I$300)),MIN(COUNTIF($I$4:$I$300,N4),$N$2)),$K$4:$K$300))))


Thanks
Berek


MrExcel Query.xlsx
ABCDEFGHIJKLMNOPQRS
1N1Old School FormulaePOSSIBLE ARRAY FORMULAE?
212
3DateRepsKeyNumberAreaDateRepsKeyNumberAreaUnique ListABAB
406/04/2019AaronN113906/04/2019AaronN1139Aaron21
513/04/2019AaronN114813/04/2019AaronN1148Bobby21
613/04/2019AaronN124213/04/2019AaronN1242Catherine20
721/04/2019AaronN226007/05/2019BobbyN129Peter
821/04/2019AaronN369207/05/2019BobbyN1146
924/04/2019AaronN309120/08/2019CatherineN1618
1026/04/2019AaronN418725/08/2019CatherineN13051
1126/04/2019AaronN445402/09/2019CatherineN12064
1207/05/2019BobbyN12903/05/2021PeterN1230
1307/05/2019BobbyN114606/05/2021PeterN1221
1412/05/2019BobbyN2917
1520/05/2019BobbyN2037
1621/05/2019BobbyN3195
1725/05/2019BobbyN3343
1803/06/2019BobbyN3364
1917/06/2019BobbyN3888
2020/06/2019BobbyN41278
2120/07/2019BobbyN4022
2210/08/2019BobbyN4130
2312/08/2019BobbyN5898
2419/08/2019BobbyN5045
2520/08/2019CatherineN1618
2625/08/2019CatherineN13051
2702/09/2019CatherineN12064
2803/05/2021PeterN1230
2906/05/2021PeterN1221
Sheet1
Cell Formulas
RangeFormula
H4:L13H4=SORT(FILTER(Table1,Table1[Key]=N1))
N4:N7N4=SORT(UNIQUE(Table1[Reps]))
O4:O6O4=COUNT(IF(I$4:I$300=N4,IF(ROW(I$4:I$300)>=LARGE(IF(I$4:I$300=N4,ROW(I$4:I$300)),MIN(COUNTIF(I$4:I$300,N4),$N$2)),0)))
P4:P6P4=COUNT(IF($K$4:$K$300=$M$2,IF($I$4:$I$300=N4,IF(ROW(I$4:I$300)>=LARGE(IF($I$4:$I$300=N4,ROW(I$4:I$300)),MIN(COUNTIF($I$4:$I$300,N4),$N$2)),$K$4:$K$300))))
Dynamic array formulas.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Rather than deciphering those two formulas, could you describe what you wanted in columns O and P? (GRIN)
 
Upvote 0
Hi kweaver, Yes, I meant to put in what it was doing but forgot.

Column O is looking up the last n entries for each name based on the number in cell N2.. So you can see there are 3 Aarons but it's only counting the last 2

Column P is doing the count but only if columnn K has the same number as in cell M2.. So you can see that Aaron only has one 1 in the last two entries

Hope that helps to clear it up a bit
 
Upvote 0
Sadly, I'm afraid it's not clear to me. Why, for one example, is Aaron in N4 have a 2 and then a 1 in O and P, respectively?

Is 2 because of the 2 in the D column for the N1 from N1?
 
Upvote 0
Back to O column again. There are 3 Aarons that have a KEY = the "N1" in cell N1. So, where does the result "2" come from that's in O2?
 
Upvote 0
Column O is looking up and counting the last 2 entries for Aaron. If i changed cell N2 to 3 it would look up and find all three Aarons.

Column P is also counting the last two Aarons but only if there is a 1 in the corresponding K column.
 
Upvote 0
So, the 2 in cell N2 means find the "last two" of that person (Aaron) with an "N1" in cell N1. Then what? Where does the 2 come from in O4? Sorry, I'm just not following this one bit.
Maybe someone else understands and will jump in here.

1620618980281.png
1620619010522.png
 
Upvote 0
O4 is just giving me a count. It's shows it's found the last two entries.
If there was only one Aaron it would show a count of one.
There are three Aarons but because i'm only interested in the 2 that's what it counts.
 
Upvote 0
I just changed the 2nd "Peter" in C29 to N2, but your formula still shows Peter as 2.
I also changed J12 to N2 but it doesn't seem to matter with O7. Still shows a 2.
 
Upvote 0
I don't know what to tell you.
It works fine here. In the table I changed C29 to N2 and instantly only one Peter appears on the filtered list and 07 changed to 1...P7 stays at 0
 
Upvote 0

Forum statistics

Threads
1,215,135
Messages
6,123,241
Members
449,093
Latest member
Vincent Khandagale

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