Count unique with multiple columns and criteria

anglais428

Well-known Member
Joined
Nov 23, 2009
Messages
634
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I am looking for a formula to analyze a data table to pull results into a new table (see below). The formula will need to count unique items in one column, with criteria in two other columns. In the example below, in the "expected results" table the value for X in 2012 is 3 because there are three unique occurrences of the Company name for the Location X and Year 2012 (these are A,B,C). This could be achieved with a normal COUNTIFS formula. The difficulty is for example for Location Z in 2012. Company D appears twice in Location Z, Year 2012 but I would like it only to be counted as 1 (i.e. unique counts only).

1579698766549.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.
can you post your real data ranges and table names?
 
Upvote 0
How about
Book1
ABCDEFGHIJ
1LocationYearLocation201220132014
2x2013x311
3x2012y100
4x2012z200
5x2012
6z2012
7y2012
8x2014
9z2012
List
Cell Formulas
RangeFormula
H2:J4H2=COUNTIFS($B$2:$B$9,$G2,$C$2:$C$9,H$1)
 
Upvote 0
Hi Fluff,

Thanks for your reply. However, it is missing the key component (column A) as this is what I need to be unique counts. I have been trying variations of SUMIF(Frequency(IF but not getting very far.
 
Upvote 0
Missed that part, how about

Book1
ABCDEFGHIJ
1LocationYearLocation201220132014
2ax2013x311
3ax2012y100
4bx2012z100
5cx2012
6dz2012
7ey2012
8cx2014
9dz2012
List
Cell Formulas
RangeFormula
H2:J4H2{=SUM(--(FREQUENCY(IF(($B$2:$B$9=$G2)*($C$2:$C$9=H$1),MATCH($A$2:$A$9,$A$2:$A$9,0)),ROW($A$2:$A$9)-ROW($A$2)+1)>0))}
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
Hi Fluff,
is there any way not to use Array Formula and still count unique values with criteria?

Thanks!
 
Upvote 0
is there any way not to use Array Formula and still count unique values with criteria?
What version of Excel do you have?

I suggest that you update 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.
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,537
Members
449,316
Latest member
sravya

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