+ Reply to Thread
Results 1 to 6 of 6

Classifying the second largest value if a certain condition is not met

  1. #1
    Registered User
    Join Date
    12-06-2018
    Location
    Norway
    MS-Off Ver
    1811
    Posts
    31

    Classifying the second largest value if a certain condition is not met

    Hello,

    I haven't been able to find a similar topic to this one, so I hope people will find my question interesting. I've uploaded a sample of my data attached to this message.

    I've a list of events (cells B to K) with their duration times for a given interval number (cell A). Total time is accounted in cell L. Cell M displays the event having the longest duration for a given interval number. Cell N is the proportion of duration of the longest event relative to the total duration of the interval (80 seconds except for interval #1 which lasts 41 seconds).

    I would like to transform my data in the following manner:

    1) When "Head-up" is the ONE and ONLY event present in a given interval (example: interval #1 -row 2-), I'd like to have Head-up as my "Event" in column M with its according "Proportion" in cell N (which should be always 1 in this case).

    2) When "Head-up" has the longest duration time but is accompanied by other events in a given interval (example: interval #2 -row 3-), I'd like to have the SECOND event with the largest duration time as my "Event" in column M with its according "Proportion" in cell N.

    3) When "Head-up" is present in a given interval but there's another event with the longest duration time (example: interval #11 -row12-, "Moving" has the longest duration time), I'd like to have that event that is not "Head-up" with the longest duration time as my "Event" in column M with its according "Proportion" in cell N.

    In other words, I'll assume "Head-up" to be my "reference event", and will take the next event with the longest duration time as my "Event" in column M. If none other event other than "Head-up" was recorded in a given interval, then "Head-up" becomes the "Event" in column M.

    Hope that was clear enough. Please ask any questions if something needs to be clarified. I think I could use the "if" function for this as I already did to create columns M and N. However, I don't seem able to cover all three conditions as explained earlier.

    Hope somebody can put me on the right track! Any input is appreciated.

    Cheers
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Classifying the second largest value if a certain condition is not met

    Please try at
    M2
    =INDEX(B$1:K$1,MATCH(MAX(B2:K2),B2:K2,))
    N2
    =MAX(B2:K2)/SUM(B2:K2)

    Drag M2:N2 down
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-06-2018
    Location
    Norway
    MS-Off Ver
    1811
    Posts
    31

    Re: Classifying the second largest value if a certain condition is not met

    Quote Originally Posted by Bo_Ry View Post
    Please try at
    M2
    =INDEX(B$1:K$1,MATCH(MAX(B2:K2),B2:K2,))
    N2
    =MAX(B2:K2)/SUM(B2:K2)

    Drag M2:N2 down
    Thank you for your input.

    This seems to work for cells M11 to M17. However, cell M9 should have "Vigilance" in it, cell M10 should have "Moving" etc.. As mentionned in 2) on my original post:

    "
    2) When "Head-up" has the longest duration time but is accompanied by other events in a given interval (example: interval #2 -row 3-), I'd like to have the SECOND event with the largest duration time as my "Event" in column M with its according "Proportion" in cell N.
    "

    Any ideas on how to fix this?

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Classifying the second largest value if a certain condition is not met

    Is this right?

    M2
    =INDEX(B$1:K$1,MATCH(LARGE(B2:K2,1+(MAX(B2:K2)=C2)-(SUM(B2:K2)=C2)),B2:K2,))

  5. #5
    Registered User
    Join Date
    12-06-2018
    Location
    Norway
    MS-Off Ver
    1811
    Posts
    31

    Re: Classifying the second largest value if a certain condition is not met

    Quote Originally Posted by Bo_Ry View Post
    Is this right?

    M2
    =INDEX(B$1:K$1,MATCH(LARGE(B2:K2,1+(MAX(B2:K2)=C2)-(SUM(B2:K2)=C2)),B2:K2,))
    Perfect that worked! How about N now? I need the proportion of time of the event displayed on the column M relative to the total time (80 seconds except row 2).. Any ideas?

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Classifying the second largest value if a certain condition is not met

    N2
    =index(b2:k2,match(m2,$b$1:$k$1,))/sum(b2:k2)

+ 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. Find largest value based on special condition
    By HNickM in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-27-2017, 06:23 PM
  2. Replies: 4
    Last Post: 04-04-2015, 04:24 AM
  3. Replies: 3
    Last Post: 12-11-2014, 12:04 PM
  4. Classifying entries
    By henryrrjames in forum Excel General
    Replies: 2
    Last Post: 04-28-2012, 09:05 AM
  5. Classifying by description
    By Kupaaq in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-04-2011, 08:15 PM
  6. Sum largest numbers based on condition
    By Daniel Bonallack in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-15-2006, 03:25 PM
  7. [SOLVED] Classifying Data
    By Mad Dog in forum Excel General
    Replies: 1
    Last Post: 10-06-2005, 09:05 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