Microsoft Excel If 语句
我稍微修改了从之前的答案得到的声明,现在看起来像这个:
=IF(C6=$R$3,IF(D6<=0.99,$U$2,IF(AND(D6>0.99,D6<=4.99),$U$3,IF(AND(D6>4.99,D6< =14.99),$U$4,IF(AND(D6>14.99,D3<=29.99),$U$5,IF(AND(D6>29.99,D6<99.99),$U$6,""))))) ,$S$8)
一切正常,直到您将单元格 D6 中的值更改为 £45,但它仍然会获取单元格 U5 中的数字。
您或其他人可以帮我调整它以使其正常工作吗? 我需要一个语句来执行以下操作:
If C2=R2 and D2 is < 如果D2>T但T3但<T,则T2然后U2。 如果D2>T4,则U4 T4但< 如果D2>T5,则U5。 T5但< T6 然后 U6 但如果 C2 不等于 R2 那么 S8
I have altered a statement I got from a previous answer a bit and it now looks like this:
=IF(C6=$R$3,IF(D6<=0.99,$U$2,IF(AND(D6>0.99,D6<=4.99),$U$3,IF(AND(D6>4.99,D6<=14.99),$U$4,IF(AND(D6>14.99,D3<=29.99),$U$5,IF(AND(D6>29.99,D6<99.99),$U$6,""))))),$S$8)
It all works fine until you change the value in cell D6 to say £45 when it still picks up the figure in cell U5.
Can you or anyone else help me tweak this so that it works? I need a statement to do the following:
If C2=R2 and D2 is < T2 then U2, if D2 is >T but T3 but < T4 then U4 if D2 is > T4 but < T5 then U5, if D2 is > T5 but < T6 then U6 BUT if C2 does not equal R2 then S8
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将所有问题分解:
如果 C2=R2 并且 D2 < 如果D2>T但T3但<T,则T2然后U2。 如果D2>T4,则U4 T4但< 如果D2>T5,则U5。 T5但< T6 然后 U6 但如果 C2 不等于 R2 那么 S8
以此开始使用
NA()
来表示尚未完成的部分(这将显示#N/A
code>单元格中的值):添加基于D2的查找:
假设下一部分是D2> T2和D2< T3(严格来说,这个公式表示 D2 >= T2),结果是 U3:
现在在 T3 和 T4 之间添加:
在 T4 和 T5 之间:
最后在 T5 和 T6 之间:
我们仍然有 NA() ,因为您尚未定义 C2=R2 和 D2 >= T6 的行为
正如 Stobor 在对您原始问题的评论中所说,使用
VLOOKUP
会更好 - 请参阅 http://office.microsoft.com/en-us/excel/HP052093351033.aspx 了解详细信息T 和 U 列中的当前结构不适用于
VLOOKUP
,因为:这意味着当您想要
U2
、U4 时,
而不是VLOOKUP
将返回U3
U3
等等。 要解决此问题,您需要将 U 列中的所有条目向下移动一行,将虚拟值或=NA()
放入 U2 中,并在 T7 中创建一个大于T6的现有价值Take all your problems and rip them apart:
If C2=R2 and D2 is < T2 then U2, if D2 is >T but T3 but < T4 then U4 if D2 is > T4 but < T5 then U5, if D2 is > T5 but < T6 then U6 BUT if C2 does not equal R2 then S8
Start with this using
NA()
to represent parts which haven't been completed yet (this will show the#N/A
value in the cell):Add the lookup based on D2:
Assuming that the next part is D2 > T2 and D2 < T3 (althought strictly this formula says D2 >= T2) and result is U3:
Now add between T3 and T4:
Between T4 and T5:
Finally between T5 and T6:
We still have
NA()
because you haven't defined the behaviour for C2=R2 and D2 >= T6As Stobor said in the comment to your original question, using
VLOOKUP
would be much better - see http://office.microsoft.com/en-us/excel/HP052093351033.aspx for detailsYour current structure in the T and U columns won't work with
VLOOKUP
because:This would mean that
VLOOKUP
would returnU3
when you wantedU2
,U4
instead ofU3
and so on. To solve this you would need to move all of the entries in the U column down by one row, put a dummy value or=NA()
into U2 and create a value in T7 that was greater than the existing value in T6