It was an interesting exercise. In looking at this, I could not look at the aggregate function, and I had to delete the IFERROR() functions (so my functions actually return the error). I do not know how these changes affected my results. I also did my tests on 7500 cells rather than 25000. A few of my own comments and observations
1) the array formula version took 35, 35, and 34 seconds to calculate. The non-array version took 39, 39, and 39 seconds. Where your tests show ~33% increase in computation time, I show ~15% increase. How much of that difference is in the IFERROR() function and how much is in the smaller spreadsheet I used, I don't know.
2) Another approach that has traditionally been frowned upon because it is usually slower is the use of VBA UDF's. I decided to test that on this as well. As near as I could tell, your formulas searched column 2 for "y" then returned all the values from column 1 associated with those y's. Here's my code
It was quickly put together, I'm sure there are better ways to do this. But, in terms of computation speed, the results I got were interesting. When I first entered the UDF array formula, it took a couple of minutes. The first calculation event after that took 50 s. Each successive calculation event took 24, 12, 6, <1. After a handful of calculation events, the UDF version was near instantaneous. I don't know if each calculation event caused it to compile the UDF more efficiently, or exactly why it continued to get faster.
3) In the end, I am reminded of something my mentor put into one of his programs (he was an old school fortran programmer). His comment was something like, "I know that this programming structure slows down the program. But I find it also makes it easier for the programmer. Easier for the programmer means there is less chance for error [and less time spent debugging], and means that it is easier to modify the program when needed." I find myself doing the same kind of thing - make my spreadsheets as convenient for me as possible, even at the expense of computational time. Computer's are becoming pretty fast - if I spend twice as much of my time building and debugging a spreadsheet to save 30% computational time, I may never recover the extra time I spent building the spreadsheet.
Bookmarks