ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   IF question (https://www.excelbanter.com/excel-discussion-misc-queries/239786-if-question.html)

Alyssa

IF question
 
I am attempting an IF lookup for a list of cells that have letters in them. I
know how to say IF the cell equals (=) a certain letter, but is there a way
to say IF the cell contains a certain letter?

Dave Peterson

IF question
 
=if(isnumber(search("a",a1)),"A1 contains an a","nope")

If you want to match case, then use =Find() instead of =search()

And another way if you don't care about upper/lower case:
=if(countif(a1,"*a*")0,"yep","nope")


Alyssa wrote:

I am attempting an IF lookup for a list of cells that have letters in them. I
know how to say IF the cell equals (=) a certain letter, but is there a way
to say IF the cell contains a certain letter?


--

Dave Peterson

Luke M

IF question
 
You'll want to use either FIND (case-sensitive) or SEARCH(non-case-sensitive)

For instance, if A1 = "This is a test"
and A2 = "is"
=IF(ISNUMBER(SEARCH(A2,A1)),"Text found","Not found"
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Alyssa" wrote:

I am attempting an IF lookup for a list of cells that have letters in them. I
know how to say IF the cell equals (=) a certain letter, but is there a way
to say IF the cell contains a certain letter?



All times are GMT +1. The time now is 08:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com