counting cells containing specific text

ceds

New Member
Joined
Jul 30, 2010
Messages
27
Hi,

I am trying to write a formula so that if three cells contain specific text, a number one will be put in a certain column.

For example:
Cell A1 contains an A
Cell B1 contains a B
Cell C1 contains a B

What formula would I need so that if this pattern exists a number 1 would appear in cell E1 for example?

Many thanks if you can help!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Weaver

Well-known Member
Joined
Sep 10, 2008
Messages
5,196
I'd like to think there's a more elegant way (probably using array formula) but this appears to do the job:

=--AND(NOT(ISERROR(FIND("A",A1))),NOT(ISERROR(FIND("B",B1))),NOT(ISERROR(FIND("B",C1))))

If there's a match you get a 1, if all 3 conditions are not met, a zero is returned.

HTH
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,456
Hi ceds, welcome to the board.
I doubt your example is as simple as the real desire, but how about this to start? (In E1)
Code:
=(A1="A")*(B1="B")*(C1="B")
This will return a 1 in E1 if all are true, or a zero if all are not.

That help at all?
 

ceds

New Member
Joined
Jul 30, 2010
Messages
27
That's great, thanks both of you - both solutions will definitely help with what I'm looking to do.

Thanks again!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,628
Messages
5,838,447
Members
430,549
Latest member
jayjay2022

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top