4 Replies Latest reply on Jul 25, 2016 10:30 AM by Diogo Braga

# IF A>B THEN

I am compering school letter grades (A, B, C, D, F) on an IF THEN statement. What's the best way to assign numberical values to letters?

• ###### 1. Re: IF A>B THEN

How do you plan on using result?

If for display purpose only - I'd go with aliases.

As to calculation itself...

Simple way:

```CASE [Grade]
WHEN "A" THEN 5
WHEN "B" THEN 4
WHEN "C" THEN 3
WHEN "D" THEN 2
WHEN "E" THEN 1
END
```

Overly complicated way:

```IF ASCII([Grade]) >= 65 AND ASCII([Grade]) <= 69
END
```

Both will map A to 5 and E to 1.

2 of 2 people found this helpful
• ###### 2. Re: IF A>B THEN

Hi Diogo,

If you wish to compare the school grade then I would suggest is to assign the numeric values rather that aliases. I am not sure what exactly your requirement is but this method will help you to compare the grade in between student of a one particular division. You can go further by going calculating Avg/Min/Max grade per division. Then you can calculate the average grade of a class. There are many things you can calculate if you include numeric column for Grades along with alphabets (A,B,C,D,E). At the end this grades are have the numeric ranges thus I would suggest you to include the numbers along with it.

I hope this helps.

Thanks and Regards,

Ashish Chaudhari

1 of 1 people found this helpful
• ###### 3. Re: IF A>B THEN

We can compare Numerical Data in easy way,

I can suggest Convert Grades into Integers, then implement the IF THEN approach.

Syntax:

......

End

2) Now we can compare the Grades easily.

I assume Grade - A is the toppest , B, C... are following of next grades.

I hope this approach helps you.

Best Regards

Kumar

1 of 1 people found this helpful
• ###### 4. Re: IF A>B THEN

Dmitry Chirkov, the display needs to be letters, converting to integers is for calculation purposes.

My dataset has column names: ID, Year, School Grade

I only need the school grade converted to integers if Year=2015

What I really need is to compare school grades actual with school grades goals for the year 2015.

Still unclear how to proceed with the conversion to integers though.