Excel中IF+OR组合公式返回FALSE的问题求助
Fixing Excel Formula's FALSE Return Issue
Your original formula has two critical issues leading to unexpected FALSE results:
- Invalid logical test in OR: The
ORfunction usesD7+$D$1(an arithmetic calculation) instead of a TRUE/FALSE condition.ORonly works with boolean values—for example, if you meant to check ifD7equals$D$1, useD7=$D$1. - Missing else clauses: Both
IFfunctions lack a fallback value. When conditions aren't met, Excel returns FALSE by default instead of an empty result.
Corrected Formula (assuming your intended OR condition is "C7 equals $C$1 OR D7 equals $D$1")
=IF(OR(C7=$C$1, D7=$D$1), IF(C7=$C$2, D7+$D$2, ""), "")
Alternative Formula (for conditional sums based on C7 values)
If you wanted to apply D7+$D$1 when C7=$C$1 and D7+$D$2 when C7=$C$2 (returning empty otherwise), use this simpler structure:
=IF(C7=$C$1, D7+$D$1, IF(C7=$C$2, D7+$D$2, ""))
What These Fixes Do
- The first formula checks if either condition in
ORis true. If so, it verifies ifC7=$C$2to return the sum; otherwise, it returns an empty string. If theORcondition fails, it also returns empty. - The second formula directly checks each
C7value in sequence, returning the corresponding sum or empty if neither condition matches.
内容的提问来源于stack exchange,提问作者Reshma Mahase
相关产品推荐
相关产品推荐

