我正试图在excel中确定这个公式,但我一定做错了。我不是程序员,但这是逻辑。这是我现在的公式:=IF(L30="N",IF(G30>F30,"Overspend","Underspend"),IF(G30>E30,"Overspend","Underspend"))
If K2 = "False"
If G2>F2
return overspend
Else
return underspend
Else
If G2>E2
return overspend
Else
return underspend
答案 0 :(得分:0)
OR()
和AND()
是很棒的功能。
=IF(OR(AND(K2="N",G2>F2),AND(K2="Y",G2>E2)),"Overspend","Underspend")
=IF( -- If
OR( -- either
AND(K2="N",G2>F2), -- all of this
AND(K2="Y",G2>E2) -- or all of this
) -- is true
,"Overspend" -- show this
,"Underspend") -- otherwise show this