如何编写Excel嵌套IF公式实现指定补货规则的结果判定?
Excel Nested IF Formula for Refill Decision
Got it, let's build the right formula for your refill judgment scenario. Here's the exact nested IF formula you can drop into your Result column (assuming your first data row is row 2, with Prod Name in column A, Qty in column B):
=IF(OR(AND(OR(A2="abc",A2="zyz"),B2=10),AND(NOT(OR(A2="abc",A2="zyz")),B2=5)),"Refill","Don't Refill")
How this formula works
Let's break down the logic to match your rules:
- First condition group: Checks if the product is either
abcorzyzAND the Qty equals 10. We useOR(A2="abc",A2="zyz")to target the two specific products, then wrap that withAND(..., B2=10)to tie it to the quantity requirement. - Second condition group: Checks if the product is NOT
abcorzyz(i.e., any other product liketest1) AND the Qty equals 5.NOT(OR(A2="abc",A2="zyz"))filters out the two specific products, thenAND(..., B2=5)checks the quantity for other products. - Final IF check: The
OR(...)wraps both condition groups—if either is true, the formula returns"Refill", otherwise it returns"Don't Refill".
Testing with your sample data
Let's plug in your example rows to verify:
- Row 2: Prod Name =
abc, Qty = 10 → Meets first condition group → Result =Refill - Row 3: Prod Name =
zyz, Qty = 9 → Doesn't meet either condition → Result =Don't Refill - Row 4: Prod Name =
test1, Qty = 5 → Meets second condition group → Result =Refill
内容的提问来源于stack exchange,提问作者good.learner
相关产品推荐
相关产品推荐

