Use Excel CHOOSE Function to Replace Nested IFs
1.1 Return Value Based on Conditions
In the first case, we will return a value based on some conditions using the CHOOSE function. The dataset we will use here contains the Test Scores of some students. We can easily assign the grades using the CHOOSE function. You can see the Grade Distribution in the picture below.
Generally, we use the Nested IFs to solve this type of problem. But Nested IFs can be confusing sometimes and may encounter problems if the equation becomes large. The Nested IFs formula for assigning the grades can be written as below:
Let’s follow the steps below to see how we can use the CHOOSE function to replace the Nested IFs formula.
STEPS:
- First of all, select Cell D5 and type the formula below:
🔎 How Does the Formula Work?
- (C5>0)+(C5>=50)+(C5>=60)+(C5>=70)+(C5>=80)+(C5>=90): In this part of the formula, we have used the Grade Distribution as the index number inside the CHOOSE function. As there are multiple index numbers based on the situation, we have used the plus (+) operator to make an OR operation.
- “F”,”D”,”C”,”B”,”A”,”A+”: This part contains the values corresponding to the index numbers. Depending on the index number, the CHOOSE function will return the grades. For example, if the matched index number is between 80 to 89, then it will print “A”.
- Secondly, press Enter and drag the Fill Handle down.
ليست هناك تعليقات:
إرسال تعليق