+ Reply to Thread
Results 1 to 4 of 4

Number of different items in a column

  1. #1
    sam.fares@cmcsg.com
    Guest

    Number of different items in a column

    How do i write a macro that will tell me how many different items in
    one column?

    lets say i have all the information in column"A". this information will
    be such as these marks "J1","J2","J3" and so on. but J1 or J2 and so on
    could repeate in the cells of that column.

    how do you write a macro that will help determine how many different
    marks in that column?. Thanks alot!


  2. #2
    Bob Phillips
    Guest

    Re: Number of different items in a column

    You don't need a macro

    =SUMPRODUCT((A1:A1000<>"")/COUNTIF(A1:A1000,A1:A1:A1000&""))

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    <sam.fares@cmcsg.com> wrote in message
    news:1110397442.285892.162650@g14g2000cwa.googlegroups.com...
    > How do i write a macro that will tell me how many different items in
    > one column?
    >
    > lets say i have all the information in column"A". this information will
    > be such as these marks "J1","J2","J3" and so on. but J1 or J2 and so on
    > could repeate in the cells of that column.
    >
    > how do you write a macro that will help determine how many different
    > marks in that column?. Thanks alot!
    >




  3. #3
    sam.fares@cmcsg.com
    Guest

    Re: Number of different items in a column

    Thank you Bob so much!

    is SUMPRODUCT or Countif an Excel Function? please explain it to me


  4. #4
    Bob Phillips
    Guest

    Re: Number of different items in a column

    They are both Excel worksheet functions.

    COUNTIF counts the number of instances of a value in a range. SUMPRODUCT
    adds all of the values in an array (but can also manage multiplying
    different arrays).

    What it is doing is to for each non-blank cell in the range, it divides each
    instance by the number of instances, and then ads them up. SO for instance,
    if they are 3 instances of a particular item, it evaluates each instance to
    1/3, so when added it gets 1. similarly, 2 instances evaluate to 1/2, again
    adding up to 1. In this way, each multiple occurrence is summed as 1,
    facilitating the counting of the unique items.



    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    <sam.fares@cmcsg.com> wrote in message
    news:1110406151.307169.51360@o13g2000cwo.googlegroups.com...
    > Thank you Bob so much!
    >
    > is SUMPRODUCT or Countif an Excel Function? please explain it to me
    >




+ 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