Excel Style Combo Box in Google Sheets - excel

I have an issue regarding Google Sheets.
I have a spreadsheet in Google docs that i have copied from an excel spreadsheet that I created. What I need to figure out how to do is make a combo box that that when I select an option in the list it changes the value of another cell from a 1 to 2 or 3 or 4 etc.
I have this working in excel but cant seem to figure out how to do it in sheets.
My question is, does any one know of a way to do this? Is it even possible?

Maybe I am misunderstanding your question, but it seems to me that what you want can be achieved without any scripting (though it IS possible to script the whole thing, too):
For the "combo box" cell, add Data Validation selecting "List
from a range" or "List of items" under 'Criteria' as appropriate,
and "Reject input" option in 'On invalid data' section. This will
make the cell show a drop-down selection of items when you click on
the little arrow now displayed in the cell.
In the other cell (the one that needs to change value), enter a
formula that changes the cell value based on selected "combo box"
cell value. Depending on how big your list of items in the "combo
box" cell is, you can use either a simple IF() formula, or go for
a VLOOKUP() (if data validation items are coming from a range in a
spreadsheet), or a combination of them.
For example, based on the sheet as in the screenshot below, cells C1:C6 have Data Validation rule set to range F1:F6, and cells D1:D6 have the formula =IF(NOT(C1=""), VLOOKUP(C1, $F$1:$G$6, 2, FALSE), "DEFAULT VALUE") (obviously references to C1 changed to corresponding row of column D). When a value is selected from a drop-down in cells C1:C6, corresponding cell in column D changes its value to the one in column G matching selected value from column F. If no value is selected in cells C1:C6, corresponding cell in column D show "Default value" (which can be whatever you need).

Related

How to Apply Conditional Format to show a field is mandatory to be filled in based on a vlookup to another sheet

I'm trying to create a form in excel for my team to fill out which highlights certain cells in a row as compulsory (format the cell colour) based on the number from a table in another sheet which has 3 preset dimensions ("M"=Mandatory, "P"=Prohibited, "O"=Optional) for each number across multiple analysis field.
I have tried conditional formatting formulas to highlight the cell to fill out if the lookup of the number chosen returns "M") but I don't seem to have a formula which validated this and returns with the cell highlighted when it needs to completed.
I would like the formula to return the cell as highlighted if it is mandatory based on the lookup to the table and need the user to fill out the cell with the information relevant.
Any help would be much appreciated.
If I understand your question correctly you just want the cell to highlight when its sister cell in another sheet is coded "M". That's a fairly easy formula.
=Sheet2!$B1="M"
This is for a straight column in B, where the cell it's checking against is in sheet 2 and also in column B. If it's for a row simply move the $ to say b$1.
If you want the highlight to disappear when the cell is filled in use this formula:
=AND($B1=0,Sheet2!$B1="M")

Using Data Validation Lists and VLOOKUP to Link Two Cells

I have an order form I'm working on that I would like to be slightly automated. There is an "Part Number" column and an "Item Description" column on the form. I would like to turn all cells under these two columns into drop-down lists. That way, when you click on a cell in the "Part Number" column, you're provided with a list of part numbers to choose from, and the same goes for the description. This is simple enough and is easily accomplished using Data Validation lists.
The problem is that I want to link the two columns so that filling in either cell on a row via drop-down list will populate the other cell with the appropriate information. (i.e. The user fills in the "Part Number" cell and the "Description" cell gets populated. Or, the user fills in the "Description" cell and the "Part Number" cell get populated.)
I know I can get halfway there with VLOOKUP; I can make one of the columns have the drop-down list selection and the other column has the VLOOKUP formula. But I can't have Data Validation on a cell with a formula, so I can't put VLOOKUP in both columns. (This would probably end up creating an endless loop anyway.) Any suggestions on making this work with the cells in both columns?

Excel data validation auto generate content

I have an excel sheet A in which I clicked on a dropdown icon in a cell and the list of all the people in another data excel sheet B which I referenced to appears. In that data excel sheet B, each row is unique to each person with attributes of that particular person like identification number.
So when I clicked on the cell and selected a name from the dropdown list, I want the next cell to show the identification number of selected name. How do I go about doing that? I have no idea how to start.
Try combining Index and Match to achieve the reults you're looking for.
This way you dont hit the vlookup limitation of only being able to return values to the right of the lookup.
=Index(SheetB!A:A,Match(SheetA!A1,SheetB!B:B,0))
Assumed:
Sheet A's dropdown is in cell A1
Dropdown's Value needs to be looked up in column B of 'Sheet B'
We want the corresponding value from column A of the lookup in Sheet B to be returned.
Update the formula references, and this should get you on the right track.

How to create dropdown with multiple columns in excel

!
Hi I am using Excel 2003. I need to add data validation to a column, it should display the two columns in the cell, when user selects, the 1st column value should be displayed in cell.
Ex:
Col1 Col2
IND India
CHI China
Column - display to select
Column
IND-India
CHI-China
after selecting CHI the China or CHI will be displayed in the cell.
Is there any possibility to do the process in Excel.
Thanks in advance for any help...
(1)
If you need a dropdown item to display a different title after being selected, you can have another cell serve as the display. For example:
Where B3 (the helper cell) can have a formula like =LEFT($C$3,3) or use INDEX/MATCH to look up keys (like in your 'For Validation' table).
And where C3 (the data validation list) has a custom format like ;;;"(Change)" or "(Select)" or even a symbol like "↓", and will never display the actual selected list item.
You can also do this with VBA by creating an activex combo box control.
(2)
If you need one dropdown list to depend on the selection made in another, you can use dynamic dependent data validation:
http://www.myonlinetraininghub.com/excel-factor-19-dynamic-dependent-data-validation
Go to Devloper tab - insert - active control- insert comobobox
draw comobox in your excel sheet
right click on combobox, open property
in listfill range, type range of your column
set coloumn count = 2
change the widht of colomn
You can use the dropdown menu for the first column and the VLOOKUP function for the second column.
VLOOKUP would look at the first column and based on what's there would fill the second with the data from somewhere else.
I've also found a YouTube tutorial on how to use the function. Here you go:
https://www.youtube.com/watch?v=-WAEzokHSJM

Format cell color based on value in another sheet and cell

I have a workbook with two sheets. I would like to format the cell background color in the first column of sheet 1 based on the values in the second column of sheet 2.
For example, if the value of of sheet2, row 6, column 2 is say, 4, then I would like the background color of sheet 1, row 4, column 1 to be green. If none of the values in sheet 2, column 2 reference a particlar row in sheet 1, I'd like to leave it set to no color. There's no prohibition against the same value appearing multiple times in the second column of sheet 2. Bonus kudos if you can tell me how to unset the color if the last value in sheet 2 pointing to a row in sheet 1 is removed.
I'm sure that for the Excel wizards out there this could be trivial, but I rarely have occasion to use excel and certainly don't have time to become a black belt in it. Can anyone offer me advice, pointers, or a quick formula to do this? If this is going to take some complex VB code to implement, it isn't worth it.
Thank you!
You can also do this with named ranges so you don't have to copy the cells from Sheet1 to Sheet2:
Define a named range, say Sheet1Vals for the column that has the values on which you want to base your condition. You can define a new named range by using the Insert\Name\Define... menu item. Type in your name, then use the cell browser in the Refers to box to select the cells you want in the range. If the range will change over time (add or remove rows) you can use this formula instead of selecting the cells explicitly:
=OFFSET('SheetName'!$COL$ROW,0,0,COUNTA('SheetName'!$COL:$COL)).
Add a -1 before the last ) if the column has a header row.
Define a named range, say Sheet2Vals for the column that has the values you want to conditionally format.
Use the Conditional Formatting dialog to create your conditions. Specify Formula Is in the dropdown, then put this for the formula:
=INDEX(Sheet1Vals, MATCH([FirstCellInRange],Sheet2Vals))=[Condition]
where [FirstCellInRange] is the address of the cell you want to format and [Condition] is the value your checking.
For example, if my conditions in Sheet1 have the values of 1, 2 and 3 and the column I'm formatting is column B in Sheet2 then my conditional formats would be something like:
=INDEX(Sheet1Vals, MATCH(B1,Sheet2Vals))=1
=INDEX(Sheet1Vals, MATCH(B1,Sheet2Vals))=2
=INDEX(Sheet1Vals, MATCH(B1,Sheet2Vals))=3
You can then use the format painter to copy these formats to the rest of the cells.
Here's how I did it in Excel 2003 using conditional formatting.
To apply conditional formatting to Sheet1 using values from Sheet2, you need to mirror the values into Sheet1.
Creating a mirror of Sheet2, column B in Sheet 1
Go to Sheet1.
Insert a new column by right-clicking column A's header and selecting "Insert".
Enter the following formula into A1:
=IF(ISBLANK(Sheet2!B1),"",Sheet2!B1)
Copy A1 by right-clicking it and selecting "Copy".
Paste the formula into column A by right-clicking its header and selecting "Paste".
Sheet1, column A should now exactly mirror the values in Sheet2, column B.
(Note: if you don't like it in column A, it works just as well to have it in column Z or anywhere else.)
Applying the conditional formatting
Stay on Sheet1.
Select column B by left-clicking its header.
Select the menu item Format > Conditional Formatting...
Change Condition 1 to "Formula is" and enter this formula:
=MATCH(B1,$A:$A,0)
Click the Format... button and select a green background.
You should now see the green background applied to the matching cells in Sheet1.
Hiding the mirror column
Stay on Sheet1.
Right-click the header on column A and select "Hide".
This should automatically update Sheet1 whenever anything in Sheet2 is changed.
I'm using Excel 2003 -
The problem with using conditional formatting here is that you can't reference another worksheet or workbook in your conditions. What you can to do is set some column on sheet 1 equal to the appropriate column on sheet 2 (in your example =Sheet2!B6). I used Column F in my example below. Then you can use conditional formatting. Select the cell at Sheet 1, row , column 1 and then go to the conditional formatting menu. Choose "Formula Is" from the drop down and set the condition to "=$F$6=4". Click on the format button and then choose the Patterns tab. Choose the color you want and you're done.
You can use the format painter tool to apply conditional formatting to other cells, but be aware that by default Excel uses absolute references in the conditions. If you want them to be relative you'll need to remove the dollar signs from the condition.
You can have up to 3 conditions applied to a cell (use the add >> button at the bottom of the Conditional formatting dialog) so if the last row is fixed (for example, you know that it will always be row 10) you can use it as a condition to set the background color to none. Assuming that the last value you care about is in row 10 then (still assuming that you've set column F on sheet1 to the corresponding cells on sheet 2) then set the 1st condition to Formula Is =$F$10="" and the pattern to None. Make it the first condition and it will override any following conflicting statements.
Here is my own solution for restoring the original colors when copying certain highly formatted sheets or templates to a new spreadsheet.. it copies all data directly, so it only works if you need to copy a sheet, not only apply colors to a different sheet with different data:
copy the original format workbook by ctrl + g and selecting the appropriate range
paste it into the new work sheet, colors will be all changed
with the destination still highlighted, right click and go to "Paste special" and select "All using source theme", then repeat the paste special, only with "Values" this time, and it should be identical to the original sheet you copied
I've done this before with conditional formatting. It's a great way to visually inspect the cells in a workbook and spot the outliers in your data.

Resources