IFS
The IFS
function in Google Sheets evaluates multiple conditions and returns a value that corresponds to the first true condition. It is a versatile tool that allows you to handle complex logical scenarios efficiently.
Function Syntax and Parameters
Syntax: IFS(condition1, value1, [condition2, value2], ...)
Parameters:
condition1
: The first condition to evaluate.value1
: The value to return if the first condition is true.condition2, ...
: [Optional] Additional conditions and corresponding values.
Step-by-Step Tutorial
-
Basic usage of
IFS
:- Example:
=IFS(C2<20, "Low", C2>50, "High", C2>=20, "Medium")
- Result: Returns "Low" if C2 is less than 20, "High" if C2 is greater than 50, and "Medium" if C2 is between 20 and 50 (inclusive).
- Example:
-
Nested
IFS
:- Example: Nested
IFS
can be used to handle more complex scenarios.
=IFS(A2="Red", B2*2, A2="Blue", B2*3, A2="Green", B2*4, A2="Yellow", B2*5)
- Result: Returns B2 multiplied by 2 if A2 is "Red", multiplied by 3 if A2 is "Blue", multiplied by 4 if A2 is "Green", and multiplied by 5 if A2 is "Yellow".
- Example: Nested
Use Cases and Scenarios
- Grades: Assign letter grades based on numerical scores.
- Discounts: Apply different discounts based on purchase amount.
- Delivery Charges: Determine shipping costs based on distance and weight.
Related Functions
IF
: Evaluate a condition and return different values for true and false outcomes.SWITCH
: Evaluate an expression and return different values based on specific conditions.