Dropwdown list from dynamic table

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Dropwdown list from dynamic table



I have a dynamic table containing the following columns:


COUNTRY(String), ACTIVE (Boolean),NAME(String)



An example will be:


COUNTRY(String), ACTIVE (Boolean),NAME(String)
USA, True, Chair
Canada, False, Table
USA, False, Pen
USA, True, Pencil
Canada, True, Pencil
Canada, True, Basket



I want to create a data validation list with the names for every country that are active. The list should be dynamic as the table is constantly being changed.



For the example, the data validation list should check whether the cell containing the country name is Canada or USA and
if USA then: Chair, Pencil / if Canada: Pencil, Basket.





Just to clarify one detail, would "Pencil" get listed twice? or just once?
– cybernetic.nomad
Aug 6 at 15:59





Twice, as the data depends on the country. I want to create a data validation list with the active names of the 3 different countries I have. @cybernetic.nomad
– MTT
Aug 6 at 16:00





Could you just format as a table and filter the Active column to "True" ?
– Lodi
Aug 6 at 16:13




1 Answer
1



I have resolved this using a three-step organization. The first step is to make a "table" for any growing/shrinking list that will be used for the data validation.



Step 1



List the possible values in columns as a new table. Place the country name at the header row for each column.


A B C D E
1 Country chair USA Canada <----header row
2 USA pencil pencil table
3 Canada table Plato warthog
4 USA warthog
5 Canada tuba
6 USA magic
7 Canada Plato



Select the columns (for instance, D1:E3 in the example) and click Insert > Table.



Check "my data has headers" and click OK.



Select a cell in the newly-formatted column and click Table Tools > Design > Properties > Table Name: ______ and type Countries.



Step 2



Select the column for which you want data validation. Note which cell is active (the cell inside of the selection which you can write to). In the example, it's Cell B2.



Step 3



Under data validation, choose list and type in this equation:


=INDIRECT("Countries[" & A2 & "]")



If the row that's active is row 3, type this in instead:


=INDIRECT("Countries[" & A3 & "]")



This is actually working for me. Try it!





Hi @elliot svensson thanks! That is actually very helpful but I cannot complete the first step as you mentioned because the list for every country is 1) Dynamic and being updated all time 2) I first have to check whether the name is active or not
– MTT
Aug 7 at 7:50





I will re-write it. You can still do it, but now each dropdown list will have blank spaces after the last item (except for the longest dropdown list).
– elliot svensson
Aug 7 at 13:59






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS