Countif, based on two criteria

DougStroud

Well-known Member
Joined
Aug 16, 2005
Messages
2,976
Office Version
  1. 365
Platform
  1. MacOS
I am attempting to count a word based on another criteria.
Countif the text string is "Doug Stroud" in range e1-g900, if Range D:D = "First Place"
This attempt: "=COUNTIF(D:D, "First Place", E1:G900 = "Doug Stroud")" errors with too many arguments.

Thank you
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Which version of Excel are you using? Unless you have a really old one, you should have the COUNTIFS function (note the plural), which allows for multiple criteria.

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’)
 
Upvote 0
Which version of Excel are you using? Unless you have a really old one, you should have the COUNTIFS function (note the plural), which allows for multiple criteria.

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’)
I am on 16.84 (24041420), and just updated this in my profile
 
Upvote 0
I am on 16.84 (24041420), and just updated this in my profile
Great, then you should be all set, as it looks like Excel 365 for the Mac does have that function.
 
Upvote 0
I made a couple edits to my function: =COUNTIFS(D:D, "First Place", E1:G900,"Doug Stroud")
Now I get #VALUE! as my result. I have checked my spelling and all seems correct. Attached is a screenshot of the range and cell contents.
 

Attachments

  • Screenshot 2024-05-07 at 2.56.51 PM.png
    Screenshot 2024-05-07 at 2.56.51 PM.png
    99.6 KB · Views: 7
Upvote 0
How about
Excel Formula:
=LET(a,TOCOL(FILTER(E1:G900,D1:D900="first place")),ROWS(FILTER(a,a="Doug Stroud")))
 
Upvote 1
Solution
Whoops, I missed that your ranges are not the same size. For COUNTIFS, your ranges must be the same size, and your second criteria is looking at multiple columns.
Try Fluff's suggestion instead.
 
Upvote 1
A variation. Edited.
Excel Formula:
=SUM(--(FILTER(E1:G900,D1:D900="First Place")="Doug Stroud"))
 
Upvote 1
Thank you Fluff, that worked perfectly! Although, if you or Joe don't mind looking at the Countifs function why that isn't returning a value I'd appreciate it. Your solution is a bit over my head at the moment.
 
Upvote 0
Thank you Fluff, that worked perfectly! Although, if you or Joe don't mind looking at the Countifs function why that isn't returning a value I'd appreciate it. Your solution is a bit over my head at the moment.
I mentioned why in my previous post - the multiple ranges you are comparing MUST be the exact same size.

So if the range in your first criteria was exactly 1 column and 900 rows, the range for your other criteria would also have to be exactly one column and 900 rows.
This is specified in the link I provided:

1715109625177.png
 
Upvote 1

Forum statistics

Threads
1,224,811
Messages
6,181,080
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