COUNTIF only counting for unique entries

RodneyC

Active Member
Joined
Nov 4, 2021
Messages
278
Office Version
  1. 2016
Platform
  1. Windows
I need to modify this formula =COUNTIF(WO!G:G,"*BHM*") so that it also looks in WO!A:A for unique entries and only reports back the total number of times some form of BHM appears in column G but only counts it once for each unique entry in column A.

For example if

WO!A:A contains the value banana 147 times and there are 36 times that corresponding value in WO!G:G contain the value BHM
WO!A:A contains the value grape 21 times and there are 19 times that corresponding value in WO!G:G contains the value BHM

then the results of the formula would show 2

Thanks in advance
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
One addition... It should only count if WO!M:M is greater than 0

Thanks again
 
Upvote 0
You could try something like this:
This is an array formula and must be entered with CTRL-SHIFT-ENTER.
Also, you can't use the whole columns as a reference or you will get an error msg "Out of Resources".
I used rows 1 to 500,000 in this example.

Book2
AFGMNOP
1BananaBHM1Count2
2BananaBHM2
3BananaRRR0
4BananaBHM0
5grapeBHM1
6grapeZZZ0
7grapeBHM0
8BananaBHM0
9AppleBHM0
10
Sheet1
Cell Formulas
RangeFormula
P1P1=SUM(IF(FREQUENCY(IF(G1:G500000="BHM",IF(G1:G500000<>"",IF(M1:M500000>0,MATCH(A1:A500000&"/"&G1:G500000,A1:A5000&"/"&G1:G500000,0)))),ROW($A1:A500000)-ROW($A$1)+1),1))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Thanks. I've had a swamped day and haven't had tome to look at this. I'll try over the weekend, but most likely on Monday. Thanks again
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,576
Members
448,972
Latest member
Shantanu2024

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