Counting duplicates in Excel

前端 未结 9 719
有刺的猬
有刺的猬 2020-12-08 07:30

I have a list of postcodes that includes duplicates. I would like to find out how many instances of each postcode there are.

For example I would like this:

相关标签:
9条回答
  • 2020-12-08 07:51

    I don't know if it's entirely possible to do your ideal pattern. But I found a way to do your first way: CountIF

    +-------+-------------------+
    |   A   |         B         |
    +-------+-------------------+
    | GL15  | =COUNTIF(A:A, A1) |
    +-------+-------------------+
    | GL15  | =COUNTIF(A:A, A2) |
    +-------+-------------------+
    | GL15  | =COUNTIF(A:A, A3) |
    +-------+-------------------+
    | GL16  | =COUNTIF(A:A, A4) |
    +-------+-------------------+
    | GL17  | =COUNTIF(A:A, A5) |
    +-------+-------------------+
    | GL17  | =COUNTIF(A:A, A6) |
    +-------+-------------------+
    
    0 讨论(0)
  • 2020-12-08 07:51

    This can be done using pivot tables. See this youtube video for a walkthrough: Quickly Count Duplicates in Excel List With Pivot Table.

    To count the number of times each item is duplicated in an Excel list, you can use a pivot table, instead of manually creating a list with formulas.

    0 讨论(0)
  • 2020-12-08 07:53

    You can achieve your result in two steps. First, create a list of unique entries using Advanced Filter... from the pull down Filter menu. To do so, you have to add a name of the column to be sorted out. It is necessary, otherwise Excel will treat first row as a name rather than an entry. Highlight column that you want to filter (A in the example below), click the filter icon and chose 'Advanced Filter...'. That will bring up a window where you can select an option to "Copy to another location". Choose that one, as you will need your original list to do counts (in my example I will choose C:C). Also, select "Unique record only". That will give you a list of unique entries. Then you can count their frequencies using =COUNTIF() command. See screedshots for details.

    Hope this helps!

      +--------+-------+--------+-------------------+
      |   A    |   B   |   C    |         D         |
      +--------+-------+--------+-------------------+
    1 | ToSort |       | ToSort |                   |
      +--------+-------+--------+-------------------+
    2 |  GL15  |       | GL15   | =COUNTIF(A:A, C2) |
      +--------+-------+--------+-------------------+
    3 |  GL15  |       | GL16   | =COUNTIF(A:A, C3) |
      +--------+-------+--------+-------------------+
    4 |  GL15  |       | GL17   | =COUNTIF(A:A, C4) |
      +--------+-------+--------+-------------------+
    5 |  GL16  |       |        |                   |
      +--------+-------+--------+-------------------+
    6 |  GL17  |       |        |                   |
      +--------+-------+--------+-------------------+
    7 |  GL17  |       |        |                   |
      +--------+-------+--------+-------------------+
    

    0 讨论(0)
  • 2020-12-08 07:56

    Step 1: Select top cell of the data

    Step 2 : Select Data > Sort.

    Step 3 : Select Data >Subtotal

    Step 4 : Change use function to "count" and click OK.

    Step 5 : Collapse to 2

    0 讨论(0)
  • 2020-12-08 07:57

    Say A:A contains the post codes, you could add a B column and put a 1 in each cell. In C1, put =SUMIF(A:A, A1, B:B) and Drag it down your sheet. That would give you the first desired result listed in your question.

    EDIT: As Corey pointed out, you can just use COUNTIF(A:A, A1). As I mentioned in the comments you can copy paste special the row with formulas to hard code the counts, the select column A and click remove duplicates (entire row) to get your ideal result.

    0 讨论(0)
  • 2020-12-08 08:04

    If you are not looking for Excel formula, Its easy from the Menu

    Data Menu --> Remove Duplicates would alert, if there are no duplicates

    Also, if you see the count and reduced after removing duplicates...

    0 讨论(0)
提交回复
热议问题