+ Reply to Thread
Results 1 to 8 of 8

How to count consecutive Yes cells with the ability to reset count when a No is entered

  1. #1
    Registered User
    Join Date
    03-09-2020
    Location
    England
    MS-Off Ver
    10
    Posts
    4

    How to count consecutive Yes cells with the ability to reset count when a No is entered

    Good evening all,

    I am looking for a formula that will allow me to count up how many times a 'Y' is entered consecutively on my spreadsheet.
    The spreadsheet will have dates across the top and names down the side.

    I would like the formula to recognise that when a N has been entered it needs to reset and start counting up the Y's again from 0.

    Please see the example spreadsheet attached - I would like the formula to calculate the last column for me (I have manually entered the numbers to show you what the final number would be if the calculation was correct).

    Any help appreciated.

    Thanks
    Sara
    Last edited by sara1357; 03-09-2020 at 07:14 PM.

  2. #2
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: How to count consecutive Yes cells with the ability to reset count when a No is entere

    Maybe this formula does what you want...

    =IFERROR(9-LOOKUP(2,1/(B3:I3="N"),COLUMN(B:I)),COLUMNS(B:I))

    Note: If your range is different from B:I, change all of the B's to the first column letter and all of the I's to the last column letter.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to count consecutive Yes cells with the ability to reset count when a No is entere

    This worked for me, in J3, then copied down:

    =8-IFERROR(LOOKUP(2,1/(B3:I3="N"),COLUMN(A3:H3)),0)

    The part in red is the same number of columns as the part in blue, just offset back to the first column. It's just a way of counting from 1 to 8 easily in a formula.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    03-09-2020
    Location
    England
    MS-Off Ver
    10
    Posts
    4

    Re: How to count consecutive Yes cells with the ability to reset count when a No is entere

    Thanks for this Rick, unfortunately this doesn't seem to be working for me, but really appreciate the response

  5. #5
    Registered User
    Join Date
    03-09-2020
    Location
    England
    MS-Off Ver
    10
    Posts
    4

    Re: How to count consecutive Yes cells with the ability to reset count when a No is entere

    Hi Jerry

    Thank you so much this is working great
    I would now like to use this formula on a much larger worksheet, is it easy to adapt this formula? For example... do you use the number 8 as there are 8 data columns? so if I had for example 50 columns would I use 50-IFERROR at the start?

    Thanks
    Sara

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to count consecutive Yes cells with the ability to reset count when a No is entere

    Hypothetically, yes. Your sample data showed all 50 columns already had Y/N answers. As long as that is true for the new 50 column-sized data, this simple formula would work.

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: How to count consecutive Yes cells with the ability to reset count when a No is entere

    Hi Sara and welcome to the forum,

    Here is another solution that I like better. It takes a little VBA to build a StrReverse function to reverse that string and then use Concat(). See if you like this one better.

    StrReverse Consecutive Y.xlsm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  8. #8
    Registered User
    Join Date
    03-09-2020
    Location
    England
    MS-Off Ver
    10
    Posts
    4

    Re: How to count consecutive Yes cells with the ability to reset count when a No is entere

    Thanks for this Marvin, that works great

+ 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] Count Consecutive Cells with Same Value
    By phelbin in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-13-2020, 11:29 PM
  2. [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
  3. Ability to Count non blank cells between specified cells
    By sherylt13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2015, 06:37 AM
  4. Consecutive cells count
    By moonbreakker in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-12-2015, 09:45 PM
  5. [SOLVED] Formula needed to only count total cells entered and not count adjacent text entered cells
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-07-2013, 06:22 PM
  6. Count till met criteria, reset counter and count further
    By Romas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2011, 01:42 PM
  7. Count Consecutive Cells
    By Trapper via OfficeKB.com in forum Excel General
    Replies: 10
    Last Post: 05-24-2005, 06:32 AM

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