Forum Discussion
X128359
Jun 25, 2021Copper Contributor
IF function formula if I want 2 words to return same answer
I need an IF function formula for when I want Excel to return the word "affirmative" if the data are the words "Lima" and "Foxtrot" and return the word"negative" if not. I wanted to start a whole Vlookup but the data is so heavy, I thought maybe IF function will be more appropriate
Here is a formula with IF, as requested.
=IF(COUNTIF(A9,"*Lima*"),"negative",IF(COUNTIF(A9,"*Foxtrot*"),"negative",$A$5))
Also attached is an Excel file with an example.
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.
5 Replies
Sort By
- NikolinoDEGold Contributor
Here is a formula with IF, as requested.
=IF(COUNTIF(A9,"*Lima*"),"negative",IF(COUNTIF(A9,"*Foxtrot*"),"negative",$A$5))
Also attached is an Excel file with an example.
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.
- X128359Copper ContributorI aslo tried your idea! It also worked, a bit longer than Riny but aslo did the trick. Thanks for teaching me something new.. already thinking where else I can apply this solution!
- Riny_van_EekelenPlatinum Contributor
X128359 Not sure if you want to need AND or OR, so see which works for you.
=IF(AND(cell1="Lima",cell2="Foxtrot"),"Affirmative","Negative")
that is, two different cells need to contain the specified words.
alternatively,
=IF(OR(cell="Lima",cell="Foxtrot"),"Affirmative","Negative")
that is, the cell need to contain either of the specified words.
- X128359Copper ContributorStrange, I wanted to list both of your answers as best answers since it was equally effective but it only allowed 1. Figures... No matter what it allows, both are best in my eyes because I'm using them both now
- X128359Copper ContributorYour 2nd suggestion worked very well! Simple and short! Thank you so much! I love learning from experts!