I would like to create a version of linest that only performs the analysis on a subset of the x's and y's that match a certain "if" statement. I have tried a number of the usual methods of doing something like this with array formulas, to no avail. See attached file for examples of a couple of the things I have tried, and for an example of what the solution is supposed to look like.

Please note that the final version of this will have about 5,000 rows and about 5 columns of "x's" (i.e. multiple regression). I know there are some solutions that are technically feasible (like creating a secondary dynamically sorted table), but a solution which is efficient with many rows would be ideal.

## Bookmarks