IF AND Formula with multiple conditions

thomassharp

Board Regular
Joined
Dec 10, 2014
Messages
84
Hi,I am trying to use IF formula to show whether a row of cells matches:

DogDogDogFishNear Match
DogDogFishFishPartial Match
CatPigFishDogNo Match
PigPigPigPigFull Match

<colgroup><col width="64" span="5" style="width:48pt"> </colgroup><tbody>
</tbody>

I have tried =IF(A2=B2,"Partial Match","No Match")IF(AND(A2=B2,A2=C2),"Near Match","No Match"))
But obviously this doesn't work.

Very interested in the logic of the syntax needed here...

Thanks!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi,

For the first row ( A2 to D2)

Ctrl+Shift+Enter Not just Enter

=CHOOSE(COUNT(FIND(A2,A2:D2)),"No Match","Partial Match","Near Match","Full Match")
 
Upvote 0
I thank you. How does the formula know if the conditions have been met? Is it counting how many are cells are equal in the range and then needs an ascending list at the end ? So if we put full match in the middle it wouldn't work?
 
Upvote 0
Hello, I would do:

=+IF(AND(A1=B1,A1=C1,A1=D1),"Full Match",IF(OR(AND(A1=B1,A1=C1),AND(D1=B1,A1=D1),AND(C1=B1,B1=D1),AND(C1=A1,A1=D1)),"Near Match",IF(OR(A1=B1,A1=C1,A1=D1,B1=C1,B1=D1,C1=D1),"Partial Match","No Match")))

Hope it helps, is a long formula but it works ok.

Regards,
 
Upvote 0
You could count the matches and get a value from 0 to 6:-

Code:
=(A1=B1)+(A1=C1)+(A1=D1)+(B1=C1)+(B1=D1)+(C1=D1)

Or you could select from a number of text values like this:-

Code:
=CHOOSE((A1=B1)+(A1=C1)+(A1=D1)+(B1=C1)+(B1=D1)+(C1=D1)+1,"None","One","Two","Three","Four","Five","Six")

Obviously instead of One, Two, Three, etc, you'd put No matches at all, One match, A couple of matches, Ooh three matches, Four not possible, Five not possible, Great - six matches!

Any use?

R.
 
Upvote 0
another way to avoid choice of a particular word

Ctrl+Shift+Enter Not just Enter
=CHOOSE(MAX(COUNTIF(A2:D2,A2:D2)),"No Match","Partial Match","Near Match","Full Match")
 
Upvote 0
Hello, I would do:

=+IF(AND(A1=B1,A1=C1,A1=D1),"Full Match",IF(OR(AND(A1=B1,A1=C1),AND(D1=B1,A1=D1),AND(C1=B1,B1=D1),AND(C1=A1,A1=D1)),"Near Match",IF(OR(A1=B1,A1=C1,A1=D1,B1=C1,B1=D1,C1=D1),"Partial Match","No Match")))

Hope it helps, is a long formula but it works ok.

Regards,

Thanks. That is what I was trying but couldn't get there
 
Upvote 0

Forum statistics

Threads
1,216,109
Messages
6,128,880
Members
449,477
Latest member
panjongshing

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