Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count unique text in cell range

In the range C5:C123, I want to count the number of times L31, L311, L316,
and L318, and blanks appear, and have the information appear like this:

L31 14
L311 24
L316 45
L318 33
Blank 3
Sum 119 (the total number of cells in the range)

How would this be done?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Count unique text in cell range

Hi,

You should be able to modift this for all your L numbers

="L31 = "&COUNTIF(C5:C123,"L31")

and for the blanks

="Blanks = "&COUNTBLANK(C5:C123)

Mike



"PhilH" wrote:

In the range C5:C123, I want to count the number of times L31, L311, L316,
and L318, and blanks appear, and have the information appear like this:

L31 14
L311 24
L316 45
L318 33
Blank 3
Sum 119 (the total number of cells in the range)

How would this be done?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Count unique text in cell range

Here is my take to use VBA.
Result is printed via Debug.print statement.

Private Sub CountUnique()
Dim rngA As Range
Dim varTXT As Variant
Dim varCNT() As Long
Dim iX As Long
Dim nSUM As Long

varTXT = Array("L31", "L311", "L316", "L318", "")
Set rngA = ActiveSheet.Range("C19:C123")
nSUM = 0
ReDim varCNT(LBound(varTXT) To UBound(varTXT))
For iX = LBound(varTXT) To UBound(varTXT)
varCNT(iX) = WorksheetFunction.CountIf(rngA, varTXT(iX))
If varTXT(iX) = "" Then
Debug.Print iX; "Blank", varCNT(iX)
Else
Debug.Print iX; varTXT(iX), varCNT(iX)
End If
nSUM = nSUM + varCNT(iX)
Next iX
Debug.Print "Sum", nSUM
End Sub

"Mike H" wrote:

Hi,

You should be able to modift this for all your L numbers

="L31 = "&COUNTIF(C5:C123,"L31")

and for the blanks

="Blanks = "&COUNTBLANK(C5:C123)

Mike



"PhilH" wrote:

In the range C5:C123, I want to count the number of times L31, L311, L316,
and L318, and blanks appear, and have the information appear like this:

L31 14
L311 24
L316 45
L318 33
Blank 3
Sum 119 (the total number of cells in the range)

How would this be done?

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
Count unique text shzdug Excel Worksheet Functions 2 February 1st 07 06:16 AM
Count unique if text Mike Fogleman Excel Worksheet Functions 16 January 21st 07 07:47 PM
Count unique items in range Thom Excel Worksheet Functions 4 October 12th 06 01:13 PM
count by specific text color in range of cell Tii99 Excel Discussion (Misc queries) 2 April 4th 06 09:58 AM
Unique count of text Debbie Excel Worksheet Functions 7 January 21st 05 03:53 AM


All times are GMT +1. The time now is 10:27 PM.

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"