Reputation: 1
If a cell was "x","y", or "z", I would like to spit out XYZ
Else "a", "b", or "c", then ABC
ELSE
assign "MNO"
I am currently working with this:
=IF(ISERROR(FIND("x",A2)), IF(ISERROR(FIND("a",A2)), "ABC", "MNO"),"XYZ")
Upvotes: 0
Views: 109
Reputation: 1
try:
=IF(REGEXMATCH(A2, "x|y|z"), "XYZ",
IF(REGEXMATCH(A2, "a|b|c"), "ABC", "MNO"))
if A2 is number use:
=IF(REGEXMATCH(A2&"", "1|2|3"), "XYZ",
IF(REGEXMATCH(A2&"", "a|b|c"), "ABC", "MNO"))
for arrayformula use:
=ARRAYFORMULA(IF(A2:A="",,
IF(REGEXMATCH(A2:A, "x|y|z"), "XYZ",
IF(REGEXMATCH(A2:A, "a|b|c"), "ABC", "MNO"))))
Upvotes: 2
Reputation: 152475
Use OR:
=ArrayFormula(IF(OR(A2={"x","y","z"}),"XYZ",IF(OR(A2={"a","b","c"}),"ABC","MNO")))
Upvotes: 2