none
how to compare multiple range for values RRS feed

  • Question

  • 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

    Wednesday, October 14, 2015 8:22 AM

All replies

  • 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

    • Proposed as answer by André Santo Wednesday, October 14, 2015 11:55 AM
    Wednesday, October 14, 2015 11:55 AM
  • Thank you André Santo ,

    Regards,

    There may be more ways , no ?


     
    Wednesday, October 14, 2015 1:05 PM