+ Reply to Thread
Results 1 to 4 of 4

Macro to read cell and hide all rows where the text occurs less than 10 times in the sheet

  1. #1
    Registered User
    Join Date
    03-01-2012
    Location
    Clarksville, IN
    MS-Off Ver
    Excel 2007
    Posts
    9

    Post Macro to read cell and hide all rows where the text occurs less than 10 times in the sheet

    Hi All,

    I have a spreadsheet with thousands of entries that I refresh each month and review new occurences of a particular behavior.

    Each occurrence is a row with various identifying information, but the column I'm interested in is the OwnerName. I start by autofiltering out everything that didn't occur this month.

    From there, I only review a set of occurrences of this behavior if the person has done it more than 10 times in a month. What I would like to do is create a macro that reads how many times a name (for example "Adam A. LastName") occurs in column G, and if it occurs fewer than 10 times, I want to hide the entire row.

    I know the general format to hide the row. A "For/Next" loop that reads the text in the cell and If cell.Value (appears fewer than 10 times) Then cell.EntireRow.Hidden = True.

    It's just getting it to automatically count how many times each name appears that I can't figure out. Do I need to create an array of all the names first?

    Any help is greatly appreciated.

    Thanks,
    Carol

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Macro to read cell and hide all rows where the text occurs less than 10 times in the s

    Hi

    If you add another "helper" column, you could use SUMPRODUCT to get a count of the name for the given month. Then as part of the autofiltering, you could filter that column for entries that are >= 10.

    If you give us an example file showing your structure and some sample data, then we could come up with a formula for you.

    rylo

  3. #3
    Registered User
    Join Date
    03-01-2012
    Location
    Clarksville, IN
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Macro to read cell and hide all rows where the text occurs less than 10 times in the s

    Thanks, here is a small sample with the gist of what I need. I need to hide all rows where the OwnerName appears less than 10 times.

    Sample.xlsx

  4. #4
    Registered User
    Join Date
    03-01-2012
    Location
    Clarksville, IN
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Macro to read cell and hide all rows where the text occurs less than 10 times in the s

    So what I came up with is =SUMPRODUCT(--(A$2:A$100=B2))

    That way the range stays absolute, but it will always look at the correct name cell. I think this fixes it!

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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