COUNTIF alongside an unless or format caveat

Jazz Jones

New Member
Joined
Mar 13, 2017
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Within a sports league, we have a list of player names in columns D and J. I used a countif function to total up the number of matches each player has appeared in, based on how many times their name shows up in these columns and that's fine
Excel Formula:
=COUNTIF(Data!D:J,[@[Player Name]])
However, I've realised that the 'Player of the Match' is also named in these columns (The "POM" name cells are in B and H) and that's throwing my count of as it means their name is used again.
Is there a way that I can run a COUNTIF that excludes anything if the cell two columns before contains 'POM'? Or excludes a name if it is in bold? Example screenshot below for reference (col K just an indicator of the formula in there, but it is working ok). So in the example, Player 5 would be showing as having played two games (correctly), but Players 2 and 6 will also count twice, even though they've only played once each.

1675868913038.png
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Try
Excel Formula:
=COUNTIFS(Data!D:J,[@[Player Name]],Data!B:H,"<>POM")
 
Upvote 0
Solution
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Try
Excel Formula:
=COUNTIFS(Data!D:J,[@[Player Name]],Data!B:H,"<>POM")
It's Excel 365, version 2208. I'll update my details now - thanks for the tip!
And the code has worked! What is it doing? Is is basically saying Count If and then you've added almost a "yes, include" and a "no, don't include" section for each option?

My mind is blown.
 
Upvote 0

Forum statistics

Threads
1,214,881
Messages
6,122,074
Members
449,064
Latest member
MattDRT

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