If, And Countif - Help with Multiple Conditions

Bigbudgie

New Member
Joined
Mar 10, 2016
Messages
2
Hello,
I was hoping someone could please help with a multiple conditions formula?

I am trying to use two criteria to produce a result, I was initially using "IF and OR" but because I was using postcodes and was trying to match on the first two characters am now using SUM(COUNTIF {** **} as I understand I cannot use wild cards in this situation.

The formula I am currently using is:
=IF(SUM(COUNTIF(C2,{"*BN*", "*TN*"})), "Yes"","No")

This matches if the cell contains either of the above prefixes in the cell (part of the postcode),

Works great but I now want to add a second criteria or to add a second condition from another cell " If another cell contains for example "Oranges", so the new conditions would need to be "oranges" and "BN" to show "Yes", this is where I am stuck and am looking to hopefully get some help.


Many thanks
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Are you now only looking for BN, rather than BN or TN?
 
Upvote 0
how about?

=if(AND(OR(LEFT(C2,2)="BN",LEFT(C2,2)="TN"),C3="Oranges"),"Yes","No")

with the 'another cell' in C3
 
Last edited:
Upvote 0
(Untested)

How about this method to add second condition
=IF(SUM(COUNTIF(C2,{"*BN*", "*TN*"})),IF(D2="Oranges", "Yes","No"))
- amend second IF condition to meet required criteria
OR
=IF(AND(
SUM(COUNTIF(C2,{"*BN*", "*TN*"})),D2="Oranges"),"Yes","No")

 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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
Back
Top