Count Unique values from a column based on criteria

igorteo

New Member
Joined
Nov 21, 2019
Messages
5
Hello everyone,

I'm facing a problem of counting unique values in one column, based on multiple criteria. I want to count the unique Part Numbers from column "C" in "M3" cell if the "K2" cell is equal to some of the records in column "A"
I have tried SUMPRODUCT, COUNTIFS, FREQUENCY, but I'm doing something.

A​
BCD
E​
FGHIJKLMNO
TRACKING #LOCATION NAMEPART NUMBERNOMENCLATURE UNIT PRICE QTYUNIT OF ISSUECOST POST APPROVEDDATE
SHIPPED
TRACKING #LOCATION NAMELINE ITEMSTOTAL PRICEDATE SHIPPED
TK-44582LONDON650-985BOLT,MACHINE $ 3.764EA$15.0419-Mar-20TK-44582LONDON7$1,912.3919-Mar-20
TK-44582LONDON900-123STRAP,TIE DOWN,ELECTR $ 2.467HD$17.2219-Mar-20TK-44583LONDON8$721.6719-Mar-20
TK-44582LONDON850-658HOSE,PREFORMED $ 21.733EA$65.1919-Mar-20
TK-44582LONDON700-325HARDWARE KIT,ELECTRON $ 7.897EA$55.2319-Mar-20
TK-44582LONDON850-658HINGE,DOOR,VEHICULAR $ 108.693EA$326.0719-Mar-20
TK-44582LONDON650-985SPACER,SLEEVE $ 37.847PG$264.8819-Mar-20
TK-44582LONDON700-325ARM,STEERING GEAR $ 154.257EA$1,079.7519-Mar-20
TK-44582LONDON900-123GAGE ROD,LIQUID LEVEL $ 9.893EA$29.6719-Mar-20
TK-44582LONDON100-552GAGE ROD,LIQUID LEVEL $ 9.893EA$29.6719-Mar-20
TK-44582LONDON400-567GAGE ROD,LIQUID LEVEL $ 9.893EA$29.6719-Mar-20
TK-44583LONDONUM4639040CINSULATOR ENGINE $ 13.075EA$65.3519-Mar-20
TK-44583LONDONUD2D-51-150-FLAMP RR RH 2010 $ 32.266EA$193.5619-Mar-20
TK-44583LONDONUH74 32280END ASSY TIE ROD OUTER $ 14.308EA$114.4019-Mar-20
TK-44583LONDONUH74-34-155BRACKET STABILIZER BUSH FRONT $ 4.902EA$9.8019-Mar-20
TK-44583LONDONUH74-34-156BUSH STABILIZER BAR FROMT $ 2.573EA$7.7119-Mar-20
TK-44583LONDONWL8113ZA5TAFILTER FUEL $ 10.761EA$10.7619-Mar-20
TK-44583LONDONUH74 32280END ASSY TIE ROD OUTER $ 14.306EA$85.8019-Mar-20
TK-44583LONDONSA67-25-06XAJOINT UNIVERSAL AXLE DRIVE $ 62.691EA$62.6919-Mar-20
TK-44583LONDON1235478END ASSY TIE ROD OUTER $ 14.3012EA$171.6019-Mar-20
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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
These formulas should do it (noting @Peter_SSs's caveat on your Excel version) if you have a relatively recent version:

Book1
ABCDEFGHIJKLMNO
1TRACKING #LOCATION NAMEPART NUMBERNOMENCLATUREUNIT PRICEQTYUNIT OF ISSUECOST POST APPROVEDDATE SHIPPEDTRACKING #LOCATION NAMELINE ITEMSTOTAL PRICEDATE SHIPPED
2TK-44582LONDON650-985BOLT,MACHINE$3.76 4EA$15.04 19/03/2020TK-44582LONDON10$1,912.39 19/03/2020
3TK-44582LONDON900-123STRAP,TIE DOWN,ELECTR$2.46 7HD$17.22 19/03/2020TK-44583LONDON9$721.67 19/03/2020
4TK-44582LONDON850-658HOSE,PREFORMED$21.73 3EA$65.19 19/03/2020
5TK-44582LONDON700-325HARDWARE KIT,ELECTRON$7.89 7EA$55.23 19/03/2020
6TK-44582LONDON850-658HINGE,DOOR,VEHICULAR$108.69 3EA$326.07 19/03/2020
7TK-44582LONDON650-985SPACER,SLEEVE$37.84 7PG$264.88 19/03/2020
8TK-44582LONDON700-325ARM,STEERING GEAR$154.25 7EA$1,079.75 19/03/2020
9TK-44582LONDON900-123GAGE ROD,LIQUID LEVEL$9.89 3EA$29.67 19/03/2020
10TK-44582LONDON100-552GAGE ROD,LIQUID LEVEL$9.89 3EA$29.67 19/03/2020
11TK-44582LONDON400-567GAGE ROD,LIQUID LEVEL$9.89 3EA$29.67 19/03/2020
12TK-44583LONDONUM4639040CINSULATOR ENGINE$13.07 5EA$65.35 19/03/2020
13TK-44583LONDONUD2D-51-150-FLAMP RR RH 2010$32.26 6EA$193.56 19/03/2020
14TK-44583LONDONUH74 32280END ASSY TIE ROD OUTER$14.30 8EA$114.40 19/03/2020
15TK-44583LONDONUH74-34-155BRACKET STABILIZER BUSH FRONT$4.90 2EA$9.80 19/03/2020
16TK-44583LONDONUH74-34-156BUSH STABILIZER BAR FROMT$2.57 3EA$7.71 19/03/2020
17TK-44583LONDONWL8113ZA5TAFILTER FUEL$10.76 1EA$10.76 19/03/2020
18TK-44583LONDONUH74 32280END ASSY TIE ROD OUTER$14.30 6EA$85.80 19/03/2020
19TK-44583LONDONSA67-25-06XAJOINT UNIVERSAL AXLE DRIVE$62.69 1EA$62.69 19/03/2020
20TK-44583LONDON1235478END ASSY TIE ROD OUTER$14.30 12EA$171.60 19/03/2020
Sheet1
Cell Formulas
RangeFormula
M2:M3M2=COUNTIFS(A:A,K2,I:I,O2)
N2:N3N2=SUMIFS(H:H,A:A,K2,I:I,O2)
 
Upvote 0
These formulas should do it
I think you may have missed ..
I want to count the unique Part Numbers ...


Here are two suggestions.
Column M requires Excel 365 with the new dynamic array functions.
Column N for older versions.
(I've highlighted cells for my own benefit to show which part numbers should be counted)

20 03 19.xlsm
ABCJKLMN
1TRACKING #LOCATION NAMEPART NUMBERTRACKING #LOCATION NAMELINE ITEMSLINE ITEMS
2TK-44582LONDON650-985TK-44582LONDON66
3TK-44582LONDON900-123TK-44583LONDON88
4TK-44582LONDON850-658
5TK-44582LONDON700-325
6TK-44582LONDON850-658
7TK-44582LONDON650-985
8TK-44582LONDON700-325
9TK-44582LONDON900-123
10TK-44582LONDON100-552
11TK-44582LONDON400-567
12TK-44583LONDONUM4639040C
13TK-44583LONDONUD2D-51-150-F
14TK-44583LONDONUH74 32280
15TK-44583LONDONUH74-34-155
16TK-44583LONDONUH74-34-156
17TK-44583LONDONWL8113ZA5TA
18TK-44583LONDONUH74 32280
19TK-44583LONDONSA67-25-06XA
20TK-44583LONDON1235478
21
Count Unique
Cell Formulas
RangeFormula
M2:M3M2=COUNTA(UNIQUE(FILTER(C$2:C$20,A$2:A$20=K2)))
N2:N3N2=SUMPRODUCT((C$2:C$20<>"")*(A$2:A$20=K2)/COUNTIF(C$2:C$20,C$2:C$20&""))
 
Upvote 0
Thank you so so much. "=SUMPRODUCT((C$2:C$20<>"")*(A$2:A$20=K2)/COUNTIF(C$2:C$20,C$2:C$20&""))" works perfect.

You are the best.

Thanks once again
 
Upvote 0
You're welcome.
Don't forget this so people don't waste time giving you solutions that don't work in your version of Excel.

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.
1584614951202.png
 
Upvote 0
I think you may have missed ..
Yes, I misread the "K3" cell point - I thought the question was how to make M2:N3 into formulas.
The challenges of getting tabular data in a post instead of XL2BB....
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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