Forum Discussion
FILTER Function Lagging, alternative function for this case?
SJNSkytanking As others have already pointed out, the lag is likely due to the sheer number of formulas being used, either directly in the worksheet, or via conditional formatting. However, there are a few changes that can be made to help improve performance. In column G, for example, all 9 of the conditional formatting rules can be applied to range $G$3:$G$1211 instead of $G$3:$G$9999, as the data currently only extends to row 1211. Also, regarding the conditional formatting logic for output range $O$3:$IT$1211, rather than having 10 different rules to change the color based on the team number, start by filling each row in the range with the applicable colors for each team, then use only 2 rules to change the color to either grey or white for cells containing "".
As for finding a better suited formula for this scenario, I did a few tests using XLOOKUP, MAKEARRAY and COUNTIFS. XLOOKUP performed about the same as FILTER with only 9 days' worth of formulas input (84,240 cells); MAKEARRAY nearly crashed Excel when applied to the same range; and surprisingly, COUNTIFS outperformed them all. COUNTIFS was able to handle the entire data set (290,160 cells, split into blocks of 9,360 cells per day) and still have less of a lag than FILTER did with only 9 days. With MS365, the COUNTIFS function is also capable of spilling its results dynamically when passing a range of values to each criteria argument (provided the setup is correct). For example, inputting the following formula in cell O3 will spill the results for the entire first day:
=IF(COUNTIFS(G3:G41, J3:J41, D3:D41, "<="&$O$2:$IT$2, F3:F41, ">="&$O$2:$IT$2), J3:J41, "")
The formula can then be copied and pasted to the first cell of each day thereafter (O42, O81, O120, etc.). I've attached a copy of the workbook for your convenience. Please try it out and make your own judgement as to whether or not the fraction of a second lag is tolerable now...