I'm very new to Google Forms and Spread Sheets and what I wanna do is that I have an "Age" question in my form, and when the user submits the form I want it so that if the age is below 18, a cell gets the value "MINOR" and if it is 18 or above, it gets filled with "MAJOR".
Basically I want to dynamically add a value to this cell base on the value of "AGE".
What I'm doing right now:
function myfunction(e) {
var age = Number(e.values[3]);
var minmaj;
if (age < 18){
minmaj = "MINOR";
} else {
minmaj = "MAJOR";
}
SpreadsheetApp.getActiveSheet().getRange(e,14).setValue(minmaj);
}
Where e,14
is the cell of value minor/major.
This formula may work as you want if entered in row 2 of the column to the right of your Form response data:
=ARRAYFORMULA(IF(A2:A="",,IF(E2:E<18,"MINOR","MAJOR")))
It will automatically detect new submissions and populate the cell based on the value in column E