function readOnly(count){ }  Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted Satya413

# Need help creating Formula field

Hello All,

I am trying to create a formula field called 'Grade__c' with return type text. Based on the Total Marks (Total__c, return type is number), the grade field should be populated with either A+, A, B+, B, C and D. Say for example, the total marks are 600 0ut of 800, then the grade should be B. Can anyone help me out with this.

Thank you,
Satya Best Answer chosen by Satya413 William Tran

Here you go:

IF(Total__c>700,"A+",
IF(Total__c>=600),"A",
IF(Total__c>=500),"B",
IF(Total__c>=400),"C",
"D"))))

or if these is an "F"

IF( Total__c>700,"A+",
IF(Total__c>=600,"A",
IF(Total__c>=500,"B",
IF(Total__c>=400,"C",
IF(Total__c>=300,"D",
"F"))))) William Tran
What field represent 600 = ??
what field represent 800 = Total__c?

what is the grade A+, A, B+, B, C and D percentage or ratio.

A+ =? 95%+
A =? 90%-95%

etc.

Thx Tsvety
Hi Satya,

Have you tried with nested IFs?

IF(AND(Total__c<800,Total__c=>700),"A+",
IF(AND(Total__c<700,Total__c=>600),"A",
IF(AND(Total__c<600, Total__c=>500),"B+",
.....)
)
) Satya413
Hi William,

Field representing 600 and 800 is Total__c which is a formula field with return type of number. It calculated the sum of marks obtained from each subject. Grade__c is determined by the the total__c. Total marks between 500 and 600 is a grade B and likewise 600 to 700 is A.

Thank you,
Satya Satya413
Hi Tsvety,

I have tried the below formula. However it is throwing an syntax error.

IF(AND(Total__c<800,Total__c>=700),"A+",
IF(AND(Total__c<700,Total__c>=600),"A",
IF(AND(Total__c<600, Total__c>=500),"B+")
)
)

Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2

Thank you,
Satya William Tran

Here you go:

IF(Total__c>700,"A+",
IF(Total__c>=600),"A",
IF(Total__c>=500),"B",
IF(Total__c>=400),"C",
"D"))))

or if these is an "F"

IF( Total__c>700,"A+",
IF(Total__c>=600,"A",
IF(Total__c>=500,"B",
IF(Total__c>=400,"C",
IF(Total__c>=300,"D",
"F")))))
This was selected as the best answer Tsvety
Hi Satya,

You will have to enter the missing values for all scenarios (B-, C+,C,C-,D, etc). That is why I put "...." in the end of my formula.
William's suggestion should work, but again you need to customize it based on the values you have. Satya413
Hi Guys,

Thank you both for your response. It worked. Both of u are correct and not sure which answer to mark as best .. ;)

Thank you,
Satya William Tran

As a rule of thumb, the best answer is the answer you use to solve you issue/question.
For example:

if you use:
IF(AND(Total__c<800,Total__c>=700),"A+",
IF(AND(Total__c<700,Total__c>=600),"A",
IF(AND(Total__c<600, Total__c>=500),"B+")
)
)

Then mark Satya as best answer

but if you use:

IF(Total__c>700,"A+",
IF(Total__c>=600),"A",
IF(Total__c>=500),"B",
IF(Total__c>=400),"C",
"D"))))

then mark William as best answer

In both cases, you can give a thumb up even if you can't mark both as best answer.

Thx