+ Reply to Thread
Results 1 to 9 of 9

Count Number of Cells Until a Value is reached

  1. #1
    Registered User
    Join Date
    12-01-2016
    Location
    Utah
    MS-Off Ver
    2016
    Posts
    13

    Count Number of Cells Until a Value is reached

    I'm using Excel to track donations. Each Row is a different donor. Each column is a year. 1976-2016. I'm trying to count how many donations they made before their first donation of $1,000 or more in a separate column.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count Number of Cells Until a Value is reached

    Try something like this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    I
    1
    ------
    1976
    1977
    1978
    1979
    1980
    1981
    1982
    1983
    2
    5
    500
    500
    750
    750
    1000
    1200
    1500
    2000


    This array formula** entered in A2:

    =IFERROR(MATCH(TRUE,B2:I2>=1000,0),0)

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    12-01-2016
    Location
    Utah
    MS-Off Ver
    2016
    Posts
    13

    Re: Count Number of Cells Until a Value is reached

    Thank you Tony. This is really close to what I need. However, how would I get it to exclude blank cells?

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count Number of Cells Until a Value is reached

    Like this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    I
    1
    ------
    1976
    1977
    1978
    1979
    1980
    1981
    1982
    1983
    2
    3
    500
    500
    1200
    1200
    1500
    2000


    This array formula** entered in A2:

    =IFERROR(MATCH(TRUE,B2:I2>=1000,0)-COUNTIF(B2:INDEX(B2:I2,MATCH(TRUE,B2:I2>=1000,0)),""),0)

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  5. #5
    Registered User
    Join Date
    12-01-2016
    Location
    Utah
    MS-Off Ver
    2016
    Posts
    13

    Re: Count Number of Cells Until a Value is reached

    Thank you, Tony. This is really close to what I need. However, how would I get it to exclude blank cells?

  6. #6
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2021
    Posts
    5,960

    Re: Count Number of Cells Until a Value is reached

    Or try this ...

    =IFERROR(COUNT(B2:INDEX(B2:I2,MATCH(TRUE,B2:I2>=1000,0))),0)

    Enter with Ctrl+Shift+Enter.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count Number of Cells Until a Value is reached

    Or try this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    I
    1
    ------
    1976
    1977
    1978
    1979
    1980
    1981
    1982
    1983
    2
    3
    500
    500
    1200
    1200
    1500
    2500


    =COUNT(B2:INDEX(B2:I2,MATCH(TRUE,B2:I2>=1000,0)))

    Still array entered.

  8. #8
    Registered User
    Join Date
    12-01-2016
    Location
    Utah
    MS-Off Ver
    2016
    Posts
    13

    Re: Count Number of Cells Until a Value is reached

    Tony, that was the answer I needed. Thank you so much.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count Number of Cells Until a Value is reached

    You're welcome. Thanks for the feedback!

+ 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] Move specific cells to a new sheet when a date is reached or 30 days from being reached
    By Albert Dirk in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-26-2016, 04:44 AM
  2. [SOLVED] Sum/count until a certain value is reached
    By sreejeshc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-21-2014, 01:06 AM
  3. Count until Sum Value is reached
    By SpaceRocksMars in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2014, 02:43 PM
  4. Replies: 2
    Last Post: 08-01-2013, 04:49 AM
  5. [SOLVED] Count of cells that can be summed before a value is reached or exceeded?
    By Speshul in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-29-2013, 03:35 PM
  6. [SOLVED] Fill down a row count until a new value is reached?
    By TBrun in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-28-2013, 10:37 AM
  7. [SOLVED] Character Count Until a Number is Reached
    By HangMan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-07-2012, 09:48 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