Google-sheets – Drop-down list from cell formula (not data validation)

formulasgoogle sheetsgoogle-sheets-data-validation

I am trying to make a triplet dependent drop-list. The first is a typical drop down but the next two are dynamic.

Since you cannot enter a formula into the data validation criteria, how can you create a drop-down box in the cell formula?

The examples I find often use "array formula"

=arrayformula(IF(A1="x", INDIRECT("NamedRangeX"), IF(...) ))

but using this function will not turn the cell into a drop-down list, it will fill in the cells below which is the wrong functionality.

What I need is something like this and to have it work with NamedRanges:

=droplist(IF(A1="x", INDIRECT("NamedRangeX"), IF(...) ))

enter image description here

Best Answer

EXAMPLE 1:

Sheet1:

D20: Data Validation > List of items: I made a choice,I didn't make a choice

F20: Data Validation > List from a range: Sheet2!D8:D11

Sheet2:

D8: =IF(Sheet1!D20 = B6; QUERY(B8:B11;;-1);IF(Sheet1!D20 = C6; QUERY(C8:C11;;-1);))


EXAMPLE 2:

formula in D2:

=IF(A2=F2, {H3:H},
 IF(A2=F3, {I3:I},
 IF(A2=F4, {J3:J}, )))

data validation in A2:

data validation in B2:

demo spreadsheet