Forum Discussion

John23785's avatar
John23785
Copper Contributor
Jul 30, 2024

If Or Statement, Cell contains specific text

Hello - I am trying to write a formula that says If Name contains Fred1, Fred2, or if Column B says Blue, or Column C says Leave, then Include (True) or Exclude (False). For example: 

 

NameSpecificationWhere
Fred1BlueLeave
Fred2BlueStay
Fred3YellowLeave

 

Hoping this makes sense, please let me know if otherwise. Thank you, 

  • John23785 

     

    =OR(Name_cell="Fred1", Name_cell="Fred2", Specification_cell="Blue", Where_cell="Leave")

     

    will return TRUE if any of the conditions is met, FALSE otherwise.

    • John23785's avatar
      John23785
      Copper Contributor
      Thanks Hans, now if "Name" cell contains Fred1 like Fred1LastName, how could I specify it for just Fred1?
  • nkal24's avatar
    nkal24
    Brass Contributor
    =(ISNUMBER(SEARCH("Fred1*",name_range)) + (spec_range = "Blue") + (leave_range = "Leave") )> 0


    As dynamic array formula, if using Microsoft 365

     

    • Replace SEARCH with FIND if case sensitivity is needed. Also adjust wildcard (*/?) placement according to your need
    • `+` is used for OR operations and `*` used for AND operations, with TRUE = 1 and FALSE = 0
    • John23785's avatar
      John23785
      Copper Contributor
      Think I'm using this wrong, as I'm returning #VALUE when I drag it down to the rest of the cells. Formula being: =(IsNumber(Search("Fred1",A2)+(A2="Leave"))>0

Resources