Good afternoon
i am looking for to return one of 3 values depending on another cell value. If the reference cell is populated and contains a certain string, say AB, I would like my target cell to say one thing, eg "hello", if the string doesn't contain AB then I'd like it to say Bye, if the reference has no string or entries in it I'd like my target not to populated. I am struggling a little bit with this. Can anybody please assist?
Many thanks Darren.
If formula evaluating a string
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: If formula evalutating a string
This should do what you need:
=IF(A1="","",IF(A1="AB","Hello","Bye"))
=IF(A1="","",IF(A1="AB","Hello","Bye"))
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: If formula evalutating a string
Let's say the reference cell is D5. If you want to return "hello" if D5 equals "AB":
=IF(D5="", "", IF(D5="AB", "hello", "bye"))
If you want the formula to return "hello" if the value of D5 contains "AB", possibly among other text:
=IF(D5="", "", IF(ISNUMBER(SEARCH("AB", D5)), "hello", "bye"))
=IF(D5="", "", IF(D5="AB", "hello", "bye"))
If you want the formula to return "hello" if the value of D5 contains "AB", possibly among other text:
=IF(D5="", "", IF(ISNUMBER(SEARCH("AB", D5)), "hello", "bye"))
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 315
- Joined: 04 May 2010, 15:18
Re: If formula evalutating a string
Thank you Rudi it's not quite right, I think my explanation wasn't too clear, I mean if my string contains AB, together. Ie 1234AB454545
Thanks
Thanks
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: If formula evaluating a string
Ah... I translated, "contains a certain string" incorrectly. Apologies! You could have expressed it as, "a string contains AB".
Hans's second formula will get the job done!
Hans's second formula will get the job done!
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.