Count unique values across multiple columns ignore blanks

xlxllama

New Member
Joined
Feb 24, 2021
Messages
2
Office Version
  1. 365
Platform
  1. MacOS
From the following example data set I need to count the number of chemicals that appear at least once in the selected range, but not their duplicates, and ignore any blank cells. I know the answer for this set should be 21, but I can't figure out how to create a formula to give me that answer. All of the examples of counting unique values I can find are only for a single column.
Ethylhexyl phthalateBPA
EthylbenzeneStyrenePhenolAntimonyArsenic
EthylbenzeneStyrenePhenolEthylhexyl diphenyl phosphateEthylhexanoic acidAntimonyArsenic
EthylbenzeneStyrene4-NPAcrylonitrileEthylene glycolToluenePhenolDINPFormaldehydeAntimonyArsenicCobaltAcetaldehydePhthalic anhydrideBBPTris phosphate
TolueneStyrenePhenolCobalt
AntimonyArsenic
EthylbenzeneTolueneStyreneEthylene glycolDecabromodiphenyl ethane
AntimonyArsenicCobalt
StyreneEthylene glycolCobalt
EthylbenzeneStyrene4-NPAcrylonitrileEthylene glycolToluenePhenolTris phosphateDINPFormaldehydeAntimonyArenicCobaltAcetaldehydePhthalic anhydrideBBP
Ethylbenzene
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
How about this?

Book4
ABCDEFGHIJKLMNOP
1Ethylhexyl phthalateBPA
2EthylbenzeneStyrenePhenolAntimonyArsenic
3EthylbenzeneStyrenePhenolEthylhexyl diphenyl phosphateEthylhexanoic acidAntimonyArsenic
4EthylbenzeneStyrene4-NPAcrylonitrileEthylene glycolToluenePhenolDINPFormaldehydeAntimonyArsenicCobaltAcetaldehydePhthalic anhydrideBBPTris phosphate
5TolueneStyrenePhenolCobalt
6AntimonyArsenic
7EthylbenzeneTolueneStyreneEthylene glycolDecabromodiphenyl ethane
8AntimonyArsenicCobalt
9StyreneEthylene glycolCobalt
10EthylbenzeneStyrene4-NPAcrylonitrileEthylene glycolToluenePhenolTris phosphateDINPFormaldehydeAntimonyArenicCobaltAcetaldehydePhthalic anhydrideBBP
11Ethylbenzene
12
13
144-NP
15Acetaldehyde
16Acrylonitrile
17Antimony
18Arenic
19Arsenic
20BBP
21BPA
22Cobalt
23Decabromodiphenyl ethane
24DINP
25Ethylbenzene
26Ethylene glycol
27Ethylhexanoic acid
28Ethylhexyl diphenyl phosphate
29Ethylhexyl phthalate
30Formaldehyde
31Phenol
32Phthalic anhydride
33Styrene
34Toluene
35Tris phosphate
36Total Chemicals: 22
Sheet1
Cell Formulas
RangeFormula
A14:A36A14=LET(tbl,A1:P11,r,ROWS(tbl),seq,SEQUENCE(r*COLUMNS(tbl),,0),sc,INDEX(tbl,MOD(seq,r)+1,INT(seq/r)),uc,SORT(UNIQUE(FILTER(sc,sc<>0,""))),IFERROR(INDEX(uc,SEQUENCE(ROWS(uc)+1)),"Total Chemicals: " & COUNTA(uc)))
Dynamic array formulas.
 
Upvote 0
I know the answer for this set should be 21
It's actually 22 (one of them might be a typo, but in formula terms it is still different).
Edit range as required. This will need to be array confirmed with Ctrl Shift Enter if you don't have the dynamic array update.
Excel Formula:
=SUM(IFERROR(1/COUNTIF(A1:P11,A1:P11),0))
 
Upvote 0
Solution
This work! Thanks!
It's actually 22 (one of them might be a typo, but in formula terms it is still different).
Edit range as required. This will need to be array confirmed with Ctrl Shift Enter if you don't have the dynamic array update.
Excel Formula:
=SUM(IFERROR(1/COUNTIF(A1:P11,A1:P11),0))
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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