Excel IF statement with multiple conditions

2019-08-25 06:51发布

I'm trying to combine multiple IF statements and I can't get it to work. What it should do is the following:

If X=0 and Y>0, return 10000 OR if X>0 and Y=0, return -10000 if neither do nothing.

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)

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.

1条回答
相关推荐>>
2楼-- · 2019-08-25 07:20

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)) 
查看更多
登录 后发表回答