+ Reply to Thread
Results 1 to 7 of 7

Count number of blocks of code

Hybrid View

  1. #1
    Registered User
    Join Date
    06-03-2021
    Location
    France
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    3

    Count number of blocks of code

    Hello Excel community. I need to count the number of times a block of value appears in a column. That will be easier to understand with an example:
    Blocks.png
    I am struggling to find a formula that works. Do you have any idea as to how I could proceed?
    Attached Files Attached Files
    Last edited by Saarahh; 06-03-2021 at 06:13 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count number of blocks of code

    As presented then

    E4 copied down

    =COUNTIFS($A$2:$A$11,D4)/MAX(1,COUNTIFS($A$2:$A$10,D4,$A$3:$A$11,D4))
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    06-03-2021
    Location
    France
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    3

    Re: Count number of blocks of code

    It works perfectly, thank you!

  4. #4
    Registered User
    Join Date
    06-03-2021
    Location
    France
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    3

    Re: Count number of blocks of code

    There are actually a few cases where it does not work. E.g., it returns a decimal value in this example for the count of "1" using the formula you suggested:
    Attachment 735207

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2506
    Posts
    13,792

    Re: Count number of blocks of code

    Saarahh,

    Richard's formula works fine at my end. Would you upload another file that behaves the way you described in post #4 please? That last attachment doesn't display for everyone.
    Dave

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,478

    Re: Count number of blocks of code

    For your data layout, put this formula in cell E4 and copy it down...
    Formula: copy to clipboard
    =SUMPRODUCT(0+(A$2:A$11=D4),0+(A$3:A$12<>D4))
    Last edited by Rick Rothstein; 06-05-2021 at 09:55 AM.

  7. #7
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2505 and WPS V2024(12.1.0.18543)
    Posts
    4,113

    Re: Count number of blocks of code

    E4 cell formula , drag it down

    HTML Code: 

+ 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. Count of cell blocks
    By hawk77EF in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-23-2019, 11:17 PM
  2. Replies: 4
    Last Post: 04-28-2017, 11:06 AM
  3. [SOLVED] To Sum and Count several blocks of Data
    By kent97 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 01-23-2017, 11:00 PM
  4. Auto Count Hour Blocks?
    By jmrlifesafe in forum Excel General
    Replies: 11
    Last Post: 02-17-2016, 09:39 AM
  5. [SOLVED] Count Blocks of occurances within a range
    By Chanter in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-09-2016, 05:01 AM
  6. [SOLVED] Need a formula to count blocks of data
    By john dalton in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 04-15-2015, 08:57 AM
  7. How do i count blocks of data..???
    By drgogo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-27-2008, 12:17 PM

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