Copy link to clipboard
Copied
So I'm I need a formula for an If Else statement where if Cell 1 equals a value the output changes.
So to make it simple Cell 1 has a value entered between 1-12. I need the values to output as such:
If Cell 1 = 1-6 Cell 2 = 0
If Cell 1 = 7-8 Cell 2 = 1
If Cell 1 = 9-10 Cell 2 = 2
If Cell 1 = 11+ Cell 2 = 3
I started by making Cell 1 and number variable, and I got a basic If Else statement to work for a single variable but I can't get it to work for multiple.
You can use this code as the custom calculation script of "Cell 2". The last line takes care of the case where "Cell 1" is empty (or zero), which you didn't specify in your post:
var cell1 = Number(this.getField("Cell 1").valueAsString);
if (cell1>=1 && cell1<=6) event.value = 0;
else if (cell1>=7 && cell1<=8) event.value = 1;
else if (cell1>=9 && cell1<=10) event.value = 2;
else if (cell1>=11) event.value = 3;
else event.value = "";
Copy link to clipboard
Copied
You can use this code as the custom calculation script of "Cell 2". The last line takes care of the case where "Cell 1" is empty (or zero), which you didn't specify in your post:
var cell1 = Number(this.getField("Cell 1").valueAsString);
if (cell1>=1 && cell1<=6) event.value = 0;
else if (cell1>=7 && cell1<=8) event.value = 1;
else if (cell1>=9 && cell1<=10) event.value = 2;
else if (cell1>=11) event.value = 3;
else event.value = "";
Copy link to clipboard
Copied
Hello,
I have a similar challenge and I tried applying the above concept but still not getting the desired results.
Total_Score1 | Performance_Rating1 |
22-24 | EE |
16-21 | ME |
10-15 | NI |
0-9 | DNM |
I tried using this on my Adobe Form to populate field "Performance_Rating1"
if ("TOTAL_SCORE1" > 21){ event.value = "EE";
} else if ("TOTAL_SCORE1" > 15){ event.value = "ME";
} else if ("TOTAL_SCORE1" > 9){ event.value = "NI";
} else event.value = "DNM";
The only result I am getting is "DNM"
Copy link to clipboard
Copied
To access a field's value it's not enough to just write out the field's name. You must use getField("FieldName").value, just like in the example above.
Copy link to clipboard
Copied
Thank you that was exactly what I missed!!
if (getField("TOTAL_SCORE1").value > 21){ event.value = "EE"; }
else if (getField("TOTAL_SCORE1").value > 15){ event.value = "ME"; }
else if (getField("TOTAL_SCORE1").value > 9){ event.value = "NI"; }
else event.value = "DNM";