lxtrxi
lxtrxi

Reputation: 55

Multiple IF statements in an Excel spreadsheet

I've researched this quite a bit but to no avail, I've tried to do a choose with:

=CHOOSE(MATCH(R5,{"PASS","MERIT","DISTINCTION"},FALSE),"70","80","90")

Alternatively I've done:

=IF(R5="PASS","70"), IF(R5="MERIT","80"), IF(R5="DISTINCTION","90")

The plan is to see what the input would be for the cell R5, if it is pass then the cell that is selected which is U5 would show the appropriate points.

Pass is 70 points, Merit is 80 and a Distinction would be 90 so you can see my reasoning behind the choices in my code. Not entirely sure how to go about it. Also tried using ORs in the IF statement but I might not have coded it in completely correctly.

Upvotes: 0

Views: 112

Answers (1)

Mathias R. Jessen
Mathias R. Jessen

Reputation: 174990

The Excel IF statement is defined as:

=IF(condition,value_if_true,value_if_false)

You can substitute the values with additional statements, so it becomes:

=IF(R5="PASS","70",IF(R5="MERIT","80",IF(R5="DISTINCTION","90")))

This is equivalent to the following pseudo-code:

if(R5 equals "PASS"){
    "70"
} elseif (R5 equals "MERIT") {
    "80"
} elseif (R5 equals "DISTINCTION") {
    "90"
}

Upvotes: 2

Related Questions