IF statement on two MATCH results

kyleno

Board Regular
Joined
Jun 9, 2014
Messages
61
I have three columns:

E: ContainsL
F: ContainsR
G: Match

ContainsL:
=MATCH("*"&LEFT(B2,5)&"*",C2,0)

ContainsR:
=MATCH("*"&RIGHT(B2,5)&"*",C2,0)

Match:
=IF(E2+F2=2,"Yes", IF(E2+F2=1,"Yes","No"))
-----------------------------------------------------
ContainsL and ContainsR returns either a "1" or "#N/A"

I would like the Match column to read Yes IF the sum of ContainsL and ContainsR equals EITHER 1 or 2, No if it does not, but the #N/A value complicates this.


To get around the #N/A issue I know that I should be using the IF(ISNA(F2),"Yes","No")) (or something similar) formula but I'm not sure how to nest it properly.


Please help.

Thanks.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
You could use COUNTIF with wildcards to avoid the #N/A:

BCDEFG
1ContainsLContainsRMatch
2abcdefghijkxxxabcdeyyfghijkyyyzz11Yes
3xxxxxyyaaxxxxxzz10Yes
4aabbbbxxabbbbzz01Yes
5abcdesomethingelse00No
600No

<tbody>
</tbody>
Sheet7

Worksheet Formulas
CellFormula
E2=COUNTIF(C2,"*"&LEFT(B2,5)&"*")
F2=COUNTIF(C2,"*"&RIGHT(B2,5)&"*")
G2=IF(E2+F2>0,"Yes","No")

<tbody>
</tbody>

<tbody>
</tbody>


If you want to stick with the MATCH formulas, try this in G2:

=IF(COUNT(E2:F2),"Yes","No")
 
Last edited:
Upvote 0
You could use COUNTIF with wildcards to avoid the #N/A:

B
C
D
E
F
G
1
ContainsL
ContainsR
Match
2
abcdefghijk
xxxabcdeyyfghijkyyyzz
1
1
Yes
3
xxxxxyy
aaxxxxxzz
1
Yes
4
aabbbb
xxabbbbzz
1
Yes
5
abcde
somethingelse
No
6
No

<tbody>
</tbody>
Sheet7


Worksheet Formulas
Cell
Formula
E2
=COUNTIF(C2,"*"&LEFT(B2,5)&"*")
F2
=COUNTIF(C2,"*"&RIGHT(B2,5)&"*")
G2
=IF(E2+F2>0,"Yes","No")

<tbody>
</tbody>

<tbody>
</tbody>


If you want to stick with the MATCH formulas, try this in G2:

=IF(COUNT(E2:F2),"Yes","No")

That worked! Thanks Eric!
 
Upvote 0

Forum statistics

Threads
1,215,453
Messages
6,124,927
Members
449,195
Latest member
Stevenciu

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