IFS function
The IFS function in Excel is a logical function that allows you to evaluate multiple conditions and return a value based on the first true condition. It’s a more readable and compact alternative to using multiple IF statements.
Syntax:
=IFS(condition1, value_if_true1, condition2, value_if_true2, ..., condition_n, value_if_true_n)
Parameters:
- condition1, condition2, …, condition_n: These are the logical conditions you want to evaluate.
- value_if_true1, value_if_true2, …, value_if_true_n: These are the values that are returned when their corresponding conditions are true.
Example:
Suppose you want to assign a letter grade based on a student’s score:
- If the score is 90 or above, the grade should be “A”.
- If the score is between 80 and 89, the grade should be “B”.
- If the score is between 70 and 79, the grade should be “C”.
- If the score is less than 70, the grade should be “F”.
The formula would look like this:
=IFS(A1>=90, "A", A1>=80, "B", A1>=70, "C", A1<70, "F")
In this case, A1 contains the student’s score. The formula checks each condition in order and returns the corresponding grade when the first true condition is met.
Key Points:
- The
IFSfunction stops checking conditions once a true condition is found. - If no conditions are true and no default is provided, the function will return an error.