How to get count of unique values of column B for each unique value of column A in Excel 2010?

I have an excel sheet containing 72,000 rows in Excel 2010, column A is "site name", column B is category. I want a result that shows number of sites for each category.
Column A Column B
site 1 Category 1
Site 1 Category 1
Site 2 Category 1
site 3 Category 2
site 3 Category 2
site 4 Category 2
site 5 Category 2
I want this result:
Category 1    2
Category 2    3
I tried some formula in a 3rd column and created a pivot table on that column, but it did not give me the result i want.
Any one has an idea ? what is the easiest way to achieve this?
Appreciate any pointer

I tried both formula referenced in these two post (I think they are a little simpler than the one above):
http://stackoverflow.com/questions/11876238/simple-pivot-table-to-count-unique-values
http://stackoverflow.com/questions/18898138/pivot-table-count-unique-values-excel-2010
They both worked! and I got the result for my 72,000 rows!
Thanks for your help!

Similar Messages

  • How to get count of rows for a table?

    Hi,
    How to get count of rows for a table and secondly, how can i have access to a particular cell in a table?
    Regards,
    Devashish

    Hi Devashish,
    WdContext.node<Your_node_name>().size() will give you the no: of rows.
    This should be the node that is bound to the table's datasource property.
    WdContext.node<Your_node_name>().get<node_name>ElementAt(index_value); will select the row at that particular index.
    You can access an attribute of a particular row as
    WdContext.node<Your_node_name>().get<node_name>ElementAt(index_value).get<attribute_name>();
    Hope this helps,
    Best Regards,
    Nibu.
    Message was edited by: Nibu Wilson

  • How to get count,index and compare to arraylists

    hi
    how to get count,index and comparing of 2 arraylist.... plz suggest me asap...

    How is your question related to JDBC? And what have you done so far with your code?

  • How to get the list of users who has access for list of tcodes.

    How to get the list of users who has access for list of tcodes.

    Go to transaction SUIM, this has a number of reports for users/authorisations
    open the Where used>Autorization Values>In Users
    and double click to execute
    in authorisation object, enter S_TCODE
    then press the "Enter Values" button
    It will offer entry boxes to put the transaction code you are interesed in.
    Then execute and the list of users with access to this transaciton code will be returned.

  • HT1711 When I load one of my own CD's onto itunes, it creates separate albums for each unique pairing (ie: singer/composer or singer/orchestra). How can I keep all the cuts together on one album?

    When I load one of my own cd's onto itunes, it creates separate albums for each unique pairing (ie: singer/composer or singer/orchestra). I end up with
    the cuts scattered over several albums.  How do I keep all the cuts on an album together rather than divided between several albums? I'm brand new with this technology, so I need your information in simple terms.  Thank-you.

    Generally all you need to do is fill in an appropriate Album Artist. For more details see my article on Grouping Tracks Into Albums, in particular the topic One album, too many covers.
    The site could do with updating as some options have changed with iTunes 11, but the principles are the same.
    tt2

  • How to compare the value node of a for-each-group with other for-each-group

    Hello!
    I have a report in Oracle BI Publisher (10.1.3.2) with several data set. My XML schema is something like
    <DATA>
    <PARAMETERS>
    <MY_PARAMETERS>
    <A_ID>12345</A_ID>
    <DESCRIPTION>ABC</DESCRIPTION>
    <VALUE>111111</VALUE>
    </MY_PARAMETERS>
    <MY_PARAMETERS>
    <A_ID>12345</A_ID>
    <DESCRIPTION>DEF</DESCRIPTION>
    <VALUE>222222</VALUE>
    </MY_PARAMETERS>
    <MY_PARAMETERS>
    <A_ID>67890</A_ID>
    <DESCRIPTION>ABC</DESCRIPTION>
    <VALUE>333333</VALUE>
    </MY_PARAMETERS>
    </PARAMETERS>
    <NAMES>
    <MY_NAMES>
    <A_ID>12345</A_ID>
    <NAME>ASDF</NAME>
    </MY_NAMES>
    <MY_NAMES>
    <A_ID>67890</A_ID>
    <NAME>EFGH</NAME>
    </MY_NAMES>
    </NAMES>
    <VALUES>
    <MY_VALUES>
    <A_ID>12345<A_ID>
    <VALUE>10987</VALUE>
    <DESCRIPTION>ASDFG</DESCRIPTION>
    </MY_VALUES>
    <MY_VALUES>
    <A_ID>12345<A_ID>
    <VALUE>26385</VALUE>
    <DESCRIPTION>EFGHI</DESCRIPTION>
    </MY_VALUES>
    <MY_VALUES>
    <A_ID>67890<A_ID>
    <VALUE>24355</VALUE>
    <DESCRIPTION>ASDFG</DESCRIPTION>
    </MY_VALUES>
    </VALUES>
    </DATA>
    I'm trying to build a rtf template in Word using this XML schema. The "A_ID" nodes in each group in my data have the same value. I want for each "A_ID" take the respective values in /DATA/VALUES/MY_VALUES.
    <?for-each-group:MY_PARAMETERS;./A_ID?>
    <?for-each:current-group()?>
    <?choose:?><?when: DESCRIPTION='ABC'?>
    <?VALUE?>
    <?end when?><?end choose?>
    <?end for-each?>
    <?for-each:current-group()?>
    <?choose:?><?when: DESCRIPTION='DEF'?>
    <?VALUE?>
    <?end when?><?end choose?>
    <?end for-each?>
    <?/DATA/NAMES/MY_NAMES/VALUE?>
    <?for-each-group:/DATA/VALUES/MY_VALUES;./A_ID?>
    <?for-each:current-group()?>
    <?choose:?><?when: DESCRIPTION='ASDFG'?>
    <?VALUE?> <---------------- I obtain for this node the '24355' and '10987' values
    <?end when?><?end choose?>
    I want to know how to obtain only '24355' value, this is, the value for A_ID (/DATA/VALUES/MY_VALUES) = A_ID (/DATA/PARAMETERS/MY_PARAMETERS).
    Can someone help me?

    CREATE OR REPLACE TRIGGER "TEST_TRG"
       BEFORE UPDATE OF "STATUS"
       ON "TABLE1"
       FOR EACH ROW
    BEGIN
       IF (:NEW.status = 'HOLD')
       THEN
          INSERT INTO table2
                      (status
               VALUES (:NEW.status
       END IF;
    END;You should learn how to write PL/SQL code.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • How to get the document path of the pictures uploaded for products?

    Hi Gurus,
    How to get the document path of the pictures uploaded for products uploaded through tcode COMMPR01?
    Many Thanks,
    Neeraj

    client path.
    I need to get the client path in order to download files form server to client.
    Best regards,
    Huy.

  • I need to show grouped id and only the max order value for each unique id

    select distinct 
    Table1.id,
    Table1.id +' - '+ Table1.VisitNumber +' : '+ Table1.Priority as UidVisitKey,
    Table1.VisitNumber,
    DATEDIFF(d, [dob],[Visite_dte])/365.25 as Age_On_Visit,
    Table1.Priority,
    Table1.OrderOfVisit,
    Table1.OrderOfVisit + ' - ' + Table1.Notes AS VisitNote, 
    Table1.Visitor_FName,
    Table1.Visitor_SName,
    Table2.dob,
    Table2.sex,
    Table1.Visit_dte,
    into #Temp1
    FROM         Table1 INNER JOIN
                Table2 ON Table1.id = Table2.id
    WHERE Table1.LeaveDate IS NOT NULL 
    and Table1.LeaveDate  between DATEADD(mm,-1,DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)) 
    and DATEADD(ms,-3,DATEADD(mm,0,DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0))) 
    select #Temp1.id, max(#Temp1.[OrderOfVisit]), #Temp1.VisitNote 
    from #Temp1
    group by #Temp1.id, #Temp1.OrderOfVisit, #Temp1.[VisitNote]
    ORDER BY #Temp1.id
    drop table #Temp1
    ---I need to show grouped id and only the max OrderOfVisit for each unique id, and the VisitNote for each OrderOfVisit
    ----------------need help-------------

    Sounds like this
    select distinct
    Table1.id,
    Table1.id +' - '+ Table1.VisitNumber +' : '+ Table1.Priority as UidVisitKey,
    Table1.VisitNumber,
    DATEDIFF(d, [dob],[Visite_dte])/365.25 as Age_On_Visit,
    Table1.Priority,
    Table1.OrderOfVisit,
    Table1.OrderOfVisit + ' - ' + Table1.Notes AS VisitNote,
    Table1.Visitor_FName,
    Table1.Visitor_SName,
    Table2.dob,
    Table2.sex,
    Table1.Visit_dte,
    into #Temp1
    FROM Table1 INNER JOIN
    Table2 ON Table1.id = Table2.id
    WHERE Table1.LeaveDate IS NOT NULL
    and Table1.LeaveDate between DATEADD(mm,-1,DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0))
    and DATEADD(ms,-3,DATEADD(mm,0,DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)))
    select id,OrderOfVisit,VisitNote
    from
    select #Temp1.id, #Temp1.[OrderOfVisit], #Temp1.VisitNote,ROW_NUMBER() OVER (PARTITION BY #Temp1.id ORDER BY #Temp1.[OrderOfVisit] DESC) AS Seq
    from #Temp1
    )t
    WHERE Seq = 1
    ORDER BY id
    drop table #Temp1
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to display more than one column with for each

    Hi guys,
    how to display more than one column with for each like below?
    for each
    Item1
    Item2
    Item3
    Item4
    Item5
    Item6
    Item7
    Item8
    Item9
    Item10
    End for each
    for each          
    Item1     Item2     Item3
    Item4     Item5     Item6
    Item7     Item8     Item9
    Item10          
    End for each

    Take a look at this to see if the solution provided would work for you: https://blogs.oracle.com/xmlpublisher/entry/multi_column_row_woes
    Won't you have more than 10 records in your data file ? If you are going to have only 10 items then you may be able to use position() function to limit it to 3 each..
    Take a look at this: https://blogs.oracle.com/xmlpublisher/entry/turning_rows_into_columns
    Thanks,
    Bipuser

  • How to get COUNT of  Invoice No and  Sales Order No from Multiprovider

    Hello Guys,
    I have a scenario like below. I have 2 info cubes (1) Billing Item Info cube (2) Sales Order Item Infocube which stores Item level data in infocube. I created Multiprovider for these Sales Order Item Cube and Billing Item Info cube.
    Now in My Multiprovider, Invoice No and Sales Order No gets repeated no of times because one Invoice and One order will have no of Materials. I have a requirement to count Total No of Billing Document and Total No of Sales Document for a Day in the BEx Report. I was thinking to use COUNT function but if Sales Document or Billing Document gets repeated then it will count those records which i don't want. correct me if i am wrong. 
    How to get Total no of Billing Document and Total no of Sales Document from a Multiprovider where i have Item level data is stored ?
    Regards,
    Komik Shah
    Edited by: Komik Shah on Aug 20, 2011 5:33 PM

    Hi,
    Count can be achieved as per the following document. Create for Billing Doc and Sales Doc separately.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/009819ab-c96e-2910-bbb2-c85f7bdec04a
    Regards,
    Suman

  • How to get count of records inserted and errored out in an email

    Hi
    I have following question
    I want to send report statics of scenario i.e Number of rows inserted during the scenario and
    Number of rows in error in the scenario in an email.Here in my scenario I am trying to insert data into Essbase database and when i try to use getNbInserts() and getNbErrors functions of ODI in an email body,its giving zero value even though there 140 records inserted and 10 errored out.Can any one let me know how we get this number of records inserted and number of records errored in email.
    Thanks in advance
    Regards
    Baji

    Hi
    I have following question
    I want to send report statics of scenario i.e Number of rows inserted during the scenario and
    Number of rows in error in the scenario in an email.Here in my scenario I am trying to insert data into Essbase database and when i try to use getNbInserts() and getNbErrors functions of ODI in an email body,its giving zero value even though there 140 records inserted and 10 errored out.Can any one let me know how we get this number of records inserted and number of records errored in email.
    Thanks in advance
    Regards
    Baji

  • How to get count of a resultSet?

    Hi, everyone,
    Could anybody please tell me how to get the count of how many records in a resultSet? I went through the Java API for ResultSet, there is no such method in it.
    Thanks.

    Hi,
    I personnally simply use an INT variable which I increment during the loop, something like this :
    int nbRows = 0;
    while (rs.next()) {
    // do your rs.getXXX stuff here
    nbRows++;
    System.out.println("Total Nr of rows : "+nbRows);
    nbRows++. But there might be another better method for this ?
    You could also use an SQL Request like select count(*) or something, but this would be too much expensive for the performance (an additional statement, Result Set, SQL Query etc...).
    Hope this helps
    Alan

  • How to get count for missing month

    I created a view as follows:
    CREATE OR REPLACE FORCE VIEW "Vinfection1" ("MONTH", "COUNT") AS
    select "MONTH","COUNT" from (
    select to_char(s.pdate,'Mon-yyyy') as month, count(*) as count
    from surproc s, diagnosis_surproc d
    where s.surprocid = d.surprocid and d.diagnosisid in ('506', '507', '508', '509', '510')
    group by to_char(pdate,'Mon-yyyy'))
    order by to_date(month,'Mon-yyyy')
    Some months are missing in the view. I want to put that month and 0 in the view. How to do it?
    Thanks,
    Jennifer

    Hi, Jennifer,
    You need to outer-join to some table or result set (such as all_months, below) that has one roe per month.
    Here's one way:
    CREATE OR REPLACE FORCE VIEW Vinfection1 (month, month_s, cnt) AS
    WITH    all_months     AS
         SELECT  ADD_MONTHS (first_month, LEVEL - 1)     AS month
         FROM     (
                  SELECT  TRUNC (MIN (pdate), 'MONTH')     AS first_month
                  ,         TRUNC (MAX (pdate), 'MONTH')     AS last_month
                  FROM    surproc
         CONNECT BY     LEVEL <= 1 + MONTHS_NETWEEN (last_month, first_month)
    SELECT  a.month
    ,     TO_CHAR (a.month, 'Mon-yyyy')     AS month_s
    ,     COUNT (*)                 AS cnt
    FROM              all_months      a
    LEFT OUTER JOIN      (     surproc               s
                   JOIN   diagnosis_surproc      d  ON   s.surprocid     = d.surprocid
                                          AND  d.diagnosisid     IN ('506', '507', '508', '509', '510')
               )     ON  a.month     = TRUNC (s.pdate)
    GROUP BY  a.month
    /Avoid table- and column names that are non-standatrd (such as names that need double-quotes), or are built-in function names (such as COUNT).
    Don't use ORDER BY in a view. Almost anything you do with the view will cause the ordering to be lost anyway.
    Even if you do have an ORDER BY clause in the view, you'll often want to ORDER BY month. Rather than call TO_DATE whenever you need to sort, I suggest having two month columns; month (whcih is a DATE) for sorting, filtering and joining, and month_s (whcih is a VARCHAR2) for displaying.
    Use ANSI join syntax, especiallly for outer joins.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.
    Edited by: Frank Kulash on Mar 20, 2012 12:03 PM
    Added outer join condition

  • How to get count of group of current login user if AD Group is added in SharePoint Group?

    My Client has 2 SharePoint Application. For the AD Users they have created AD Group and added users in that AD Group as per requirement. Later AD Group is added in SharePoint Group. When I'm trying to fetch Current User Group count, I can able to get the
    count of Groups using below statement.
    int groupCount = SPContext.Current.Web.CurrentUser.Groups.Count;
    Above Statement, returns always 0 value if I tried with User who are added in AD Group and if I add AD User and then it will return the exact count.
    Please suggest solution to get Count of Group of Current User. My Application contains more than 60 SharePoint group.

    Hello,
    I believe your code doesn't count those AD group users until they login at least once. If this is the case then try to use "SPUtility.GetPrincipalsInGroup" as suggested in below post:
    http://stackoverflow.com/questions/4314767/getting-members-of-an-ad-domain-group-using-sharepoint-api
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Delete statement: how to get count of affected rows in a variable

    Hi folks
    I write a proc which deletes data from bunch of table based on data value. i want to produce a report which will have 1 line for each table like:
    Del: Table name : number of rows
    I parse delete statement into variable and use execute immediate. I know I could precede delete by select count(*) using the same criteria. Is there any more effective way to catch output from execution of 'delete' itself to avoid an overhead of running select count(*)?
    Thank you, Gene.

    Gene,
    I thought you said you wanted to have the number of rows deleted. In that case, see Sänjay's example above.
    Btw, is there a particular reason that you are using EXECUTE IMMEDIATE (?)
    To have it in a variable
    declare
       v_rows_deleted  number;
    begin
       delete from emp;
       v_rows_deleted := SQL%ROWCOUNT;
    end ;Regards
    Peter
    Edited by: Peter on Jul 23, 2009 7:48 AM
    Added example

Maybe you are looking for