Distinct values with multiple criteria

john-paul

New Member
Joined
Nov 23, 2008
Messages
34
Office Version
  1. 365
Platform
  1. Windows
Hi,

I need a formula that can count distinct number customers (ie: count each customer only once), for each combination of Division and Order Value Tier.

So for the combination of:
Division = East
Order Value Tier = 0 - 100k
Result = 3
So it counts ACME once, ABC once and XYZ.


Thanks John

CustomerDivisionOrder Value Tier
ACMEEast0 - 100k
ACMEEast0 - 100k
ABCEast0 - 100k
ABCEast0 - 100k
XYZEast0 - 100k
ACMEEast100k - 500k
ACMEEast100k - 500k
ABCEast100k - 500k
XYZEast100k - 1M
ACMEWest0 - 100k
ABCWest100k - 500k
XYZWest100k - 500k
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
  • For more Clarification, please upload example with XL2BB add-in (Preferable) OR upload at free hosting site e.g. GoogleDrive, OneDrive, Dropbox and Insert Link at post.
  • Please update your Account details, so we know what Excel version(s) & platform(s) you are using as the best solution often varies by version.
 
Upvote 0
You need to update your account details
see if this helps,

Book2
ABC
1CustomerDivisionOrder Value Tier
2ACMEEast0 - 100k
3ACMEEast0 - 100k
4ABCEast0 - 100k
5ABCEast0 - 100k
6XYZEast0 - 100k
7ACMEEast100k - 500k
8ACMEEast100k - 500k
9ABCEast100k - 500k
10XYZEast100k - 1M
11ACMEWest0 - 100k
12ABCWest100k - 500k
13XYZWest100k - 500k
14
15
16CustomerWestOrder Value Tier
17ACMEWest0 - 100k
18ABCWest100k - 500k
19XYZWest100k - 500k
Sheet1
Cell Formulas
RangeFormula
A17:A19A17=IFERROR(INDEX($A$2:$A$13, MATCH(0, IF($B$17=$B$2:$B$13, COUNTIF($A$16:$A16, $A$2:$A$13), ""), 0)),"")
B17:B19B17=$B$16
C17:C19C17=IFERROR(INDEX($C$2:$C$13,MATCH(1,(A17=$A$2:$A$13)*(B17=$B$2:$B$13),0)),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Try this With CTRL+SHIFT+ENTER:
Book1
ABCDEFGHI
1CustomerDivisionOrder Value TierDivisionOrder Value TierCountif
2ACMEEast0 - 100kEast0 - 100k3
3ACMEEast0 - 100kEast100k - 500k2
4ABCEast0 - 100kWest0 - 100k1
5ABCEast0 - 100kWest100k - 500k2
6XYZEast0 - 100k
7ACMEEast100k - 500k
8ACMEEast100k - 500k
9ABCEast100k - 500k
10XYZEast100k - 1M
11ACMEWest0 - 100k
12ABCWest100k - 500k
13XYZWest100k - 500k
14
15
16
Sheet1
Cell Formulas
RangeFormula
H2:H5H2=SUM(IF((G2=$C$2:$C$13)*($B$2:$B$13=F2), 1/COUNTIFS($A$2:$A$13, $A$2:$A$13, $B$2:$B$13, $B$2:$B$13, $C$2:$C$13,$C$2:$C$13), 0))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Solution
D4E4F4
East0 - 100k3

Data in A2:C13
ARRAY formula in F4, to be confirmed with Ctrl+Shift+Enter keys together.

=SUM(IFERROR(1/(MMULT(1*(IF(($C$2:$C$13=E4)*($B$2:$B$13=D4),$A$2:$A$13,"")=TRANSPOSE(IF(($C$2:$C$13=E4)*($B$2:$B$13=D4),$A$2:$A$13,"X"))),1*(ROW($A$2:$A$13)>0))),0))
 
Upvote 0
Thank you all for your help.

Solutions by maabadi and kvsrinivasamurthy both worked - really appreciate the help.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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