+ Reply to Thread
Results 1 to 14 of 14

Vba count continuous names in a range

  1. #1
    Registered User
    Join Date
    04-22-2013
    Location
    greece
    MS-Off Ver
    Excel 2010
    Posts
    66

    Vba count continuous names in a range

    Hello I need your help.

    I have a sheet with 12 columns B:M. In every col. is written names from B2:M (rows.count). Some names may be repeated. What i want is a macro that will give me the names that continuous repeated in 6 or more columns and also how many times (6, 7 etc)


    Please for you help!!

  2. #2
    Registered User
    Join Date
    04-22-2013
    Location
    greece
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Vba count continuous names in a range

    Hello any help please?

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: Vba count continuous names in a range

    Hi Konexcelmath,

    Let me know how this goes:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  4. #4
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Vba count continuous names in a range

    This VBA code lists names that occur in 6 or more columns in Range("B:M").
    It also gives the number of columns, if 6 or more, in which each name occurs.
    I think this is what you ask for, but ?
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-22-2013
    Location
    greece
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Vba count continuous names in a range

    Thanks Trebor76 & Kalak, for your replies

    Also the 2 codes give me the answer that I want.
    I'm fully satisfied.

    Thanks 100%

  6. #6
    Registered User
    Join Date
    04-22-2013
    Location
    greece
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Vba count continuous names in a range

    Ok, i was quick to say 100%

    Please for your help. Also could we add to count how many different names they resulted.

    For example 1 or 4 or etc.
    Could we make any modification??
    Please???

  7. #7
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Vba count continuous names in a range

    It's not at all clear to me where you're at.

    Try generating some test data, say by the code below and, if this is more or less the structure of your own dataset, list what sort of output you'd like to see.

    If your data structure is different from this, please post an example.

    I note that, on the type of dataset generated by the code below, the two codes answering your opening post, both of which you professed to be happy with, give different results. (????)
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    04-22-2013
    Location
    greece
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Vba count continuous names in a range

    Ok Kalak, let me explain.
    With your code in the end, when it find's a names with 6 or more times repeated, a msgbox come up with the name or names and the with the number of col. What I want is after the last name to provide a number that it will be the count of names that find to be repeated 6 or more times.

    Let's say that find 5 names. After the last name: Total 5.

    Now I think it is more clear???

  9. #9
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Vba count continuous names in a range

    like this then? (modifications, apart from spacing changes, in red)
    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: Vba count continuous names in a range

    And using my suggested solution:

    Please Login or Register  to view this content.
    Robert

  11. #11
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Vba count continuous names in a range

    or
    Please Login or Register  to view this content.
    but is this what's wanted?
    it counts all values (if count >=6) in the relevant used range whether in different columns or not.

  12. #12
    Registered User
    Join Date
    04-22-2013
    Location
    greece
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Vba count continuous names in a range

    Thanks kalak and Trebor 76 for ror your replies.
    But Trebor 76 in the code when it finds two names between them it place a number and in total provide 3 rather than 2.
    Also the same with the first code o Kalak. But with the second it is working very well!!!

    Maybe something for the previous, you could see it

    Thanks!!

  13. #13
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Vba count continuous names in a range

    It's not obvious to me if you're looking for further feedback.

    The two codes I posted will generally, although not always, do different things, produce different outputs, because they're addressing two different problems. That's because your real problem was never clearly stated in the first place so I had to guess.

    If you'd like anything further, please post an example, preferably an attached worksheet, showing clearly the structure of your input and the output you'd like to see.

  14. #14
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: Vba count continuous names in a range

    If you'd like anything further, please post an example, preferably an attached worksheet, showing clearly the structure of your input and the output you'd like to see.
    I couldn't agree any more!!

+ 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. [SOLVED] Challange - Need to count # of unique names in a range WITH A CONDITION
    By vij8y in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-11-2013, 05:14 PM
  2. Count Function on a non-continuous range.
    By bdcelli in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-07-2012, 12:25 PM
  3. Count specific phrase (letters and numbers) in continuous range
    By macneill5 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-03-2012, 04:56 AM
  4. Replies: 0
    Last Post: 02-20-2012, 05:42 PM
  5. Replies: 9
    Last Post: 02-24-2010, 07:20 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