'Dropdown List to Return Blank, IF Another Cell is Blank
I am trying to achieve this without using a script (as I'm really unfamiliar with them) but if it's the only way, I'd definitely be happy to learn.
So, on my Google Sheet, I have a dropdown list set with the following list:
Active,Semi-Active,Inactive,Suspended,Remove,LOA,ROA
However, I want this list to return a blank value IF another cell is blank.
Example:
Cell D1 contains any sort of text value & Cell L1 is the dropdown list, and "Active" has been set as the option from the list.
IF Cell D1 is cleared, so any text value inside it is deleted, then cell L1 will return blank. The drop down box and data validation will still be there, however, as long as cell D1 is blank, then cell L1 will remain blank too. If cell D1 then has text entered into it, then Cell L1 (drop down list) will be able to then be set to one of the actual options from the list (Active,Semi-Active,Inactive,Suspended,Remove,LOA,ROA).
To summarise, if cell D1 contains any sort of text, then cell L1 can be set to anything from the list in the data validation. However, if cell D1 is blank, then L1 will be blank.
Solution 1:[1]
If column 1 is less than 2 then column3 returns to zero on any attempt to select another validated value
Try this onEdit(e) function:
function onEdit(e) {
e.source.toast("Entry");
const sh = e.range.getSheet();
if (sh.getName() == 'Sheet0' && e.range.columnStart == 3 && e.range.offset(0, -2).getValue() < 2) {
e.range.setValue('');
}
}
Sheet0:
| COL1 | COL2 | COL3 | COL4 |
|---|---|---|---|
| 0 | 7 | 0 | |
| 17 | 8 | 2 | 14 |
| 10 | 11 | 1 | 19 |
| 4 | 12 | 1 | 4 |
| 19 | 3 | 2 | 9 |
| 16 | 4 | 3 | 2 |
| 15 | 6 | 4 | 4 |
| 1 | 8 | 9 |
If column zero is less than 2 then column3 returns to blank
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Cooper |
