The IFS function in Excel is a powerful logical function that allows users to evaluate multiple conditions without the need for nested IF statements. This function simplifies complex logical tests, making it easier to return a specific value based on the first condition that evaluates to TRUE. With the IFS function, users can streamline their formulas for increased readability and efficiency.
Syntax
IFS(condition1, value1, [condition2, value2], ...)
- condition1: The first condition to evaluate. If TRUE, Excel will return value1.
- value1: The value returned if condition1 is TRUE.
- condition2: (Optional) The second condition to evaluate if the first is FALSE.
- value2: (Optional) The value returned if condition2 is TRUE.
- Additional pairs: You can add as many condition/value pairs as needed.
Example #1
=IFS(A1>90, "A", A1>80, "B", A1>70, "C")
This function checks the value in cell A1. If A1 is greater than 90, it returns “A”; if greater than 80, it returns “B”; and if greater than 70, it returns “C”. For a value of 85, the result would be “B”.
Example #2
=IFS(B1="Yes", 100, B1="No", 0)
In this case, the formula evaluates the value in cell B1. If B1 is “Yes”, the formula returns 100; if “No”, it returns 0. Thus, if B1 contains “Yes”, the output will be 100.
Example #3
=IFS(C1>=18, "Adult", C1<18, "Minor")
Here, the function checks the value in C1 to determine age classification. If C1 is 18 or older, it returns "Adult"; otherwise, it returns "Minor". For a value of 15, the result will be "Minor".
Error handling
- N/A: This error occurs if none of the conditions are met and there are no specified default values.
- VALUE!: This error happens when the provided conditions are not logical or when there are mismatched data types.
- REF!: This error indicates that a referenced cell within the conditions is invalid.