+ Reply to Thread
Results 1 to 13 of 13

Count the gaps between two consecutive data

  1. #1
    Registered User
    Join Date
    04-26-2022
    Location
    India
    MS-Off Ver
    2019
    Posts
    23

    Count the gaps between two consecutive data

    I have attached spreadsheet. Data in column A and result(gaps) in column c

    TRUE
    FALSE
    FALSE
    TRUE
    TRUE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    TRUE
    FALSE
    TRUE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    TRUE


    I want to count the number of falses between two consecutive true

    2
    0
    5
    1
    9

    And I want the result to be arranged in this manner. where 2 is the number of falses between the first two trues, 0 is the number of falses between the next two trues, and so on.

    Please help
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,958

    Re: Count the gaps between two consecutive data

    Still with 2019?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,958

    Re: Count the gaps between two consecutive data

    If you have 365, this will work:

    =LET(d,FILTER(ROW(A1:A23),A1:A23),t,TAKE(d,-(ROWS(d)-1)),f,TAKE(d,ROWS(d)-1),(t-f)-1)
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    04-26-2022
    Location
    India
    MS-Off Ver
    2019
    Posts
    23

    Re: Count the gaps between two consecutive data

    Thanks but Ma'am it's not working in my excel. I tried to copy that formula and edit range to suit my data but it didn't work. Thanks again

  5. #5
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Count the gaps between two consecutive data

    Try this in C1 and copied down.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,958

    Re: Count the gaps between two consecutive data

    Thanks but Ma'am it's not working in my excel.
    I asked if you still hd 2019 - you did not respond. Do you?

    I also said that the solution would work if you had 365.

  7. #7
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Count the gaps between two consecutive data

    In older Excel versions, please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This formula returns the gaps including the number of FALSE's before the first TRUE and the number of FALSE's after the last TRUE.
    Attached Files Attached Files
    Last edited by HansDouwe; 09-08-2023 at 05:51 AM.

  8. #8
    Registered User
    Join Date
    04-26-2022
    Location
    India
    MS-Off Ver
    2019
    Posts
    23

    Re: Count the gaps between two consecutive data

    I am extremely. I could not see your message at that time. If it's possible, please tell me how to do it in older versions. Thanks again. Have a nice day.

  9. #9
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Count the gaps between two consecutive data

    See post #7

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,958

    Re: Count the gaps between two consecutive data

    Quote Originally Posted by Blacktiger1 View Post
    I am extremely. I could not see your message at that time.
    Well, it was there. It seems that you just aren't reading all of the messages in the thread - please do so.

    Then, if that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  11. #11
    Registered User
    Join Date
    04-26-2022
    Location
    India
    MS-Off Ver
    2019
    Posts
    23

    Re: Count the gaps between two consecutive data

    Thanks mate. It worked. Here is something which is troubling me again. I am attaching spreadsheet.

    what I want to do is - Count a certain pair of numbers in column E. Pair I want to count is 5,0...such that Zero appears immediately after 5 in Column E.

    E9 5
    E10 0

    I want to count this pair in the list given in Column E. ( I have uploaded the spreadsheet)

    Thanks in Advance.
    Attached Files Attached Files
    Last edited by Blacktiger1; 09-08-2023 at 06:40 AM.

  12. #12
    Registered User
    Join Date
    04-26-2022
    Location
    India
    MS-Off Ver
    2019
    Posts
    23

    Re: Count the gaps between two consecutive data

    Sure Ma'am. I will do it.

  13. #13
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Count the gaps between two consecutive data

    5,0
    Please Login or Register  to view this content.
    6,0
    Please Login or Register  to view this content.

+ 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] Sum product as count if's with dates and gaps in data
    By moneypennie21 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-29-2021, 03:35 AM
  2. Count consecutive > zero, ignore zero count consecutive > zero next cell
    By karl.smith in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-16-2020, 07:58 AM
  3. [SOLVED] Count Consecutive & Non consecutive days per given logic
    By asimraza89 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-26-2019, 04:31 PM
  4. Count data in a row not consecutive
    By LHCCR in forum Excel General
    Replies: 1
    Last Post: 03-16-2017, 04:27 AM
  5. [SOLVED] Count consecutive rows that the same data is entered in two cells
    By chrisowen in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-07-2016, 07:06 PM
  6. Count consecutive data under thresholds
    By marzi_buku in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-07-2015, 04:25 AM
  7. How to Count the # of consecutive occurences >2 in a row of data
    By bparrott in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-29-2013, 05:03 PM

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