Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Formula to count distinct values not working in VBA

It need to count unique TEXT values in a column. Sorry for the typo. :-)

"ALATL" wrote:

I have this formula that works perfectly in Excel. It counts the unique
values in a column. But it does not work in the VBA editor. Does anyone have
any ideas?

Count = SUMPRODUCT((C6:C39<"")/COUNTIF(C6:C39,C6:C39&""))

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Formula to count distinct values not working in VBA

You can something like:

dim myCount as long

myCount = _
ActiveSheet.Evaluate("SUMPRODUCT((C6:C39<"""")/COUNTIF(C6:C39,C6:C39&""""))")

Subject to the same rules as using =sumproduct() in a worksheet cell.

ALATL wrote:

It need to count unique TEXT values in a column. Sorry for the typo. :-)

"ALATL" wrote:

I have this formula that works perfectly in Excel. It counts the unique
values in a column. But it does not work in the VBA editor. Does anyone have
any ideas?

Count = SUMPRODUCT((C6:C39<"")/COUNTIF(C6:C39,C6:C39&""))


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Formula to count distinct values not working in VBA

Will not work if spaces or range extends beyond data

mycount = Evaluate("SUMPRODUCT(1/COUNTIF(G1:G8,G1:G8))")

--
Don Guillett
SalesAid Software

"ALATL" wrote in message
...
It need to count unique TEXT values in a column. Sorry for the typo. :-)

"ALATL" wrote:

I have this formula that works perfectly in Excel. It counts the unique
values in a column. But it does not work in the VBA editor. Does anyone
have
any ideas?

Count = SUMPRODUCT((C6:C39<"")/COUNTIF(C6:C39,C6:C39&""))



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ignore Hidden Rows and Count of distinct values Anuma (GGK Tech) Excel Worksheet Functions 3 April 13th 10 02:00 AM
Count Distinct Values based on criteria FinChase Excel Worksheet Functions 5 July 8th 09 07:25 PM
Count Distinct Values? bill_morgan Excel Worksheet Functions 7 April 27th 05 02:12 AM
Count Distinct Values by Group Using Pivot Table (NM) MCP Excel Worksheet Functions 3 February 11th 05 09:22 PM
Count distinct Debbie t Excel Worksheet Functions 2 November 3rd 04 08:42 PM


All times are GMT +1. The time now is 01:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"