How do you write this logic?
If cell c2 contains the words "ABC", then 1, else 0.
I know IF(xxx,1,0) I just dont know how to write the formula to check whether a cell contains ABC.
thanks
How do you write this logic?
If cell c2 contains the words "ABC", then 1, else 0.
I know IF(xxx,1,0) I just dont know how to write the formula to check whether a cell contains ABC.
thanks
=IF(A1="ABC","Yes","No")
Something like this.
"To a man with a hammer everything looks like a nail." - Mark Twain
If you need a case sensitive test =EXACT(A1,"abc"), 1, 0)
Last edited by mikerickson; 12-21-2012 at 10:35 PM.
For example, if the cell contains "ABC,HELLO,XYZ" (3 items in 1 cell) then how to write a formula that says If this cell contains "ABC" then give me a 1, else 0.
EXACT compares strings for likeness (Matching) where you can compare two cell values against each other or compare the cell value against a known value
It needs to be written either as
=EXACT(A1,B1) , to compare cells or
=EXACT("abc",A1), to compare a cell against a predetermined value.
The results will be True or False.
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Maybe something like this =IF(FIND(B1,A1,1),1,0) or =NOT(ISERROR(SEARCH(B1,A1)))
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)
Use
=--ISNUMBER(FIND("ABC",A1))
case sensitive
=--ISNUMBER(SEARCH("ABC",A1))
not case sensitive
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Does this return a 1 or 0 Bob?
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Yes the double unary coerces the TRUE/FALSE result.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber