=IF(A1<4,"E",IF(A1<12,"D",IF(A1<16,"C",IF(A1<18,"B","A"))))

copy this formula and paste in the formula bar of the cell in which you want to add grade and replace "A1" with the cell from which number is to be checked for grade.

this will convert numbers below 4 to grade E

4-11 to grade D

12-15 to grade C

16-17 to grade B

18and above to grade A