具有多个条件的Excel IF语句 [英] Excel IF statement with multiple conditions
问题描述
我正在尝试组合多个IF语句,但我无法使其工作。
它应该做的是:
I'm trying to combine multiple IF statements and I can't get it to work. What it should do is the following:
如果X = 0且Y> 0,则返回10000或者如果X> 0且Y = 0,则返回 - 10000如果两者都什么也不做。
If X=0 and Y>0, return 10000 OR if X>0 and Y=0, return -10000 if neither do nothing.
我有2列7000行,我想计算2之间的倍数变化。我正在做
I have 2 columns with 7000 rows and I want to calculate the fold change between the 2. I am doing that by
=IF(CA2<1;-1/CA2;CA2)
使0.9变为-1.1。但是,如果您的值为0,则会得到#div / 0!错误。我希望通过给出单个调节值+10000或-10000来解决这个问题。
so that 0.9 turns into -1.1. However if you have a value of 0 you get a #div/0! error. I was hoping to work around by giving single regulated values either a +10000 or -10000.
推荐答案
你的答案应该是在你的if中包含一个AND:
Your answer should be to include an AND in your if:
=IF(AND(A2=0,B2>0),1000,IF(AND(A2>0,B2=0),-1000,0))
这篇关于具有多个条件的Excel IF语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!