+ Reply to Thread
Results 1 to 10 of 10

count the same values

Hybrid View

ABBOV count the same values 09-09-2010, 12:08 PM
DonkeyOte Re: count the same values 09-09-2010, 01:13 PM
Marcol Re: count the same values 09-09-2010, 02:00 PM
ABBOV Re: count the same values 09-09-2010, 04:37 PM
Marcol Re: count the same values 09-09-2010, 02:36 PM
DonkeyOte Re: count the same values 09-09-2010, 02:39 PM
Marcol Re: count the same values 09-09-2010, 02:46 PM
DonkeyOte Re: count the same values 09-09-2010, 02:49 PM
Marcol Re: count the same values 09-09-2010, 07:09 PM
DonkeyOte Re: count the same values 09-10-2010, 02:46 AM
  1. #1
    Registered User
    Join Date
    07-26-2010
    Location
    NL
    MS-Off Ver
    Excel 2016
    Posts
    74

    count the same values

    Hello,

    I.ve got a small problem, maybe someone can help.

    In a column i've got the values shown beneath.
    Col AM
    ROW 1 xxxxxxxcxxcxccxcccxxxxxxx
    ROW 2 xcccccxccccxccccxcxcccccx
    ROW 3 xcxxxcxcxxccxcxxccxcxxxcx

    I''m looking for a formula that counts the value "x"until the value "c".

    So,
    A1, counts the first set of "x" .
    B1, counts the second set of "x"
    C1, 3th set of "x"
    this would be repeated with max 10 colums

    The outcome will be something like this:

    Column A B C D E F G H
    ROW 1 ) 7 2 1 1 7
    ROW 2 ) 1 1 1 1 1 1
    ROW 3 ) 3 1 2 1 2 1 3 1


    Anyone an idea?

    Thanks in advance.

    ABBOV
    Attached Files Attached Files
    Last edited by ABBOV; 09-09-2010 at 04:38 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: count the same values

    Based on your sample - using the rows - I'd be inclined to keep a count of the number of items to be retrieved:

    AO12:
    =SUMPRODUCT(--(MID(AM12&REPT("c",RIGHT(AM12)="x"),ROW($1:$25),2)="xc"))
    copied down to AO36
    With the above in place - in terms of replicating your expected results

    C12:
    =IF((9-COLUMNS($C12:C12))>$AO12,"",($L12="x")+FIND("^^",SUBSTITUTE($AM12&REPT("c",$AJ12="x"),"xc","^^",1+COUNT($B12:B12)))-FIND("^^",SUBSTITUTE(REPT("c",$L12="x")&$AM12,"cx","^^",1+COUNT($B12:B12))))
    copied across matrix C12:J36
    note there is an error in your sample - row 23 should be 2 2 4 1 2 rather than 2 2 1 4 1 2

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: count the same values

    Here's a method using various formulae, paste special, transpose and text to columns.

    You might be able to do a better job with the vertical values.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Registered User
    Join Date
    07-26-2010
    Location
    NL
    MS-Off Ver
    Excel 2016
    Posts
    74

    Re: count the same values

    Quote Originally Posted by Marcol View Post
    Here's a method using various formulae, paste special, transpose and text to columns.

    You might be able to do a better job with the vertical values.
    Thanks Marcol,

    That does the trick.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: count the same values

    DonkeyOte

    Should your formula not allow for 13 values per row?

    I found 9 values in row 33.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: count the same values

    Marcol, I don't understand the question

    I was just looking to ape the expected results in the sample provided - ie capped at 7 "streaks" (C:J) per row
    (there are 10 in row 33)

    edit: I see A:B do store values after all... I didn't bother to check .. my bad.
    Last edited by DonkeyOte; 09-09-2010 at 02:41 PM.

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: count the same values

    DonkeyOte

    My logic is if alternating cells are black then there will be a maximum of 13 "x" values

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: count the same values

    There are only 10 columns available.

    J36:
    =IF((11-COLUMNS($A36:J36))>$AO36,"",($L36="x")+FIND("^^",SUBSTITUTE($AM36&REPT("c",$AJ36="x"),"xc","^^",1+COUNT($A36:I36)))-FIND("^^",SUBSTITUTE(REPT("c",$L36="x")&$AM36,"cx","^^",1+COUNT($A36:I36))))
    copied up and over matrix A12:J36
    (reason for copying right to left being the dynamic COUNT range and Col A)

  9. #9
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: count the same values

    The real trick is to develope DonkeyOtes' formulae to cover all eventualities.

    I'm not a whizz-kid with formulae, so I posted a step-by-step procedure.

    Developing Dons' solution would give you a "live" solution that would update as you changed the values in your grid, something my solution fails to do.

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: count the same values

    In truth I think you should go for whatever route makes sense and you prefer

    FWIW - I appreciate my approach might not be the easiest to implement given ranges etc so attached is my version.

    I have added the vertical section also - though like the horizontal results I have 1 discrepancy which is that in Col M the result should be 8 rather than 9 1's (expected results implied 9)

    As per the sample file the first 10 frequencies are returned - should you have more then they are not reported (this is per the setup of your file).
    Attached Files Attached Files

+ 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