Trying to make a grade system, so I need some code that says

“If percentage in cel 1 is between the range of 60%-70% then return string value (string value = “D”) to cel 2” for libreoffice calc if anyone can help me out.

Ideally I need it for all values ranging down to 40%

40-59 is F

60-69 is D

70-79 is C

80-89 is B

90-100 is A

I have experience coding but not with this.

Try:
=LOOKUP(A5;{40,60,70,80,90};{"F","D","C","B","A"})

Notes.ods (9,5 KB)

Returns #N/A in the same cel edit: I’m going to add some pics to get it across better

#NA! indicates that your value in A5 is smaller than the smallest value in the search vector (40).

It works with a thousand time multiple of the specified value, but not with the actual value suggested by the code?

Test #1 has the code from the suggestion, 2nd one also does, ignore the 3rd entry.

PKG_2

1 Like

I found the answer actually, because CALC actually specifies percentage values as a decimal, or the whole number divided by 100. (0.1 = 10%), the values were far too high for it to account for the decimal placement, so the answer was:

=LOOKUP(B38,{0.5,0.6,0.7,0.8,0.9,1},{“F”,“D”,“C”,“B”,“A”,“A+”})

We just came to the same conclusion! Thanks for the help.

Got it all working, thanks for helping!

NO! x% is equal to x/100 and therefore 0.1 equals to 10%

1 Like

Oops you’re right, my brain farted on the explanation but I had it working in my head. I fixed it