I want a data validation drop-down list that populates based on the value in another column in the same row. I've found a lot of great examples with multiple dependent drop-down lists, but unfortunately I don't think those will work in this case. Instead of a dynamic list based on a single fixed cell, I want a whole column of these, each based on its own row and independent of the others.
Here's the setup:
SPELLS KNOWN
"Spells Known" is the data source, containing Level and Name columns. A given Name can appear multiple times, corresponding to different Levels. (It's also important for each Level to have its own unique list, because the table contains additional columns with level-specific values, e.g. a Level 3 Heal has different values than a Level 1 Heal.)
Level | Name |
---|---|
1 | Heal |
1 | Magic Missile |
1 | Sanctuary |
2 | Dispel Magic |
2 | Heal |
2 | Resist Energy |
3 | Heal |
3 | Magic Missile |
SPELLS PREPARED
"Spells Prepared" is the user-facing table. The idea is to specify the Level and then use a drop-down in the Name column to select from the values listed for that Level.
Level | Name (select from drop-down) |
---|---|
1 | {Heal, Magic Missile, Sanctuary} |
2 | {Dispel Magic, Heal, Resist Energy} |
3 | {Heal, Magic Missile} |
And here's what I've tried:
Since it's not possible to get a drop-down when using "Custom formula is" in Data Validation, I tried to combine the values into a comma-delimited list in a single "helper" cell on the same row as the drop-down, using the following:
=ARRAYFORMULA(TEXTJOIN(",",TRUE,IF(SpellsPrepared_Level=SpellsKnown_Level,SpellsKnown_Name,"")))
The problem is that data validation treats this output as a single string—that is, the drop-down has only one option: "Heal,Magic Missile,Sanctuary", instead of recognizing the comma delimiter like it would if you had entered the same string as a list directly into the Data Validation window, and thereby treating the list as three items.
It seems like the next thing to try would be to create a new sheet where Column A equals SpellsPrepared_Level, and Columns B, C, and so on each contain a single SpellsKnown_Name value in the list based on that Level. Then, data validation could use a "List from range" and build the drop-down list from those values for each row.
But that doesn't seem terribly elegant. Is there a more efficient way to accomplish this? Let me know if having the actual sheet would be more helpful.