+ Reply to Thread
Results 1 to 2 of 2

Finding rows where one column is the same but a second is different

Hybrid View

  1. #1
    Registered User
    Join Date
    04-05-2013
    Location
    Chester
    MS-Off Ver
    Excel 2010
    Posts
    13

    Finding rows where one column is the same but a second is different

    After the roaring success of my last question here I thought I'd try again.

    Basically what I want to do is find rows where

    a) One column is repeated in other rows
    AND
    b) Another column is different to other rows where the first column is the same.

    A) is easy enough using countif.

    What I now want to do is b) but the difficult part is getting it to only look in rows where the column I am looking in for a) is the same and not the whole sheet.

    The value in column B isn't going to be unique to that row so I can't just look down the whole column.
    How can I delimit it to just cells where col A is a duplicate?

    Here's some sample data.

    It's the WhatIWantToDo column I want to fill in. Note that it should show 2 for the apples because there's two lines with 20kg on so one of them shouldn't be counted.
    Note also that the weights are repeated throughout the col but it's only looking at rows where col A is the same so it is spotting them as unique.

    Fruit Weight WhatIWantToDo
    Apples 10kg 2
    Apples 20kg 2
    Apples 20kg 2
    Oranges 10kg 1
    Oranges 10kg 1
    Bananas 10kg 3
    Bananas 20kg 3
    Bananas 30kg 3
    Last edited by HorsePop; 04-17-2013 at 07:19 AM.

  2. #2
    Forum Contributor
    Join Date
    01-07-2013
    Location
    south africa
    MS-Off Ver
    Excel 2003-13
    Posts
    210

    Re: Finding rows where one column is the same but a second is different

    Hello there
    Just to confirm, what I understand is that you want to determine the number of unique records, that are unique through the combination of cols A and B. This answer should be written to all rows that contain the first element of the unique value (i.e. derived from column A)

    One of the non-VBA solutions would be:
    there is a cool function called remove duplicates which is found in the data menu
    select both columns (as you need both values to form unique set) and remove the duplicates
    this will reduce your data
    you can then copy column A data, perhaps to a new sheet
    repeat remove duplicates function which should leave you with just the unique fruit, lets call this unique fruit data
    enter the formula
    =COUNTIF(your list of fruit,cell of 1st unique fruit data)
    copy that formula down to cover all elements of your unique fruit data, ensuring that the list of fruit is static > meaning you keep that range

    Regards
    Most helpful to mark solved items as such (see help for directions). Star ratings are always welcome.

+ 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