如何比较值的多个范围 [英] how to compare multiple range for values

查看:87
本文介绍了如何比较值的多个范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如何比较多个值的范围,并根据它将值放在另一个范围内?


如果Range( "A1")。值="男人"。然后Range("A3")。Value =" human"


同样如果Range("A1","A2")。Value =" man"和"女人"然后是Range("A3")。Value =" human"


如果超过两个标准呢?


请帮助。


问候

解决方案

如果所有条件都必须为真


< pre class ="prettyprint lang-vb"> If Range(" A1")。Value =" man"和范围("A2")。值="女人"。和范围("A3")。值="儿童"。然后
范围("A4")。值="人类"
否则

结束如果

如果只有一个条件必须为真

 If Range(" A1")。Value =" man"或范围("A2")。值="女人"。或范围("A3")。值=" child"然后
范围("A4")。值="人类"
其他

结束如果


Hi,

How to compare multiple ranges for value and put value on another range based on it ?

If Range("A1").Value = "man" Then Range("A3").Value = "human"

likewise If Range("A1","A2").Value = "man" and "woman" Then Range("A3").Value = "human"

And if more than two criteria then ?

please help.

regards

解决方案

If all conditions has to be true

If Range("A1").Value = "man" And Range("A2").Value = "woman" And Range("A3").Value = "child" Then
     Range("A4").Value = "human"
Else

End If

If just one condition has to be true

If Range("A1").Value = "man" or Range("A2").Value = "woman" or Range("A3").Value = "child" Then
     Range("A4").Value = "human"
Else

End If


这篇关于如何比较值的多个范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆