Combining Conditions
Svep för att visa menyn
The IFS Function
=IFS(logical_test1; value_if_true1; [logical_test2; value_if_true2]; ...)
=IFS(D9>100; "High"; D9>50; "Medium"; TRUE; "Low")
IFS has no built-in "else". If no condition matches, it returns an error. Always add TRUE, "default value" as the last pair to guarantee a result for every row.
Order matters. Excel checks conditions left to right and stops at the first TRUE. Put the most specific (narrowest) conditions first — a broad condition placed early will swallow everything below it. For example, putting D9>0 before D9>50 means "Medium" and "High" are never reached.
Combining Conditions with AND
All conditions must be true.
All conditions TRUE → TRUE | Any condition FALSE → FALSE.
=IF(AND(D9>100; B9="Dining"); "Review"; "OK")
Combining Conditions with OR
At least one condition must be true.
Any condition TRUE → TRUE | All conditions FALSE → FALSE.
=IF(OR(D9>100; B9="Dining"); "Review"; "OK")
Task
-
Create a multi-level Flag using IFS
Go to the Flag column. In the first row (e.g., F9), enter:
=IFS(D9>100;"High";D9>50;"Medium";TRUE;"Low")Drag the formula down.Confirm that values above 100 return "High", values above 50 return "Medium", and all others return "Low".
-
Test condition order (intentional mistake)
Modify the formula to:
=IFS(D9>0;"Low";D9>50;"Medium";D9>100;"High")Observe that most rows return "Low". Then fix the formula by restoring the correct order.
-
Flag large Dining expenses (AND)
Create a new column called Review (Strict). Enter:
=IFS(AND(D9>100;B9="Dining");"Review";TRUE;"OK")Drag the formula down.Confirm that only rows where Amount > 100 and Category = Dining return "Review".
-
Flag broader conditions (OR)
Create another column called Review (Flexible). Enter:
=IFS(OR(D9>100;B9="Dining");"Review";TRUE;"OK")Drag the formula down.Compare with the previous column. More rows should now be flagged as "Review".
-
Validate logic differences
Find at least one row where the results differ:
- AND returns "OK".
- OR returns "Review".
This confirms the difference in logic.
Tack för dina kommentarer!
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal