IF功能有3个条件 [英] IF function with 3 conditions
问题描述
我正在寻找一个有三个条件的公式。它目前仅适用于2个条件。这是我正在寻找的:
I'm looking to create a formula with 3 conditions. It is currently only working with 2 conditions. Here's what I'm looking for:
E9
有一个数字
如果数字 21 +
那么我希望它显示文字 1
If the number is 21+
then I want it to show Text 1
如果数字介于 5和21
之间,那么我希望它显示Text 2
If the number is between 5 and 21
, then I want it to show Text 2
如果数字低于 5
,那么我希望它显示Text 3
If the number is below 5
, then I want it to show Text 3
这就是我目前所拥有的:
This is what I currently have:
=IF(E9>21,"Text 1",IF(E9<21,E9>5,"Text 2")
当我尝试添加最终条件时,它给出了一个错误,我为此函数输入了太多参数。当数字低于5时,它显示为False。
When I try and add the final condition, it gives me an error that I've entered too many arguments for this function. When the number is below 5 it shows False.
我更喜欢不使用 VLOOKUP
的解决方案。
I would prefer a solution that does not use VLOOKUP
.
我不明白为什么它说这是不允许的,我有另外一个带有5个嵌套公式的IF函数可以正常工作。
I'm not understanding why it's saying this is not allowed, I have another IF function with 5 nested formulas that works just fine.
推荐答案
你可以这样做:
=IF(E9>21,"Text 1",IF(AND(E9>=5,E9<=21),"Test 2","Text 3"))
注意我假设你的意思是> =
和< =
,因为你的描述跳过了值 5
和 21
,但您可以根据需要调整这些不等式。
Note I assume you meant >=
and <=
here since your description skipped the values 5
and 21
, but you can adjust these inequalities as needed.
或者你可以这样做:
=IF(E9>21,"Text 1",IF(E9<5,"Text 3","Text 2"))
这篇关于IF功能有3个条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!