+ Reply to Thread
Results 1 to 4 of 4

Count no. rows between 2 values

  1. #1
    Registered User
    Join Date
    11-16-2018
    Location
    London, UK
    MS-Off Ver
    Office 2016 (16.0)
    Posts
    6

    Count no. rows between 2 values

    Hi all,

    I need help creating a formula to count the number of rows in a column, as defined by parameters set in 2 other columns.

    Simplified example
    In columns A and B, I have the following:

    Particle Frame
    1 0
    1 1
    1 3
    1 4
    1 5
    1 7
    1 8
    1 9
    1 10
    1 11
    2 5
    2 6
    2 7
    2 8
    2 9
    2 11
    2 12
    2 13
    2 14
    2 15
    2 16

    In separate columns I have:

    Particle Start Frame End Frame
    1 1 7
    2 8 15

    I would like to count the number of frames in column B as defined by the start and end frames above, and have this in a separate column.

    Note that the frame count in column B is not always consecutive and some values are 'missed out' every now and then...

    Please see example spreadsheet for clarity.

    Thank you for your help!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Count no. rows between 2 values

    HTML Code: 
    enter this formula in G2 and drag down.
    1. Click on the * Add Reputation if you think this helped you
    2. Mark your thread as SOLVED when question is resolved

    Modytrane

  3. #3
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Count no. rows between 2 values

    assuming the values exist the following works as an array (enter with shft control enter)
    =MATCH(1,($A$2:$A$22=$D2)*($B$2:$B$22=F2),0)-MATCH(1,($A$2:$A$22=$D2)*($B$2:$B$22=E2),0)+1

    may be an option otherwise if the format you are using is conistent
    =SUMPRODUCT(($A$2:$A$22=D2)*($B$2:$B$22>=E2)*($B$2:$B$22<=F2))

  4. #4
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Count no. rows between 2 values

    one other option:

    In G2:
    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 Values (Rows) of Most Recent Consecutive Streak (2+ Distinct Values)
    By ExcelForum88 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-13-2016, 12:26 PM
  2. Replies: 9
    Last Post: 02-04-2016, 08:23 AM
  3. Insert rows based on count and fill rows with adjacent values
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-19-2015, 02:57 PM
  4. Delete unwanted rows and update count of rows based on values
    By boddulus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-12-2015, 08:34 PM
  5. Count Number of Rows between Certain Values - How to do?
    By UsmanBPD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-18-2013, 01:16 PM
  6. How can I count the rows which contain certain values
    By ttsteve in forum Excel General
    Replies: 3
    Last Post: 05-17-2011, 04:26 PM
  7. Count rows that contain values, not formulas!
    By magnuc in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-24-2011, 05:46 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