简体   繁体   English

如何在Excel中添加公式的条件

[英]How can I add in condition for formula in Excel

How can I add in one more condition in the formula for Column D that the number range should also see based on the Type. 如何在D列的公式中添加一个条件,该数字范围也应基于Type看到。

For example, 例如,

  • if it's type A, number range is 886000 - 886018, 如果是A型,则数字范围是886000-886018,
  • if it's type B, number range is 886020 - 886077, and 如果是B型,则数字范围是886020-886077,并且
  • if it's type C, number range is 886079 - 886091. 如果是C型,则数字范围是886079-886091。

在此处输入图片说明

Column B is 栏B为

=IF(AND(A2+1<>A3,A2-1<>A1),"start-end",IF(A2+1<>A3,"end",IF(A2-1<>A1,"start","...")))

Column D is D栏是

=IF(AND(OR(B2="start",B2="start-end")),A2,C1)

Column E is =IF(B2="start",INDEX(A2:$A$1048576,MATCH("end",B2:$B$1048576,0)),IF(B2="start-end",D2,E1)) E =IF(B2="start",INDEX(A2:$A$1048576,MATCH("end",B2:$B$1048576,0)),IF(B2="start-end",D2,E1))

I'm not sure why it needs to be so complicated. 我不确定为什么需要这么复杂。 Why don't you add a VLOOKUP ? 为什么不添加VLOOKUP

Column G | Column H
886000   | 886000-886019
886020   | 886020-886078
886079   | 886079-886091

=VLOOKUP(A2,$G$2:$H$4,2,TRUE)

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

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