How to get unique values from Countifs funcation

petes

Board Regular
Joined
Sep 12, 2009
Messages
168
Name (A Column)Marks (B Column)
John3
John3
John2

The above is my data and have used the following formula. The formula should give the result as "1" instead of "2". Because, John is having same marks in 2 rows. Let me know how to tweak this formula

John (E column)=COUNTIFS(A1:A3,E1,B1:B3,">2")
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Who knows what's in E1? Please post a complete set of examples using XL2BB and change your profile to indicate what version of Excel you are using.
 
Upvote 0
Ok, Please see the sample file attached. The result in B8 should give me 1 instead of 2. Excel version is 16.75 (23070901)

sample.xlsx
AB
1NameMarks
2John3
3John3
4John2
5Mark5
6
7Result
8John2
9Mark1
Sheet2
Cell Formulas
RangeFormula
B8:B9B8=COUNTIFS($A$2:$A$5,A8,$B$2:$B$5,">2")
 
Upvote 0
Your formula calculates that JOHN has 2 entries in column B that are larger than 2. What's incorrect about that? What would the result be 1?
Is version 16.75 a MAC or Windows version? Are you running Excel 365?
 
Upvote 0
If you're using 365, is this what you want?

Book2
ABCDEF
1NameMarksResult
2John3John2
3John3Mark3
4John2
5Mark5
6John10
7Mark5
8Mark5
9Mark3
10Mark3
11Mark100
12Mark1
Sheet1
Cell Formulas
RangeFormula
F2:F3F2=COUNT(UNIQUE(FILTER($B:$B,($A:$A=E2)*($B:$B>2))))
 
Upvote 0
The reason I need 1 in the result because, John has similar entries in 2 rows and hence it should be considered as duplicate and the result should be 1.
Note: There could be more than 2 entries also, in all these case the result should produce 1 because there is only 1 unique entry for John.

The "Filter" function is not valid in my version. Here is the version again:
Microsoft Excel for Mac
Version 16.75 (23070901)
Microsoft 365 Subscription

Thank you
 
Upvote 0
Microsoft 365 Subscription
Please put that information (& platform) in your account details (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’)
The information then shows up all the time at the left of your posts like this:

1692674152907.png


I agree with @kweaver that the FILTER function should be available in 365 for Mac as shown In Microsoft's Help:

1692674278679.png
 
Upvote 0
Sorry, this function works and looks like I got the resolution. Need to check few more things and then mark it as resolved.

Thank again!
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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