PDA

View Full Version : How do you create this logic?



doctortt
12-21-2012, 01:36 PM
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

david000
12-21-2012, 02:14 PM
=IF(A1="ABC","Yes","No")

Something like this.

mikerickson
12-21-2012, 09:58 PM
If you need a case sensitive test =EXACT(A1,"abc"), 1, 0)

doctortt
12-21-2012, 11:03 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.

Aussiebear
12-21-2012, 11:09 PM
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.

Simon Lloyd
12-22-2012, 01:29 AM
Maybe something like this =IF(FIND(B1,A1,1),1,0) or =NOT(ISERROR(SEARCH(B1,A1)))

Bob Phillips
12-22-2012, 03:24 AM
Use

=--ISNUMBER(FIND("ABC",A1))
case sensitive

=--ISNUMBER(SEARCH("ABC",A1))
not case sensitive

Aussiebear
12-22-2012, 05:14 AM
Does this return a 1 or 0 Bob?

Bob Phillips
12-22-2012, 09:56 AM
Yes the double unary coerces the TRUE/FALSE result.