for those who need to use Greg's formulas and deal with the FILTER
range mismatch
=FILTER(A1:A, MATCH(A1:A, B1:B, 0)) =FILTER(A1:A, COUNTIF(B1:B, A1:A)) =FILTER(A1:A, ISNA(MATCH(A1:A, B1:B, 0))) =FILTER(A1:A, NOT(COUNTIF(B1:B, A1:A)))
in case you need to use the FILTER
formula to return an estimate between two ranges, and the two ranges have different sizes (for example, when they come back from the query) and cannot be resized to fit the same size, and you just got FILTER has mismatched range sizes. Expected row count: etc.
FILTER has mismatched range sizes. Expected row count: etc.
FILTER has mismatched range sizes. Expected row count: etc.
Error then this is a workaround:
for simplicity, let's say your filter ranges: A1: A10 and B1: B8 , you can use the brackets of the array {}
to add two virtual lines to the range B1:B8
to match the size of A1:A10
, using REPT
where the number is needed Repeats must be calculated by simply calculating between the initial ranges.
then to this REPT
formula, we need to add +1 as a correction / fault tolerant (in case the difference between the two initial ranges is 1), because REPT
works with a minimum of 2 repetitions. so in a sense, we will need to create a range of B1:B11
(from B1:B8
), and later we just trim the last row from the range, so that will be B1:B10
versus A1:A10
. we will use 2 unique characters for REPT
The next step is to wrap REPT
in SPLIT
and divide by the 2nd unique character. then (based on further need) this SPLIT
should be enclosed in TRANSPOSE
(because we want to match the size of the column with the size of the column), and the last step will be to enclose it in QUERY
and again limit
output to simple mathematics COUNTA(A1:A10)
to crop the last repeat together it will look like this:
=FILTER(A1:A10, NOT(COUNTIF(QUERY({B1:B8; TRANSPOSE(SPLIT(REPT("ββ", COUNTA(A1:A10)-COUNTA(B1:B8)+1), "β"))}, "limit "&COUNTA(A1:A10), 0), A1:A10)))