Reputation: 11437
I'm trying to do something which seems straight forward enough. In the cell (D15
) validation rules, I want to choose, List from a range
and specify a range that is horizontal, instead of vertical. Please see the following self-explanatory screenshot.
However, this doesn't work. The drop-down only shows data from the first column of the given range. See the screenshot below.
How can I make this work? I expect to see - Cat, Mouse, Lion, and Deer in the drop down list.
PS: Arranging the items I want in the list, vertically, is not an option.
SOLUTION Similar in principle to the accepted answer by @Marios, I found a solution for my exact use case here. Unfortunately, AppScript seems to be the only answer.
Upvotes: 1
Views: 1520
Reputation: 348
If your column range is not dynamic select end range of your column along with row i.e with the given example instead of inserting range as E15:15
set range as E15:H15
that will populate all your range in dropdown
Upvotes: 0
Reputation: 50462
This seems to be a bug in the desktop web app:
F3
) and a one open ended(3
) range (F3:3
). If both ends are
3:3
: The data validation is successfulF3:M3
: The data validation is successfulF3:3
. This should actually calculate the lastColumn and input the range accordingly. But,The data validation input dialog drops the open end and saves the input as just F3
. This results in the only one cell drop down as shown in your question.F3:3
into the datavalidation configuration(eg through official mobile apps or scripts), the data validation is set properly.Upvotes: 3
Reputation: 9571
I understand that you want to display those values horizontally so arranging them vertically in that sheet is not an option, but can you do so elsewhere?
In situations like this, I prefer to have at least one other sheet where I can list input values–let's call that sheet "INPUTS". In each column I may manually list out the values or use some formula to manually populate it (e.g. =TRANSPOSE('Dynamic Brands'!E15:15)
). Now I can use that new range in the data validation.
Alternatively, you can build the data validation with row data, but without the "Show dropdown list in cell" feature. Change your criteria to a custom formula and use this formula =ISNUMBER(MATCH('Dynamic Brands'!D15, 'Dynamic Brands'!E15:15, 0))
Upvotes: 1
Reputation: 27350
How about the following Google Apps Script solution.
The following code will create a data validation in cell D15 and the data validation values are given by the range E15:H15:
function setDataValidation() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getActiveSheet();
var cell = sh.getRange('D15'); // data validation cell
var range = sh.getRange('E15:H15'); // range of options
var rule = SpreadsheetApp.newDataValidation().requireValueInRange(range).build();
cell.setDataValidation(rule);
}
Upvotes: 1