How do I use text search and OR statements to check if a cell contains "2022" or "2021" or "2020"?

%3CLINGO-SUB%20id%3D%22lingo-sub-3415256%22%20slang%3D%22en-US%22%3EHow%20do%20I%20use%20text%20search%20and%20OR%20statements%20to%20check%20if%20a%20cell%20contains%20%222022%22%20or%20%222021%22%20or%20%222020%22%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3415256%22%20slang%3D%22en-US%22%3E%3CP%3E%3DIF(OR(ISNUMBER(SEARCH(I2%2C%222022%22))%2C%20ISNUMBER(SEARCH(I2%2C%222021%22))%2C%20ISNUMBER(SEARCH(I2%2C%222020%22)))%2C%22y%22%2C%22n%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENot%20working%2C%20it%20always%20returns%20%22n%22%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3415256%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3415600%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20I%20use%20text%20search%20and%20OR%20statements%20to%20check%20if%20a%20cell%20contains%20%222022%22%20or%20%26amp%3Bquot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3415600%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1398582%22%20target%3D%22_blank%22%3E%40Leo084250428%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EChange%20SEARCH(I2%2C%222022%22)%20to%20SEARCH(%222022%22%2CI2)%20etc.%3C%2FP%3E%0A%3CP%3ESlightly%20shorter%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DIF(OR(ISNUMBER(FIND(%7B%222020%22%2C%222021%22%2C%222022%22%7D%2CI2)))%2C%22y%22%2C%22n%22)%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

=IF(OR(ISNUMBER(SEARCH(I2,"2022")), ISNUMBER(SEARCH(I2,"2021")), ISNUMBER(SEARCH(I2,"2020"))),"y","n")

 

Not working, it always returns "n"

1 Reply

@Leo084250428 

Change SEARCH(I2,"2022") to SEARCH("2022",I2) etc.

Slightly shorter:

 

=IF(OR(ISNUMBER(FIND({"2020","2021","2022"},I2))),"y","n")