I have a sheet with dropdowns created using 'Data->Validation->List of Items which control what the user can input into these cells.
Once a user selects an item from a dropdown, is it possible to get the index value of the item selected? If so, how?
The ultimate goal of this question is to have formulae which translate textual information into number data via CHOOSE()
Example
A1 = Data->Validation->List of Items -> None,Apple,Orange,Banana
A2 = CHOOSE(A1,0,1.5,2.3,1.8)
User selects 'Orange' then A2 = 2.3
Obviously the above fails as CHOOSE(A1... results in an error as 'Orange' is passed, not the index value of Orange
It seems possible that what you want is:
=Choose(Match(A1,{"None","Apples","Oranges","Pears"},0),0,1.5,2.3,1.8)
or something very similar.
Related
I have searched around but can't find anything that gets me quite there. I have tried various methods but can't get it.
Sheet A - has Tab 1 and Tab 2
In Tab 1, cell O22, I have a data validation list of items. Depending on the item I pick, I want the cell below - O23 - to check a column on Tab 2 and find the phrase from cell O22.
When the phrase is matched then get an offset cell one to the left of the matched value on Tab 2 and return that result into cell O23.
This is because I am using the data validation to allow for a choice of items and ultimately return a URL which is then fed into a Google Sheets app script. I've tried using indirect, offset, address etc but I keep falling short.
Any tips would be appreciated.
EDIT: An example copy is here: removed - thank you.
use VLOOKUP
=IFNA(VLOOKUP(O22, {Sheet2!E27:E29, Sheet2!A27:D29}, 2, 0))
I want to block certain users/groups from viewing formulas in certain cells in Google sheet, but they'll have permission to edit other cells values. All they will be able to see is the result.
explanation: it's an advanced calculator. let's say that I want to give the user the ability to put values in cells A1 and B1, and in C1 the formula is =A1+B1.
I want to hide the formula in C1, so the user will only the the result.
There's a few ways to do it depending on how/who is working on the sheet. If people aren't familiar with sheets you can actually hide the formula in a row at the top by using array formulas so in the header:
={" header title" ; arrayformula(a2:a+b2:b)}
The formula would be hidden in the cell that shows the header, all the cells below would just be the calculation. If you hide the row that has the arrayformula and protect it no one will be able to see it. The only thing is you have to also protect the column otherwise if someone hardcodes a value in the column the formula will stop working.
The second option (easier but can run into more issues is the have a 'mirror' copy of the sheet they are interacting with in the same file as a hidden sheet. Basically a duplicate of the tab with all the cells a direct reference of the first tab. So:
Sheet1 = tab they interact with
Sheet2 = 'mirror' tab with every cell being ='Sheet1'!a1, but for the corresponding cell value.
As they edit Sheet the values entered in Sheet1 will show up in Sheet2, then the calculations can happen on that sheet, and then Sheet1, can just be a direct reference to that column in Sheet2. So the calculations in Sheet1 will only appear ='Sheet2'!C2. If you protect Sheet2 and hide it no one will be able to see the formulas. Sheet1 could even reference Sheet2 with an index formula like: index(column sheet2,,) which would return the entire column from sheet2.
I have a sheet with a dropdown menu in A1, and a cell A2, with values that will be the result originated from a script.
I want a certain option from the dropdown menu (the first one, to be precise) to be selected automatically when a certain value is present in A2.
Here's a simulation:
https://docs.google.com/spreadsheets/d/1x-pmDmB6mbyjXFY0rHOkIzkpNagRJXif9dWNj3TJHkU/edit?usp=sharing
In A1, I want to write the formula:
If A2 is equal or less than zero, I want option 1 to be force displayed/ automatically selected in A1.
If A2 is more than zero, then I want the manually selected option to remain as it is.
I'm not completely sure if we're talking about the same thing, but I believe this has a lot in common with how dynamic dependent dropdowns are created in Google Sheets.
The only main difference is that you don't rely on a dropdown choice for your condition, but any cell value of your choice.
So how does this work?
The value in G1 is:
=IF(F1>0,filter(B:B,A:A="POS"),filter(B:B,A:A="NEG"))
This basically means that if F1 is greater than zero, only the values in Column B, whose corresponding value in Column A is POS, show up in Column F.
If F1 is zero or less than zero, only the values of Column B, whose corresponding value in Column A is NEG, show up in Column F.
Accordingly, we can now use Column F (the range G1:G8) as a 'dynamic' reference for the data validation of a dropdown. In the example, this was done in F2.
This YouTube video explains the underlying filter mechanism pretty well. I just expanded it with an IF-statement.
I'd like to manipulate other cells based on the selection from a dropdown menu. For example in cell A1 I have a dropdown with company A, B, C
I need a formula for cell B3 to change the data based on the selection in cell A1.
EX:
If cell A1 selects Company A, I'd like to take data from another tab in my sheet that gives me data for company A and place it into cell B3.
If cell A1 selects Company B, I'd like to take data from another tab in my sheet that gives me data for company B also inside B3.
Basically summarizing different data based on selection of my dropdown menu.
Please try:
=if(A1="A",A!A1,if(A1="B",B!A1,C!A1))
I have two list boxes: Box1 and Box2. Box1 has values 10,20,30,40 etc and Box2 has the same 10,20,30 etc.
After creating two separate list boxes for Box1 and Box2 respectively in the dashboard, how do I get to show only the values in Box2 which are greater than the selected value/values in Box1.
Example: When I click 20 in Box1, I want the values 30, 40 etc to be displayed or shown in box2 i.e., the values greater than 20 has to be displayed. Thank you.
An alternative way to do this would be to create a List Box but instead of setting it to use a normal field, set it to use an expression instead (select it in the "Field" drop down in the properties).
You could then use the following expression which should do the trick:
=aggr(if(F2 > max(F1),F2,if(GetSelectedCount(F1)<>0,null(),F2)),F2)
In the above, the first field is F1 (i.e. Box1) and the second is F2 (i.e. Box2).
An example of how it looks in practice is shown below (the third box on the right contains the expression), the first image shows what happens if some values are selected in F1 - the list of values are filtered.
In the second image, a selection has been made in this new list box, and as you can see, it makes a selection against F2 automatically.
There are few ways to achieve this.
set "On select" trigger for Box1 field. The trigger will clear selected values on Box2 and select only the values that are greater than Box1 selected value
in script - this highly depends on the dataset you have. The idea is to join Box1 and Box2 fields in separate table as many-to-many and then filter the values where Box2 > Box1. Using this approach is more clear to me and no triggers are needed but again it depends on your data.
Ive made a small app which shows the two approaches https://drive.google.com/file/d/0BxjGsOE_3VoOc29aYXVsanN3azA/view?usp=sharing