+ Reply to Thread
Results 1 to 9 of 9

count entries if they do not match previous row

  1. #1
    Registered User
    Join Date
    02-02-2015
    Location
    Lawton, Oklahoma
    MS-Off Ver
    2010
    Posts
    6

    count entries if they do not match previous row

    Hi, I’m trying to make a table that takes data from a spreadsheet as I enter it and puts it in a table. I need to count clients of different demographic groups for analysis, but sometimes we might have several entries for the same client.

    So, I Need a function that Counts
    1) If an entry in Column C=”W”, AND
    2) If an entry on that same row, but in Column B (the client’s ID number) is NOT the same as in the previous row of that same column.

    Attached is an example with the basic info I am trying to analyze. Any help is appreciated 
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: count entries if they do not match previous row

    Two questions,

    1) Is your example provided within the workbook flawed? I am seeing a "B" in the race column instead of a "W" in C21.
    2) Would you allow a helper column if that column can be hidden?
    Spread the love, add to the Rep

    "None of us are as smart as all of us."

  3. #3
    Registered User
    Join Date
    02-02-2015
    Location
    Lawton, Oklahoma
    MS-Off Ver
    2010
    Posts
    6

    Re: count entries if they do not match previous row

    Mcmahobt, yes, I meant to change that cell to a "W" for the example but forgot (whoops). A helper column is a great idea, and I think I can achieve that, but I would prefer not to have a helper column because I might not always be in charge of this spreadsheet. As such, I need everything in this spreadsheet to be apparent to the lay user, with exception to the few functions I need to use. But, if it's not feasible, I might have to use the helper column.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: count entries if they do not match previous row

    I tried with this logic:

    1) Count unique IDs with W. This returns 2

    2) Count unique-distinct-IDs. There are 3 in row 2, 21 and 22

    Final result: count 5

    Array Formula:

    Please Login or Register  to view this content.
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    Quang PT

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: count entries if they do not match previous row

    OK. With your correction as per #3:

    Please Login or Register  to view this content.

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

  6. #6
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: count entries if they do not match previous row

    Slightly different way than bebo's, important to note that both of our solutions are array formulas and entered with CSE:

    Please Login or Register  to view this content.
    Hope this helps!
    Last edited by mcmahobt; 02-03-2015 at 11:56 AM.

  7. #7
    Registered User
    Join Date
    02-02-2015
    Location
    Lawton, Oklahoma
    MS-Off Ver
    2010
    Posts
    6

    Re: count entries if they do not match previous row

    Bebo and Mcmahobt, Thank you! Both work perfectly!

  8. #8
    Registered User
    Join Date
    02-02-2015
    Location
    Lawton, Oklahoma
    MS-Off Ver
    2010
    Posts
    6

    Re: count entries if they do not match previous row

    Bebo and Mcmahobt, Thank you! Both work perfectly!

  9. #9
    Registered User
    Join Date
    02-02-2015
    Location
    Lawton, Oklahoma
    MS-Off Ver
    2010
    Posts
    6

    Re: count entries if they do not match previous row

    If I can add one more problem, I put the code in for all my different demographic groups and now need a cell for clients of mixed race.

    Basically the criteria would be: NOT W, B, NH/PI, AI/AN, Asian, or Blank
    I attached a new example.

    cleintdata.xlsx

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 10-11-2013, 06:02 PM
  2. look up previous entries
    By excel456 in forum Excel General
    Replies: 0
    Last Post: 06-23-2012, 06:38 AM
  3. Replies: 0
    Last Post: 10-14-2011, 12:09 PM
  4. [SOLVED] Match Last Occurrence of Numeric Value and Count BACK to Previous
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-23-2005, 10:20 PM
  5. [SOLVED] Match Last Occurrence of two numbers and Count to Previous Occurence
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 33
    Last Post: 04-04-2005, 10:06 AM

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