求助:修改Excel IF计分公式,仅当E1=F1且G1=H1时生效
Excel Formula Adjustment for Conditional Scoring
Got it, let's fix up your formula to include the team matching prerequisite you need. Here's how to structure it properly:
Final Modified Formula
=IF(AND(E1=F1,G1=H1), IF(OR(A1="",B1=""),"", IF(AND(A1=C1,B1=D1),5, IF(OR(C1-D1=A1-B1,AND(C1>D1,A1>B1),AND(D1>C1,B1>A1)),2,0))), "")
Breakdown of the Logic
Let's walk through each layer so you understand exactly what's happening:
- Prerequisite Check: The outer
IF(AND(E1=F1,G1=H1), ..., "")first verifies if your team pairs match (E1=F1 and G1=H1). If this condition fails, it returns an empty string ("") and skips all scoring logic. - Empty Score Handling: If the team check passes, it next checks if either actual score cell (A1 or B1) is empty. If so, it returns an empty string to avoid calculating scores for incomplete data.
- Full Correct Score: If actual scores are present, it checks if the prediction (C1/D1) exactly matches the actual result (A1/B1). A perfect match gets 5 points.
- Correct Match Outcome: If the full score isn't a match, it checks three valid "correct outcome" scenarios:
- Prediction goal difference matches actual goal difference (
C1-D1=A1-B1) - Both prediction and actual result have the home team winning (
C1>D1andA1>B1) - Both prediction and actual result have the away team winning (
D1>C1andB1>A1)
Any of these scenarios earn 2 points.
- Prediction goal difference matches actual goal difference (
- No Points: If none of the above conditions are met, it assigns 0 points.
Quick Tweak Option
If you'd prefer to return 0 instead of an empty string when the team prerequisite isn't met, just replace the final "" in the formula with 0.
内容的提问来源于stack exchange,提问作者DanfrancoZola
相关产品推荐
相关产品推荐

