Another IF AND OR Question

Robby19

Board Regular
Joined
Mar 19, 2018
Messages
227
I can never wrap my head around why these don't work for me. :mad:

If Position = Defender or Goalkeeper AND G = 0, then show 1 if not show 0
Code:
=IF(AND(OR([@Position]="*Defender*",[@Position]="Goalkeeper"),[@G]=0),1,0)
Also tried
Code:
=IF(OR(AND([@G]=0),[@Position]="*Defender*",[@Position]="Goalkeeper"),1,0)
This one seems to work better, however it still changes for other positions too.

Before you laugh at me, please tell me where I went wrong.
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
IF doesn't support the use of wildcards (as in "*Defender*"). So,

[@Position]="*Defender*"

will always evaluate to FALSE.
 
Upvote 0
That is unfortunate, as some of the positions are named Midfielder/Defender or vice versa. Is there a formula that could do that same thing I wanted that allows the wildcards?
 
Upvote 0
Try:
Code:
=IF(AND(OR(COUNTIF([@Position],"*Defender*")>0,[@Position]="Goalkeeper"),[@G]=0),1,0)
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,693
Members
449,048
Latest member
81jamesacct

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