Skip to main content
Participant
May 16, 2018
Question

How to assign a number value to a letter

  • May 16, 2018
  • 2 replies
  • 874 views

I am trying to create a GPA calculator, so I want to assign a number value to letters. For ex. A=4, B=3, C=2, D=1, and F=0.

I will then multiple the credit hours by the letter. For ex. 3 x B = 9.

I understand how to do the calculations in the cells, but what I need help with is assigning a number value to the letters before completing a calculation.

Thanks.

This topic has been closed for replies.

2 replies

Inspiring
May 25, 2018

Using a drop down field for each course and using the Grade letter for the Item and assigning the weighting or number value to the Option would then cause the value of the drop down field to be the numeric value when the letter grade was selected. You can then use any of the filed calculation options to calculate the average.

Participant
May 25, 2018

gkaiseril​ This helped a lot! Got everything I need! Thank you!

Participating Frequently
May 25, 2018

var v = this.getField("Score").value;

if (v=="") event.value = "";

else {

     if (v=="A") event.value = 4;

     else if (v=="B") event.value = 3;

     else if (v=="C") event.value = 2;

     else if (v=="D") event.value = 1;

     else if (v=="F") event.value = 0;

}

Participant
May 25, 2018

Where would I enter the Javascript?