0

I have a formula that I am using in excel. The formula returns an array of values in the form of a column. I only know how to use an IF statement on a cell or a formula that returns one cell. However, I don't know how to apply it to get it to replace all the 0 values by NA() in the array returned by the formula. I want to wrap the formula using the IF statement.

It is a Reuters formula : =IF(RData(D17:D26;H16) = 0; NA(); RData(D17:D26;H16)), but it does not work at all.

RData(D17:D26;H16) returns the following column

H16 contains: AST_SWPSPD

D17:D26 contains the following RIC Codes:

BMPS2YEUAM=R 
BMPS3YEUAM=R 
BMPS4YEUAM=R 
BMPS5YEUAM=R
BMPS7YEUAM=R 
BMPS10YEUAM=R 
BMPS20YEUAM=R 
BMPS30YEUAM=R

The resulting column is the following

201.7
499.5
389.2
470.6
306.8
0
0
525.3
525.3
525.3

I want to get rid of the zeros and replace them with NA Is that possible?

Thank you.

4

3 回答 3

3

它应该完全相同。让我们假装你的公式是F(但如果你添加你的实际公式或类似于你的问题的东西会更好)

=IF(F=0, NA(), F)

即使F返回一个数组也能工作。只需替换F整个公式,不要忘记按 ctrl+shift+enter

于 2013-02-20T15:00:52.027 回答
1

除了使用=IF(RData(D17;$H$16)=0;NA(); RData(D17;$H$16))你也可以使用

=IFERROR(1/(1/(RData(D17;$H$16)));NA())

这样,您的函数只会被调用一次,这将减少计算时间。

于 2013-02-20T21:11:31.477 回答
1

Thank you all for your input,

I found a way to go around it, simply by returning one value at a time and wrapping it with the IF statement.

So it becomes: =IF(RData(D17;$H$16)=0;NA(); RData(D17;$H$16))

I am fixing H16 because it contains the argument needed for the formula.

This way it works.

于 2013-02-20T17:07:46.300 回答