excel-vba function to filter an array and return an array
ReDim Preserve and Transpose are not free.  I use this pattern when I need to filter an array:

Declare a 1-D array (Indices) with the same number of rows as the 2D array
When a match is found add the matches index to the Indices array and increment the counter
If there is matching data, declare a 2-D array (Results) with the same dimensions of the Input array but a row count equal to the counter
Iterate over the indices in the Indices array and add the matching values to the Results
Return the Results
If there are no matches return an empty array

Quick Filter
Public Function QuickFilter(input_arr As Variant, col_index As Long, filter_value As Variant) As Variant
    Dim r As Long
    Dim Count As Long
    Dim Indices As Variant
    ReDim Indices(LBound(input_arr, 1) To UBound(input_arr, 1))
    Count = LBound(input_arr, 1) - 1
    For r = LBound(input_arr, 1) To UBound(input_arr, 1)
        If input_arr(r, col_index) = filter_value Then
            Count = Count + 1
            Indices(Count) = r
        End If
    Next
    
    Dim Results As Variant
    Dim c As Long
    Dim index As Long
    If Count &gt;= LBound(input_arr, 1) Then
        ``` we want results to hold the entire row
        ReDim Results(LBound(input_arr, 1) To Count, LBound(input_arr, 2) To UBound(input_arr, 2))
        For r = LBound(input_arr, 1) To Count
            index = Indices(r)
            For c = LBound(input_arr, 2) To UBound(input_arr, 2)
                Results(r, c) = input_arr(index, c)
            Next
        Next
        QuickFilter = Results
    Else
        QuickFilter = Array()
    End If
End Function