简体   繁体   English

Microsoft Excel:使用“ OR”函数比较非数值

[英]Microsoft Excel: Using “OR” Function to Compare Non-Numeric Values

I'll get right to it. 我会正确的。 I've included a screenshot to help out with this question. 我提供了一个屏幕截图来解决这个问题。

在此处输入图片说明

Look at cell J24. 看单元格J24。 I need to write a formula that does the following: 我需要编写一个执行以下操作的公式:

If I24 is equal to "NA", then J24 needs to say "NA". 如果I24等于“ NA”,则J24需要说“ NA”。 If I24 is equal to "ND", then it needs to do a calculation, I I24 is a number, then it needs to do a different calculation. 如果I24等于“ ND”,则需要进行计算;如果I24是数字,则需要进行不同的计算。 I was thinking something like this: 我在想这样的事情:

IF(I24="NA", "NA", IF(I24="ND", $E$22-H24, IF(ISNUMBER(I24), ($E$22-H24+(0.84*I24), "ERROR"))) IF(I24 =“ NA”,“ NA”,IF(I24 =“ ND”,$ E $ 22-H24,IF(ISNUMBER(I24),($ E $ 22-H24 +(0.84 * I24),“ ERROR”)) )

I don't think this works though because of the last step in my argument. 我不认为这行得通,但是由于我论证的最后一步。 Earlier in the equation I basically have this check to see if a cell is equal to "NA" or "ND", which are both non-numeric. 在等式的前面,我基本上进行了检查,以查看单元格是否等于“ NA”或“ ND”,它们都是非数字的。 Later in the equation, I have something that's checking whether or not the cell is non-numeric. 在等式的后面,我要检查单元格是否为非数字。 So basically, it's going to get to the last part of the equation and say "Oh, I see it says "NA" or "ND" instead of a number, so I'm going to return "FALSE". Do I just need to rearrange the equation? Use the AND or OR function with this IF statement? And if that's the case, how in the world do I combine all these? 所以基本上,它将到达等式的最后一部分,然后说:“哦,我看到它说的是“ NA”或“ ND”而不是数字,所以我将返回“ FALSE”。我是否只需要重新排列方程式?在此IF语句中使用AND或OR函数?如果是这种情况,那么我怎么将所有这些结合起来?

I've been trying to figure out how to use the IF function with the OR function by saying something like "IF(OR(I24<>"NA", "ND"), I24, "FAIL). 我一直在试图通过说出类似“ IF(OR(I24 <>“ NA”,“ ND”),I24,“ FAIL)之类的东西来找出如何将IF函数与OR函数一起使用。 Is that how you would say "If I24 is not equal to "NA" or "ND""? 那是怎么说“如果I24不等于“ NA”或“ ND””? Or do I have the syntax wrong? 还是我的语法错误?

Okay, so I actually figured out the answer with a little bit playing around. 好的,所以我实际上是在花些时间找出答案。 This is how it should go: 这应该是这样的:

IF(ISNUMBER(I24), ($E$22-H24+(0.84*I24)), IF(I24="NA", "NA", IF(I24="ND", $E22-H24)))

I guess what I was trying to figure out at the same time is, why can't you have a function that says: 我想我同时想弄清楚的是,为什么不能有一个说:

IF(OR(I24<>"NA", "ND"), I24, "ERROR")

Isn't that how you say "If I24 is not equal to "NA" or "ND"??? It gives me an error when I try that and says " #VALUE ". 这不是您怎么说“如果I24不等于” NA”或“ ND”吗????当我尝试说“ #VALUE”时,它给我一个错误。

I know it's not quite related, but it is something could be useful in the future if I'm filling out these spreadsheets and I don't have "NA" or "ND". 我知道这并不太相关,但是如果我填写这些电子表格并且没有“ NA”或“ ND”,将来可能会有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM