+ Reply to Thread
Results 1 to 25 of 25

consecutive value occurance count?

  1. #1
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    consecutive value occurance count?

    I have to calculate bonus payments for people working O/S. I have a 5 year calendar in month blocks (60 months/columns). In each month there is a percentage 'time O/S' figure. If an employee is O/S for 3 consecutive months they get bonus 'A', 6 consective months bonus 'B', etc.
    How can I evaluate the 60 columns, returning the number of times 100% occurs in 3 consecutive months/columns.
    I have found examples of similar solutions but they will return a value of 3 if there are 5 consecutive months of 100%...
    ie. 100 100 100 100 100
    = 100 100 100 *** ***
    & *** 100 100 100 ***
    & *** *** 100 100 100
    = 3
    but I need it to equal 1

    Hope this makes sense to someone else???

    Thanks...

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You example is confusing.

    You have 5 100's and then you have = and then you have groups of 3 100's separated by "*"'s.

    What exactly are in the 60 columns and what exactly do you need to count.

    If you have, say, 5 groups of 3 consecutive 100's within the 60 month period, what should the result be?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    See attached file where I inserted 'bonus' function... I hope it can help.

    Regards,
    Antonio
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    Attempted clarification

    I have 60 columns across sheet representing months

    Each column has a % value.

    I need to count the number of times 100% appears in 3 consecutive columns as 'A'

    I also need to count the number of times 100% appears in 6 consecutive columns as 'B'

    But, if 100% appears in 5 consecutive columns, I need 'A' to equal 1 (not 3), as although there are technically 3 sets of 100% values the employee has only been there for one 'A' qualifying period...

    This is what I was trying to represent, the *** represented the 100% value that were not being evaluated in each of the three possible match's.

    Hope that's a bit clearer, sorry it's very hard to explain

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Possibly?

    Please Login or Register  to view this content.
    adjust ranges to suit your data... Note: I assume you use 100% not just 100..change as required.

    This formula must then be confirmed with CTRL+SHIFT+ENTER not just ENTER. You will see { } brackets appear around the formula.

    The formula will return "B" if any 6 consecutive 100's occur, if not then it will return "A" if any 3 consecutive 100's occur, else it will return nothing.
    Last edited by NBVC; 04-02-2008 at 09:57 AM.

  6. #6
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    Thanks Guys... can the returned value be a count?

    The issue I have is that in the given period an employee may qualify for ("bonus A" 12 times and "Bonus B" 3 times) or ("bonus A" 2 times and "bonus B" 6 times) or millions of other combinations thereof...

    So I need to return a numeric value for each bonus that will go under a column heading "Bonus A"(Number of times: 3 consecutive months @ 100% O/S), "Bonus B"(Number of times: 6 consecutive months @ 100% O/S).

    This is where I believe the difficulty comes, returning a value of 1 for five consective months 100% Overseas. The other thing is it must only count 100% O/S values as there will be many months when there are values of 10%, 25%, etc not credited toward the bonus.

    for example-

    100, 15, 25, 100, 100, 50, 100, 100, 5, 100, 100, 0, 100, 100, 10

    where:
    'A' = 0
    'B' = 0

    or

    100, 100, 100, 100, 100, 100, 100, 100, 0, 100, 100, 100, 100, 100, 10

    where:
    'A' = 1
    'B' = 1

    or

    0, 0, 0, 0, 0, 0, 25, 50, 75, 100, 100, 75, 50, 75, 100, 100, 100, 100

    where:
    'A' = 1
    'B' = 0

    Hope this makes a bit more sense now...(sure know I'm confused)

    Regards,
    David

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    For runs of 6....

    Please Login or Register  to view this content.
    For runs of 3

    Please Login or Register  to view this content.
    adjust ranges and confirm with CSE key combo

  8. #8
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    I modified the previous function to do what you need.

    Regards,
    Antonio
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    Thanks NBVC

    Thanks, nearly 2am here (Australia). Been at it since 6am, back at it in 4 hrs. Will try your code in the morning and post my results...

    Should have gone to bed 2 hrs ago... Good Night!

  10. #10
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    Sorry, also thanks Antonio...

    You guys are great!!!

  11. #11
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    NBVC solution is nearly there...

    Thanks NBVC,

    Your solution is just ablut giveing me what I need. Unfortunately it is not correctly condidering whether the values are consecutive... please se attached example xls.

    PS. Thanks for your help Antonio, hope you don't mind, I put NBVC's code into your example for clarity...

    Thanks again,
    David
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    I modified the function to work as you need.

    I hope it's what you need.

    Regards,
    Antonio
    Attached Files Attached Files

  13. #13
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by scuddy
    Thanks NBVC,

    Your solution is just ablut giveing me what I need. Unfortunately it is not correctly condidering whether the values are consecutive... please se attached example xls.

    PS. Thanks for your help Antonio, hope you don't mind, I put NBVC's code into your example for clarity...

    Thanks again,
    David
    Sorry about that.... I forgot that you were checking items horizontally instead of vertically...therefore all more ROW() functions need to be changed to COLUMN() functions...

    see attached.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    Smile Perfect, Thankyou so much!

    NBVC,
    Your solution works perfectly, thankyou for your help.

    Antonio,
    Thankyou for your solutions and especially for the example that helped me explain the true requirement. Your solution works until I have both A & B bonus for the same person, the B bonus cancels the A bonus when both are sometimes true.

    I cannot thankyou both enough for your help with this...

    Kindest Regards,
    David

  15. #15
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    Just when I thought I had it... they moved the goals

    Hi,

    The HR people changed the criteria for bonus eligibilty on me... however I've been able to change the formula's provided by NBVC (thankyou) to address this change.

    Where I am stuck is I now need to know the sum of months for which the employee is entitled to each bonus. I'm quite sure it's an easy mod to the existing formula with a count function, but I can't seem to get it.

    Please see attached example for details...

    Thanks,
    David
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    Someone please help... my brain is fried!!!


  17. #17
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Please see attached
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    Thanks NVBC...

    i haven't tried your solution yet... not at home download to USB stick for now, will try tomorrow, based on your solutions to date I'm sure it'll be perfect.

    You're a champion, thanks.

    David

  19. #19
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    Please Help!!! they've moved the goal posts again!!!

    Dear NVBC (or anyone else)...

    Your last solution was perfect and the HR people were happy. Now the big boss says that all people that go overseas to work on this project should get a bonus not just the ones there for 100% of month. I've modified the example (and criteria) and attached it. Basically I now need to sum the percentages for Bonus 'A' and for Bonus 'B'.

    Thanks in advance,
    David
    Attached Files Attached Files

  20. #20
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Hmmm.... I have been trying to figure this one out....and I have to admit I am stumped....

    Probably I am not seeing something so obvious....

    I will keep trying and probably enlist some help to figure it out....

    I will keep you posted.

  21. #21
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Well scuddy,

    I didn't forget about you... it took some time but I think I finally got you something you can work with...

    I knew this was a challenge and so I posted a question in MrExcel.com where many Excel gurus reside... You will notice I have over 5000 posts there too

    anyways... one of the great did respond, his name is Domenic.... and I will simply let him explain via his elegant response here http://www.mrexcel.com/forum/showthr...01#post1548201

    I hope you can figure it out... if you need a hand, let me know and I will try to implement it in your sheet.

  22. #22
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    Thanks NBVC, but it's way over my head...

    I really appreciate your help with this. Thankyou so much for taking the time to seek further help rather than just saying "sorry, too hard". I'm so impressed that I have a problem that is so difficult... anyhow, if you could get it working in my example that'd be great, I won't even pretend to follow the proposed solution...

    Thanks again,
    David

  23. #23
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Here you go scuddy....
    Attached Files Attached Files

  24. #24
    Registered User
    Join Date
    04-02-2008
    Posts
    15

    I must be missing something?

    Hi NBVC,

    I don't seem to be able to get this to work, not sure if I'm missing something or if it's just stupid factor?

    Anyhow, are the 3 cells at the bottom required and if so does it matter where they are? If I delete them from your example it still works fine.

    When I enter the main formulas into my spreadsheet I get a null value when expected, but if I should have a value > 0 it displays "#NAME?"

    Any ideas, other than installing a brain upgrade?

    Thanks
    David

  25. #25
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    If you mean the 3 cells, I29:I31, no they aren't required... I was using those cells just to see how Domenic's named formulas worked... I forgot to delete them.

    Without seeing your "real" sheet, it's hard to say what's going on.

    The #Name? error usually occurs when you have some sort of syntax error in the formula... make sure all function names are correctly spelled and that all arithmetic operators are correct and placed in the right positions.

    The only other thing is to make sure that all formulas (named and directly on the sheet) have the correct ranges in them... just like in the sample.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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