Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need a formula, not VB code, to count the number of unique values in a column of up to 10,000 rows, some of which will be blank. The values may be numeric, alphanumberic, or text.
The twist is that the formula can't use either the SUMPRODUCT or the FREQUENCY functions. The excel handler which processes the file for a database can't handle SUMPRODUCT or FREQUENCY. I got very close with this array formula: =SUM(1/COUNTIF(A1:A36,A22:A36)) But as you can see it has to be limited to the range of nonblank cells, since it throws a #DIV/0 error if the range includes blank cells. I've made some unsuccessful attempts at using COUNTIFS with criteria for only nonblank cells. Any ideas? Thanks in advance! pete |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi,
=COUNTIF(A1:A65535,A1:A65535)-1 isabelle Le 2016-08-04 Ã* 09:24, pete a écrit : I need a formula, not VB code, to count the number of unique values in a column of up to 10,000 rows, some of which will be blank. The values may be numeric, alphanumberic, or text. The twist is that the formula can't use either the SUMPRODUCT or the FREQUENCY functions. The excel handler which processes the file for a database can't handle SUMPRODUCT or FREQUENCY. I got very close with this array formula: =SUM(1/COUNTIF(A1:A36,A22:A36)) But as you can see it has to be limited to the range of nonblank cells, since it throws a #DIV/0 error if the range includes blank cells. I've made some unsuccessful attempts at using COUNTIFS with criteria for only nonblank cells. Any ideas? Thanks in advance! pete |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Pete,
Am Thu, 4 Aug 2016 06:24:17 -0700 (PDT) schrieb pete: I need a formula, not VB code, to count the number of unique values in a column of up to 10,000 rows, some of which will be blank. The values may be numeric, alphanumberic, or text. try: =SUM(IF(A1:A36<"",1/COUNTIF(A1:A36,A1:A36))) and insert the formula with CTRL+Shift+Enter Regards Claus B. -- Windows10 Office 2016 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Pete,
Am Thu, 4 Aug 2016 17:40:47 +0200 schrieb Claus Busch: =SUM(IF(A1:A36<"",1/COUNTIF(A1:A36,A1:A36))) if you have a lot of rows the array formula is very slow. Try this UDF: Function UniqueVals(myRng As Range) As Long Dim myDic As Object Dim varTmp As Variant, varData As Variant Dim i As Long, Counter As Long Set myDic = CreateObject("Scripting.Dictionary") varTmp = myRng For i = LBound(varTmp) To UBound(varTmp) myDic(varTmp(i, 1)) = varTmp(i, 1) Next varData = myDic.items For i = LBound(varData) To UBound(varData) If varData(i) < "" Then Counter = Counter + 1 Next UniqueVals = Counter End Function Call it in the worksheet with =UniqueVals(A1:A10000) Regards Claus B. -- Windows10 Office 2016 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thursday, August 4, 2016 at 8:30:43 AM UTC-7, isabelle wrote:
hi, =COUNTIF(A1:A65535,A1:A65535)-1 isabelle Le 2016-08-04 Ã* 09:24, pete a écrit : I need a formula, not VB code, to count the number of unique values in a column of up to 10,000 rows, some of which will be blank. The values may be numeric, alphanumberic, or text. The twist is that the formula can't use either the SUMPRODUCT or the FREQUENCY functions. The excel handler which processes the file for a database can't handle SUMPRODUCT or FREQUENCY. I got very close with this array formula: =SUM(1/COUNTIF(A1:A36,A22:A36)) But as you can see it has to be limited to the range of nonblank cells, since it throws a #DIV/0 error if the range includes blank cells. I've made some unsuccessful attempts at using COUNTIFS with criteria for only nonblank cells. Any ideas? Thanks in advance! pete Thanks Isabelle! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thursday, August 4, 2016 at 8:40:51 AM UTC-7, Claus Busch wrote:
Hi Pete, Am Thu, 4 Aug 2016 06:24:17 -0700 (PDT) schrieb pete: I need a formula, not VB code, to count the number of unique values in a column of up to 10,000 rows, some of which will be blank. The values may be numeric, alphanumberic, or text. try: =SUM(IF(A1:A36<"",1/COUNTIF(A1:A36,A1:A36))) and insert the formula with CTRL+Shift+Enter Regards Claus B. -- Windows10 Office 2016 Thanks Claus! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula for counting frequency then sorting | Excel Worksheet Functions | |||
Counting the number of unique values within a range | Excel Discussion (Misc queries) | |||
Counting Unique Values by Date Range | Excel Worksheet Functions | |||
Counting unique values + frequency | Excel Worksheet Functions | |||
Counting Unique Entries Wit a Twist | Excel Programming |