You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何编写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 abc or zyz AND the Qty equals 10. We use OR(A2="abc",A2="zyz") to target the two specific products, then wrap that with AND(..., B2=10) to tie it to the quantity requirement.
  • Second condition group: Checks if the product is NOT abc or zyz (i.e., any other product like test1) AND the Qty equals 5. NOT(OR(A2="abc",A2="zyz")) filters out the two specific products, then AND(..., 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 09:02:10