I have two sheets: Sheet1 & Sheet2
Sheet1 has Dropdown menu "Dropdown_1" with choices: a,b,c
Sheet2 has "Dropdown_2"u, also with choices: a,b,c
Sheet2 has also a cell linked to the Dropdown menu of Sheet1 "Link_dropdown_1" showing the current selection.
Is there a way how i can update the selection of "Dropdown_2" based on the value in "Link_dropdown_1"? I don't want to synchronise the two dropdown menus bidirectional - just from Sheet1 -> Sheet2. In case my explanation is hard to understand - here is the example in sheets:
example sheet
Update:
Looking for a way to update a Dropdown Menu not a simple cell!
For example: "a" gets selected in "Dropdown_1" --> automatically select "a" in "Dropdown_2" as well.
Update 2:
Maybe my previous explanations were really misleading but i am NOT looking for a dynamically created dropdown menu or similar. I want to synchronise choices/selection of two dropdown menus that contain the same values.
Hope this makes it clear:
I use "Value_Dropdown_A" for some sorting in Sheet2. In case it its not needed for synchronising "Dropdown_A" to "Dropdown_B" just ignore it...
Related
I have a sheet with about 60 dropdown data validation controls. I would like to set groups of them to a value, based on an index number of the values in the drop down e.g.
dropdown contains values "cat", "dog, "bug", "ant", and I would like to set the value to "dog" by setting the dropdown value to index 2.
I can't find the syntax for the index, so I have used setVaue(), which works, but is not the desired method:
var dropdownRanges = ["dd_w", "dd_y","dd_y", "dd_z"];
for (var i=0;i<dropdownRanges.length;i++){
sheet.getRange(dropdownRanges[i]).setValue("Dog");
}
An example dropdown is shown below. I'd like to programatically set the dropdown to display the first item (Index 1) in the list, using google script. this is to "reset" the dropdowns to a default value.
The items differ in all the dropdowns, so I must use the index, and cannot the text value.
example dropdown in google sheets
I feel a bit embarrassed that I can't find an equivalent to "setIndex", but then I am migrating from Excel to Google Sheets, and still haven't grasped the new ecosystem.
The way I did this is, I got the data validation options from the cell (A5 in this case), get the top option (the 0th option), and then i set the cell equal to it. this resets the cell to the top option
let option_0 = sheet1.getRange('A5').getDataValidation().getCriteriaValues()[0].getValue()
sheet1.getRange('A5').setValue(option_0);
I would like to be able to sort the 'Country' and 'City' columns on the Countries page in the below Google Sheet but when I do so (sort option in A4 and B4) the data gets corrupted and the dependent dropdown lists don't work anymore.
Is this possible and how could I do it?
If possible, I would also like to be able to sort the information in the Country Dropdowns page (B3:E3) in a way that the above stated would still work.
Used in Aux Country Dropdown page:
=IFNA(TRANSPOSE(INDEX('Country Dropdowns'!$B$4:$E$15,, MATCH(Countries!A5,'Country Dropdowns'!$B$3:$E$3,0))))
https://docs.google.com/spreadsheets/d/1wPbWdUx1cAWVhMdrxm_x5Vdy_ExYsV6Srn_Lu3FXHJg/edit?usp=sharing
First of all for your Country Dropdowns sheet create some helper columns and do your sorting there. So for USA in cell G3 use this formula and pull to the left for other countries
=INDEX({B3;SORT(B4:B)})
Next. In your B5 cell in the Aux Country Dropdown sheet use this single formula:
=INDEX(IFERROR(HLOOKUP('mar Countries'!$A5:A,'mar Country Dropdowns'!$G$3:$J$15,{2,3,4,5,6,7,8},0)))
Finally fix your drop-downs in your Countries sheet by using in A5 this formula and drag down
='Country Dropdowns'!$G$3:$J$3
also for your B5 cell drop-down use the following formula and drag down
='Aux Country Dropdown'!$C5:$I5
am looking for help with this array formula to be done in a script to avoid the multiple generated rows that not needed for the dropdown menu
=ArrayFormula(if(C4:C="",,IFNA(if((D4:D<>"")*(F4:F<>"")*(H4:H<>"")=1,{"DONE","FOLLOW","DEFECTS"},{"DONE","DEFECTS"}))))
sample of the test sheet is here : https://docs.google.com/spreadsheets/d/1JEO2vNxirY2NT2tRAnRNQpfY3hfyTuM1ppoUIil4Aeo/edit#gid=1382187552
the resolved or the above formula that FOLLOW will only show when D, F & H is not empty
also I was willing to add an extra condition the dropdown menu will not be active if A:A is Empty
looking forwards to your kind help.
Thanks,
I must have been Googling and trialing/erroring in scripting for 4-5 hours now, I'm stuck in a (frustrating) loop.
I'm trying to create a drop-down filter in A1 which lists all of the values in C1:ZZZ1, and selecting one of the values hides all columns C1:ZZZ1 except the columns that fall under the selected value's merged cell.
Example from the below screenshot:
In A1 would show a drop-down pulled dynamically, which lists "Joe Adams", "Eagle Nest", and "Sabrina". If I select "Eagle Nest" in the A1 drop-down, all I would see is Column A, Column B, and Columns F, G, and H (since Eagle Nest is merged with these 3 columns). The rest of the columns would be hidden. Then, upon clearing the filter (drop-down), all columns would be visible. Is something like this possible??
INDEX/OFFSET is another option. In another sheet, (say Sheet2!A1): Create a drop down for Sheet1!1:1,
A2:
=INDEX(OFFSET(Sheet1!A1,,MATCH(Sheet2!A1,Sheet1!1:1,0)-1,90,3))
Syntax:
OFFSET(cell_reference, offset_rows, offset_columns, [height], [width])
According to GAS documentation, we can use this methods to insert a dropdownlist in a sheet cell:
var cell = SpreadsheetApp.getActive().getRange('A1');
var rule = SpreadsheetApp.newDataValidation().requireValueInList(['Yes', 'No'], false).build();
cell.setDataValidation(rule);
I'd like to know if there is a way to insert not a dropdown list, but dropdown a checkbox list in cell, in a similar fashion of requireValueInList when some trigger is used (eg, when the first cell of that row is edited).
As #SergeInsas said "I'm afraid the answer ils no...". So my alternative is to create a pop up checkbox list.