+ Reply to Thread
Results 1 to 4 of 4

Count number of occurrences

  1. #1
    Registered User
    Join Date
    09-29-2015
    Location
    Sheffield, England
    MS-Off Ver
    2010
    Posts
    7

    Count number of occurrences

    Hi,

    How can how calculate the number of total occurrences where "off" occurs when "off" can be repeated several times in a row?

    Example


    Col A
    off
    off
    on
    off
    on
    off
    off
    off
    on
    off

    The answer would be 4 because I only want to count the first off and then move on to when off occurs again after a on

    Thanks

    Kris

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Count number of occurrences

    like this ? =IF(INDEX(A:A;MATCH(REPT("Z";255);A:A))="ON";COUNTIF(A:A;"ON");COUNTIF(A:A;"ON")+1) (replace semi-colons with commas if needed)

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Count number of occurrences

    Or this confirmed with ctrl+shift+enter (not just enter)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Count number of occurrences

    If your data is in the Range of "A1:A10" use below formula
    =SUM((FREQUENCY((A1:A10="Off")*ROW(A1:A10),(A1:A10<>"Off")*ROW(A1:A10))>0)*1)-(COUNTIF(A1:A10,"Off")<>ROWS(A1:A10))
    Please Login or Register  to view this content.
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

+ 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 number of occurrences of year
    By pic2pic in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-09-2014, 05:30 AM
  2. [SOLVED] Count number of occurrences but if there are consecutive matches count them as one
    By michaljireht in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-26-2013, 08:26 PM
  3. Count the number of occurrences between In and Out times.
    By allwrighty in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-01-2013, 05:18 PM
  4. Count number of occurrences in a day
    By quinnbri in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-20-2013, 05:49 PM
  5. [SOLVED] Count number of occurrences for a number of ranges from a find loop
    By ANDREWA in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-23-2012, 07:53 PM
  6. [SOLVED] Count number of occurrences
    By MarkM in forum Excel General
    Replies: 1
    Last Post: 07-27-2006, 05:15 PM
  7. Count Number of Occurrences in a Column
    By anniejhsu in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-31-2006, 04:35 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