+ Reply to Thread
Results 1 to 11 of 11

Formula to select last number '1' entered and count '0' that follow

  1. #1
    Registered User
    Join Date
    12-12-2018
    Location
    Swindon, Wiltshire, England
    MS-Off Ver
    Professional Plus 2010
    Posts
    5

    Formula to select last number '1' entered and count '0' that follow

    Hi everyone,
    Fingers crossed and hoping you can help me out here.

    I have a Safety Record spreadsheet with departments (columns) and Date/Day (Rows)

    We record against each day a ‘0’ if there’s been no incidences, if there has we record a ‘1’

    I need a formula that will look at all the data in just one column, pick out the last ‘1’ entered and then count the ‘0’ afterwards.

    This is required so each department can print out their respective Safety Record every morning and display on their KPI boards..

    I’ve attached our current spreadsheet and as you’ll see the formulas used are not right, each time there’s an incidence the department rep has to change criteria of the formula.

    I’ve highlighted in yellow just one column and the corresponding safety record with current formula.

    Thank you all for your time, much appreciated in advance.

    Mark
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,213

    Re: Formula to select last number '1' entered and count '0' that follow

    Here's one way, in K7

    =COUNTIF(INDEX(D:D,AGGREGATE(14,6,ROW($D$3:$D$400)/($D$3:$D$400=1),1)):$D$400,0)
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,213

    Re: Formula to select last number '1' entered and count '0' that follow

    That doesn't work for TT, where you have been accident free.

    Try this, instead:
    =COUNTIF(INDEX($D:$D,IFERROR(AGGREGATE(14,6,ROW($D$3:$D$400)/($D$3:$D$400=1),1),3)):$D$400,0)
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-12-2018
    Location
    Swindon, Wiltshire, England
    MS-Off Ver
    Professional Plus 2010
    Posts
    5

    Re: Formula to select last number '1' entered and count '0' that follow

    You're a star Glenn, thank you so very much. I struggled to get my head around a formula but what you've shown is teaching me lots, very much appreciated, thank you, oh and Merry Christmas

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,213

    Re: Formula to select last number '1' entered and count '0' that follow

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  6. #6
    Registered User
    Join Date
    12-12-2018
    Location
    Swindon, Wiltshire, England
    MS-Off Ver
    Professional Plus 2010
    Posts
    5

    Re: Formula to select last number '1' entered and count '0' that follow

    Hi Glenn, sorry to trouble you, I've been looking at and trying to change the formula to take in all the columns (D to J) and rows so to have a plantwide figure.
    I changed the likes of $D:$D to $D:$J, and $D$3:$D$400 to $D$3:$J$400, in my novice mind this looks like it would work all bar the last part of the formula, the $D$400,0 as I gather this is still just looking at column D.
    Am I looking along the right lines or am I totally wrong?

    =COUNTIF(INDEX($D:$J,IFERROR(AGGREGATE(14,6,ROW($D$3:$J$400)/($D$3:$J$400=1),1),3)):$D$400,0)

    Thanks again for your support.
    Mark

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,213

    Re: Formula to select last number '1' entered and count '0' that follow

    What would your expectected result be? Would it not simply be the smallest number of the 7 numbers covering each operational area?

  8. #8
    Registered User
    Join Date
    12-12-2018
    Location
    Swindon, Wiltshire, England
    MS-Off Ver
    Professional Plus 2010
    Posts
    5

    Re: Formula to select last number '1' entered and count '0' that follow

    Yes it would, so would that then be a formula looking at all 7 numbers and selecting the smallest?

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,213

    Re: Formula to select last number '1' entered and count '0' that follow

    Yep.

    =MIN($K$7,$N$7,$Q$7,$T$7,$K$12,$N$12,$Q$12)
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    12-12-2018
    Location
    Swindon, Wiltshire, England
    MS-Off Ver
    Professional Plus 2010
    Posts
    5

    Re: Formula to select last number '1' entered and count '0' that follow

    Simplicity is the best, looks like I was overthinking the solution, thinking it was harder than it was.
    Thank you again Glenn.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,213

    Re: Formula to select last number '1' entered and count '0' that follow

    I'm AMAZING at overcomplicating things...

+ 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] Formula to count number of cells containing entered numbers but NOT a cell with =SUM()
    By peculiar101 in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 11-21-2018, 05:54 PM
  2. Replies: 8
    Last Post: 04-02-2018, 08:26 AM
  3. [SOLVED] need a total count of number of times a value is entered in a cell
    By 2Sassy in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 11-24-2015, 04:31 PM
  4. Replies: 4
    Last Post: 09-03-2015, 06:20 PM
  5. Count number of different dates entered
    By T86157 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2013, 12:50 PM
  6. [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
  7. [SOLVED] Count/No Count for year entered---formula help
    By awest181 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-26-2012, 02:07 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