Forum Discussion

dlsneb's avatar
dlsneb
Copper Contributor
Apr 06, 2023
Solved

Formula

I am trying to create a formula that looks at only two cells: A1 and A2.   If A1 = "A" or "B" or "C"    AND   (A2="M" then I want the output to be 2, otherwise 0  OR if A2="H" then I want the output to be 3, otherwise 0,  I can't get the logic to work?

 

If A1="A" or "B" or "C"

AND

(A2="M", 2, 0) OR (A2="H", 3, 0)

  • dlsneb 

    =OR(A1={"A","B","C"})*((A2="M")*2+(A2="H")*3)

     

    Or if A1 contains nothing but A, B or C:

    =(A2="M")*2+(A2="H")*3

     

  • Detlef_Lewin's avatar
    Detlef_Lewin
    Silver Contributor

    dlsneb 

    =OR(A1={"A","B","C"})*((A2="M")*2+(A2="H")*3)

     

    Or if A1 contains nothing but A, B or C:

    =(A2="M")*2+(A2="H")*3

     

    • dlsneb's avatar
      dlsneb
      Copper Contributor
      Thank you, it works perfectly. I don't know what function the " * " character does in the equation, I'll have to look that up.
      • Detlef_Lewin's avatar
        Detlef_Lewin
        Silver Contributor

        dlsneb 

        * is an operator which can be used instead of AND().

        + is an operator which can be used instead of OR().

Resources