+ Reply to Thread
Results 1 to 25 of 25

consecutive value occurance count?

Hybrid View

  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
    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

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

    =IF(SUM(IF(FREQUENCY(IF(A1:BH1=100%,ROW(A1:BH1)),IF(A1:BH1<>100%,ROW(A1:BH1)))>=6,1)),"B",IF(SUM(IF(FREQUENCY(IF(A1:BH1=100%,ROW(A1:BH1)),IF(A1:BH1<>100%,ROW(A1:BH1)))>=3,1)),"A",""))
    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.

  5. #5
    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

  6. #6
    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....

    =SUM(IF(FREQUENCY(IF(A1:BH1=100%,ROW(A1:BH1)),IF(A1:BH1<>100%,ROW(A1:BH1)))>=6,1))
    For runs of 3

    =SUM(IF(FREQUENCY(IF(A1:BH1=100%,ROW(A1:BH1)),IF(A1:BH1<>100%,ROW(A1:BH1)))>=3,1))-SUM(IF(FREQUENCY(IF(A1:BH1=100%,ROW(A1:BH1)),IF(A1:BH1<>100%,ROW(A1:BH1)))>=6,1))
    adjust ranges and confirm with CSE key combo

  7. #7
    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

  8. #8
    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

+ 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