+ Reply to Thread
Results 1 to 4 of 4

Count number of cells since last value greater than a value

  1. #1
    Registered User
    Join Date
    11-02-2018
    Location
    OK
    MS-Off Ver
    O365
    Posts
    2

    Count number of cells since last value greater than a value

    I am trying to create a column that will count the number of cells in another column since the last cell that had a value greater than .19. In other words, for each cell in column B to count up the number of cells in column A from the same row that were less than .19 and then stop counting once it reaches a number greater than .19.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Count number of cells since last value greater than a value

    Maybe:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,444

    Re: Count number of cells since last value greater than a value

    I interpreted your explanation a little different than xladept. I would do something like (assuming your "signal" data starts in A1):
    B1 =IF(A1<0.19,1,0) -- to initialize the tracking column.
    B2 =IF(A2<0.19,B1+1,0) copy down.

    You don't say what you want to do when column A exactly equals 0.19. My solution includes exactly 0.19 in the greater than 0.19 camp -- adjust formulas for your desired behavior for exactly 0.19.

    You don't way what you want to do with those counts. I could see =MAX(B:B) to get the length of the longest streak of values below 0.19.

    xladept's solution simply counts all of the entries in A that are less than 0.19. Mine counts "streaks" where the values are below 0.19. Choice depends on exactly what you want do for these counts.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    11-02-2018
    Location
    OK
    MS-Off Ver
    O365
    Posts
    2

    Re: Count number of cells since last value greater than a value

    Thank you MrShorty! That is what I needed. I was thinking countif, but couldn't get it to stop counting. Simple addition works instead. Thanks again!

+ 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. Replies: 18
    Last Post: 06-27-2016, 04:45 AM
  2. [SOLVED] Count Number of Cells in Col B that are greater than Col A
    By lordfa9 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-08-2015, 04:44 AM
  3. [SOLVED] Count number of cells in range since last number greater than zero
    By whitfieldcraig in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-18-2015, 06:38 AM
  4. [SOLVED] How to count cells after last number greater than 0
    By gogreenpower in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 04-09-2014, 02:28 AM
  5. Replies: 6
    Last Post: 02-24-2012, 01:15 PM
  6. How to Count the Number of Cells Greater than Zero in a Filtered List?
    By denise001 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-01-2011, 11:33 AM
  7. Replies: 3
    Last Post: 05-19-2010, 04:09 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