Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Number of different items in an entire column without knowing if some of the cells are blank

Hi all:

i posted similar question before but i would like to expand on it.

i have marks(J1,J2,J3,.....) that might repeat in column A, but i would
not know the extent of how many cells in the entire column (65536)cells
will have marks in them. on some projects i might have every cell of
that column has a mark in it,and on some other projects i might have
marks in 10000 cells of that column. it depends on the project.

is there a macro that will tell me how many different marks in that
column, becuse that number will determine the number of my loops.


the way the marks are in column A is

J1
J1
J1
..
..
..
J2
J2
J2
J2
..
..
J3
J3
..

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Number of different items in an entire column without knowing if s

Sam,

You can count the total number of rows being used with the UsedRange method.
Something like the following will tell you the max number of rows being used

lngMaxRows = activesheet.usedrange.rows.count

http://HelpExcel.com

" wrote:

Hi all:

i posted similar question before but i would like to expand on it.

i have marks(J1,J2,J3,.....) that might repeat in column A, but i would
not know the extent of how many cells in the entire column (65536)cells
will have marks in them. on some projects i might have every cell of
that column has a mark in it,and on some other projects i might have
marks in 10000 cells of that column. it depends on the project.

is there a macro that will tell me how many different marks in that
column, becuse that number will determine the number of my loops.


the way the marks are in column A is

J1
J1
J1
..
..
..
J2
J2
J2
J2
..
..
J3
J3
..


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Number of different items in an entire column without knowing if s

Thanks!

i have been able to determine the number of rows in column A that has
marks like J1,J2,.... with this code line:

LastRow = shtQDS.Range("A3").End(xlDown).Row

but i dont know how to write the syntax to tell me how many different
marks between cell A3, columnA and row"LasrRow".

I would appreciate any help with this!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Number of different items in an entire column without knowing if s

that would indicate no blank cells, so

Sub AA()
Dim lastrow As Long
Dim numUnique as Long
lastrow = Range("A3").End(xlDown).Row
numUnique = Evaluate("Sumproduct(1/countif(A3:A" & lastrow & _
",A3:A" & lastrow & "))")
MsgBox "Number of uniques: " & numUnique
End Sub

Regards,
Tom Ogilvy



wrote in message
oups.com...
Thanks!

i have been able to determine the number of rows in column A that has
marks like J1,J2,.... with this code line:

LastRow = shtQDS.Range("A3").End(xlDown).Row

but i dont know how to write the syntax to tell me how many different
marks between cell A3, columnA and row"LasrRow".

I would appreciate any help with this!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Number of different items in an entire column without knowing if s

Thanks Tom! I will try it



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Number of different items in an entire column without knowing if s

Tom:

when i tried it , it gave a run-time error 13, type mismatch after
trying to move on from the line where "numUnique" is and the next line.

what does seem to be the error? Thanks!

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
Knowing the number sadman49 Excel Discussion (Misc queries) 2 March 9th 09 09:15 PM
How do I count the items in one column if another column is blank dereksmom Excel Worksheet Functions 1 November 8th 06 11:34 PM
how to calculate the number of non blank cells from any column? Mahesh Excel Worksheet Functions 2 August 8th 06 01:14 PM
Easiest way to delete blank cells in column (not entire row) sramsey Excel Discussion (Misc queries) 4 February 16th 06 04:28 PM
Delete Entire Row If Column C is Blank John Excel Programming 5 July 19th 04 10:23 PM


All times are GMT +1. The time now is 09:58 PM.

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

About Us

"It's about Microsoft Excel"