+ Reply to Thread
Results 1 to 9 of 9

Counting occurence of multiple cells containing data

  1. #1
    Registered User
    Join Date
    03-02-2007
    Posts
    10

    Counting occurence of multiple cells containing data

    I have a worksheet that has rows of data, that are made up of blank cells or cells containing a single letter (see screenshot example). The cells I'm interested in are groups of 6 or 7 cells that contain the letters "d", "a" or "n".

    I need to count how many of these groups of 6 and how many groups of 7 cells exist in a row. Note that often such a group is followed by cell containing a letter "U", these should be considered as a blank cell (and not counted).

    There are also groups of cells containing the letter "v", these should not be counted as well.

    Hope this makes sense
    Attached Images Attached Images

  2. #2
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi BrakZak,

    Try the COUNTIF function.
    Corine

  3. #3
    Registered User
    Join Date
    03-02-2007
    Posts
    10
    How can I use COUNTIF to count the number of groups of cells? I don't want to count the total number of cells containing "d", "a" or "n", but the number of groups of 6 or 7 cells that are in the sheet.

  4. #4
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi BrakZak,

    I'm not sure of this but on cell V1 try:

    Please Login or Register  to view this content.
    change it to /7, if you want a group of 7.

    assuming that your data is in A1:t15 ->
    the above formula works per row, to include the whole range, change it to A1:T15
    Please Login or Register  to view this content.
    Last edited by corinereyes; 11-07-2007 at 08:13 AM.

  5. #5
    Registered User
    Join Date
    03-02-2007
    Posts
    10
    Please Login or Register  to view this content.
    Counts the total number of cells with the mentioned letters, but then just divides it by 6. This will not return the value I need.

    Example: in a row there are three groups of 6 cells containing "d", "a" or "n", and one group of 7. Your formula would return 4.166667 ((6+6+6+7)/6). However, I need it to return either 3 or 1 (depending wether I'm looking for groups of 6 or 7).

  6. #6
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Please Login or Register  to view this content.
    fyi, the above formula, counts the number of non-blank cells minus (-) cells that contains "v" & cells that contains "U".

    In your example, if there are 20 cells (i.e. A1:T1), 6 cells are blank, 10 cells contain "d", 2 cells contain "v" and 2 cells contain "U",

    so:

    = (14 cells that contains text - (2 "v" + 2 "U"))/ 6 = 1.7

    can you post an example file and the expected results?
    Last edited by corinereyes; 11-07-2007 at 04:44 PM.

  7. #7
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Counting occurence of multiple cells containing data

    EDITED: I'd forgotten to mention what $X$1:$Z$1 referred to!

    OK.....I think I have something you can work with.

    Using the information you posted
    AND
    assuming that range is in A1:T17
    AND
    X1: a
    Y1: d
    Z1: n

    Then
    Please Login or Register  to view this content.
    Does that do what you want?
    Post back if you have more questions.
    Last edited by Ron Coderre; 11-07-2007 at 05:53 PM.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  8. #8
    Registered User
    Join Date
    03-02-2007
    Posts
    10
    Quote Originally Posted by Ron Coderre
    EDITED: I'd forgotten to mention what $X$1:$Z$1 referred to!

    OK.....I think I have something you can work with.

    Using the information you posted
    AND
    assuming that range is in A1:T17
    AND
    X1: a
    Y1: d
    Z1: n

    Then
    Please Login or Register  to view this content.
    Does that do what you want?
    Post back if you have more questions.
    You, my friend, are a genius. Exactly what I needed.

    Both your help is very much appreciated.

  9. #9
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Counting occurence of multiple cells containing data

    I'm glad I could help.....(this one was fun!)

    ...and thanks so much for the kind words.

+ 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