+ Reply to Thread
Results 1 to 4 of 4

occurence /count of a cell value in a column/range

  1. #1
    Registered User
    Join Date
    10-15-2008
    Location
    India
    Posts
    11

    occurence /count of a cell value in a column/range

    Hi,

    I need to find to the occurrence/count of a cell value in a column/range.

    Like say column A has following values

    A12
    A12
    A12
    A12
    A13
    A13
    A14
    A14 and so on ..

    I need to find the no. of times or count A12 is there in the column A.

    I have tried using .count function in the range A but this instead gives the number of cells in complete range A


    see the code iam trying
    Please Login or Register  to view this content.
    here i want to get the count of A12 in x which is not happening

    Please help

    Thanks,
    Ankur

  2. #2
    Forum Contributor wamp's Avatar
    Join Date
    11-10-2008
    Location
    Norway
    MS-Off Ver
    97, 2000 & 2003 (diff. workstations)
    Posts
    184
    I may be on to the totally wrong ida here but what if you in an empty cell type
    Please Login or Register  to view this content.
    ?

  3. #3
    Registered User
    Join Date
    10-15-2008
    Location
    India
    Posts
    11
    Hi,

    I have used the countif function as suggested but its not solving the purpose

    iam using the code below

    count= WorksheetFunction.CountIf(Range("A1:A100"), "reference")
    where reference is the variable having multiple occuences in column A
    like
    TD123
    TD123
    TD123

    etc

    However the above count returns 1 only where Iam expecting it to return 3 occurences.

    Please help
    Many Thanks,
    Ankur

  4. #4
    Registered User
    Join Date
    10-15-2008
    Location
    India
    Posts
    11
    Hi,

    I think i got the solution i was doing a mistake by putting variable in the " " .

    now i have corrected it to the following code and its working fine.

    count = WorksheetFunction.CountIf(Range("A1:A100"), reference)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1