I am currently attempting to union multiple ranges, but each range has to have a condition met first.
My first attempt at this was the following formula:
={ IF(condition_one, range_one, IFERROR(0/0)); IF(condition_two, range_two, IFERROR(0/0)); IF(condition_three, range_three, IFERROR(0/0)) }
This works only if all three conditions are true. If any of them are false, I get an error:
In ARRAY_LITERAL, an Array Literal was missing values for one or more rows.
Essentially, range_one
, range_two
, and range_three
are all pre-filtered ranges of the same range. They're all unique from one another. I want to be able to filter the original range by multiple conditions with each condition returning true concatenating onto the result.
My second attempt at this was to filter the whole range with the conditions that the row existed within the pre-filtered range:
=FILTER(whole_range, IF(condition_one, COUNTIF(range_one, INDEX(whole_range,, 1)), FALSE))
This worked for a single range if the condition was true, otherwise it returned #N/A
(which is fine, I can handle that as it shouldn't be returning any rows at this point). When I added the additional conditionals however, I got two different errors under different conditions.
If anything less than all the conditions were true (including if all were false), I'd get this error:
FILTER has mismatched range sizes. Expected row count: 79, column count: 1. Actual row count: 1, column count: 1.
If all the conditions were true, this error:
No matches are found in FILTER evaluation.
Now I'm probably overthinking this. Unfortunately that's just the way my brain functions and I tend to miss obvious and/or simple solutions and I get the feeling that's what's happening here.
Is anyone able to assist me in this matter?
As per request, I have created an example sheet:
https://docs.google.com/spreadsheets/d/12RGLRyljFCmDgL9mhMAo9LvpGvltCJtIB69WI0uKYNY/edit?usp=sharing
Content In These Cells Doesn't Matter
— you have gone to great lengths to abstract the question and make the data symbolic. That makes it harder, not easier, to answer your question. Consider showing realistic-looking sample data and your manually entered desired results from that sample data for one or more use cases.query()
function will only accept one data type per column, so if your data columns contain a mix of text and numbers, or the occasional date or Boolean, the majority type will rule, and other types will be returned as nulls. Your data is sparse, so the column type may even end up as being null. There are many other similar considerations that may or may not prohibit the use ofsplit()
,join()
,match()
and so on.QUERY()
. To be clear, the data in those cells will always be strings. There may also be empty cells.