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/153755-if-question.html)

[email protected]

IF question
 
when doing an IF question and I want to have the Logic Test = a single
word in the cells and have it trigger a true or false..

AC21 says "Office/Retail" i want my formula to only read the
"Office" part of it

=IF(AC21="Office","Yes","No")

I want it to still come up as "Yes" in the new cell but it wont
because cell AC21 also says "/Retail"

so the question is.. how do i get my formula to read just the "Office"
part of cell AC21??

something on the lines of "If AC21 has the word "Office" anywhere in
it then the new cell will = "Yes""


PCLIVE

IF question
 
One way:

=IF(ISERROR(SEARCH("Office",AC21)),"No","Yes")

HTH,
Paul


--

wrote in message
oups.com...
when doing an IF question and I want to have the Logic Test = a single
word in the cells and have it trigger a true or false..

AC21 says "Office/Retail" i want my formula to only read the
"Office" part of it

=IF(AC21="Office","Yes","No")

I want it to still come up as "Yes" in the new cell but it wont
because cell AC21 also says "/Retail"

so the question is.. how do i get my formula to read just the "Office"
part of cell AC21??

something on the lines of "If AC21 has the word "Office" anywhere in
it then the new cell will = "Yes""




Dave O

IF question
 
By nesting a SEARCH function inside the IF, you can do what you need:
=IF(SEARCH("office",AC21,1)0,"Yes","No")

SEARCH looks for the string "office" in cell A21 and returns its
position in the string if it is there, or zero if it is not. SEARCH is
similar to FIND, but SEARCH is not case sensitive, where FIND looks
for an exact case match.

Have a good weekend!
Dave O


Dave O

IF question
 
My error: Paul's kung fu is better. I thought a negative search would
result in zero, as opposed to an error.


[email protected]

IF question
 
Thanks guys!! That worked out great =)



All times are GMT +1. The time now is 02:04 AM.

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