+ Reply to Thread
Results 1 to 9 of 9

Running Counter with criteria

  1. #1
    Registered User
    Join Date
    11-07-2015
    Location
    Australia
    MS-Off Ver
    Office 365
    Posts
    91

    Running Counter with criteria

    Hi all,

    I'm trying to work out the following problem: I need a formula which will number all instances of a particular value (e.g the value “T”) which fall between certain values (“I” and “RT”) in a corresponding column. This number will increase incrementally each time the triggering cell ("I") is encountered. I have attached an example spreadsheet.

    Any help would be greatly appreciated!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Running Counter with criteria

    Looks like you're starting at the bottom and going up. Are the values in B6:C23 the intended results? In which case the R in A23 triggers the 1 in C23, but there's also a 1 in C22, so it appears you want to record state changes, that is, the I in A24 triggers a state change for the R values in A22:A23 and the T values in A20:A21. The RT value in A18 and the I value in A17 then trigger a state change, and so forth. Would every cell in col A containing RT have the cell above it in col A contain I?

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Running Counter with criteria

    In B5 then copied across.

    =IF($A5=B$3,LARGE(COUNTIF($A5:$A25,{"I","RT"}),1),"")
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Registered User
    Join Date
    11-07-2015
    Location
    Australia
    MS-Off Ver
    Office 365
    Posts
    91

    Re: Running Counter with criteria

    Thats brilliant thank you so much!

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Running Counter with criteria

    welcome.Thanks for feed back.

  6. #6
    Registered User
    Join Date
    11-07-2015
    Location
    Australia
    MS-Off Ver
    Office 365
    Posts
    91

    Re: Running Counter with criteria

    Hi kvsrinivasamurthy,

    Just had a question regarding the solution you came up with. If i wanted to add another variable to the formula e.g. anything also starting with the text "RT, I" will also trigger the counter to add +1? I have tried changing to =IF($A5=B$3,LARGE(COUNTIF($A5:$A25,{"I","RT","RT, I*"}),1),""), or =IF($A5=B$3,LARGE(COUNTIF($A5:$A25,{"I","RT*"}),1),"") but neither of these seem to work.
    Last edited by kk1352; 10-21-2020 at 02:53 AM.

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: Running Counter with criteria

    Applying the second formula to the file attached to post #3 seems to yield the expected results when I changed A10 and A24 to RT,I
    Perhaps it would help if you could explain what seems to not work.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  8. #8
    Registered User
    Join Date
    11-07-2015
    Location
    Australia
    MS-Off Ver
    Office 365
    Posts
    91

    Re: Running Counter with criteria

    All good, I managed to work it out. If i changed the formula to =IF($A5=B$3,LARGE(COUNTIF($A5:$A25,{"*I *","RT"}),1),"") it worked the way i wanted it. Thanks!

  9. #9
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: Running Counter with criteria

    Glad that you were able to resolve the issue. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

+ 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] Running counter which resets after threshold
    By kk1352 in forum Excel General
    Replies: 2
    Last Post: 07-06-2018, 08:57 AM
  2. [SOLVED] Not part of the counter when a criteria is met
    By Gaellus in forum Excel Formulas & Functions
    Replies: 25
    Last Post: 07-25-2017, 09:49 AM
  3. Running counter each time a function is executed (VBA)
    By convexity_7289 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-23-2017, 02:52 PM
  4. Replies: 0
    Last Post: 10-05-2016, 10:26 AM
  5. Resetting running counter based on conditions being satisfied
    By Stdnt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-17-2014, 06:15 PM
  6. Running counter using time
    By cdrum84 in forum Excel General
    Replies: 1
    Last Post: 06-06-2010, 11:47 AM
  7. Running counter
    By GeorgeBob in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2009, 11:20 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