where data (B5:D15) and temp (C5:C16) are named ranges . SEQUENCE is configured to create an array of 3 rows x 1 column. The step value is -1, and the start number is defined by this snippet: Here we are counting temp values less than 75. Because the named range temp contains twelve values, the result is an array of 12 TRUE and FALSE values: The double negative (–) is used to coerce the TRUE and FALSE results to 1s and 0s, and the SUM function returns the total: This number is returned directly to SEQUENCE for the start value. Now we have: We use SORT to ensure that values are returned in the same order they appear in the source data. This array is handed off to the INDEX function as the row_num argument: In a similar way, SEQUENCE is also used to generate an array for columns: which is given to INDEX for the columns argument. Now we have: The next step is to construct the array for INDEX to work with. We only want to work with “valid” entries, so we use the FILTER function to retrieve a list of entries where the temp value is less than 75: The array argument is data, and the include argument is the expression temp<75. This can be translated literally as “return values from the named range data where values in temp are less than 75”. The result is a 2D array with 3 columns and 7 rows: Notice rows associated temp values greater than or equal to 75 have been removed. This array is returned to the INDEX function for its array argument. Finally, the INDEX function returns the last 3 entries from the array returned by FILTER. Note: Both the value for n and the logic used to test for valid entries is arbitrary in this example and can be adjusted as needed to suit your needs.

### Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.