组合多个 IF/AND/THEN 语句
Combining multiple IF/AND/THEN statements
2013 年 Excel 内工作:
场景:自动计算填充R11:R61以确定交易是“盈利”还是“亏损”。
判断标准:判断多头或空头,判断退出价格是否<>= to Target Price;
我已经用句子的形式写下了必要的计算,以帮助看清问题。我正在努力将这两个想法合二为一。
IF a trade (D11:D61) = "long" AND the Exit Price (M11:M61) is >= Target Price (N11:N61) THEN (R11:R61) = "Win" otherwise "Loss"
IF the above trade = "short" AND the Exit Price (M11:M61) is <= Target Price (N11:N61) THEN (R11:R61) = "Win" otherwise "Loss"
有没有办法将两种计算IF/THEN场景合二为一?
If ((交易 (D11:D61) = "long" AND 退出价格 (M11:M61) >= 目标价格 (N11:N61) )
OR (trade = "short" AND Exit Price (M11:M61) is <= Target Price (N11:N61))) then "Win" otherwise "Loss"
现在将其转化为 Excel 公式形式...
可能是这样的:
=IF(OR(AND(D11="long",M11>=N11),AND(D11="short",N11>=M11)),"Win","Loss")
2013 年 Excel 内工作:
场景:自动计算填充R11:R61以确定交易是“盈利”还是“亏损”。
判断标准:判断多头或空头,判断退出价格是否<>= to Target Price;
我已经用句子的形式写下了必要的计算,以帮助看清问题。我正在努力将这两个想法合二为一。
IF a trade (D11:D61) = "long" AND the Exit Price (M11:M61) is >= Target Price (N11:N61) THEN (R11:R61) = "Win" otherwise "Loss"
IF the above trade = "short" AND the Exit Price (M11:M61) is <= Target Price (N11:N61) THEN (R11:R61) = "Win" otherwise "Loss"
有没有办法将两种计算IF/THEN场景合二为一?
If ((交易 (D11:D61) = "long" AND 退出价格 (M11:M61) >= 目标价格 (N11:N61) ) OR (trade = "short" AND Exit Price (M11:M61) is <= Target Price (N11:N61))) then "Win" otherwise "Loss"
现在将其转化为 Excel 公式形式...
可能是这样的:
=IF(OR(AND(D11="long",M11>=N11),AND(D11="short",N11>=M11)),"Win","Loss")