+ Reply to Thread
Results 1 to 4 of 4

Identify/highlight maximum value based on multiple criteria

  1. #1
    Registered User
    Join Date
    12-04-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    2

    Identify/highlight maximum value based on multiple criteria

    Hi folks,

    Here's one I've been struggling with for a couple of days:

    I have a file with telemetry data for n individuals. For each individual I have data on a number of days, over the course of a couple of years. On any given day, I have from 1 to several "fixes" for an individual. Fixes range from 1 to 3, with 3 being the "best". Note that I do not necessarily have data for all individuals on a given day.

    What I want to do is extract the row with best fix for each individual, on each day for which I have data for that individual. If there is more than one best fix for an individual on a given day, then I want to choose the first best fix (temporally). Right now my data is set up with columns:

    INDV DATE TIME FIX ....other attributes

    INDV = unique code identifying the individual

    The data is sorted by INDV, then by DATE, then by TIME.

    I figured I could do this using nested IF statements, where "TRUE" would be added to a new column (e.g., HIGHFIX) in the row of the first highest fix on each day for each individual, but have not been successful in doing this. I've also tried conditional formatting. Again, no success here.

    Any thoughts/ideas would be much appreciated. It's a very large dataset, so I'd like to avoid doing this manually.

    Cheers and thanks,
    Jenn
    Last edited by JennB; 12-06-2009 at 06:25 PM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Identify/highlight maximum value based on multiple criteria

    Hi Jenn, and welcome to the forum.

    Would you mind putting together a quick spreadsheet with some sample data that mimics your actual data, as well as the results you would expect? It would make it easier for the folks to provide a solution that would likely work the first time (or quicker than by just making assumptions).

    You can upload Excel files directly to the thread, up to a certain limit. We don't need to see a lot of data, as long as the data you provide is setup the same as your real data and is enough to cover any exceptions or variations.

    Thanks!

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Identify/highlight maximum value based on multiple criteria

    In addition to Paul's comments...

    It would probably prove worthwhile to create a further column on your source sheet that sums Fix (Integer) and Time (decimal) values... eg:

    If we assume FIX is Column D and Time is Col C then in first blank column: =SUM($D2,1-$C2) ... copied down

    The addition of this column would then permit you to sort your data by: INDV (Asc), DATE (Asc), FIX/TIME (DESC)
    (the use of 1-Time means the earlier the time the bigger the decimal value - given we are going to sort by the Fix+Time value in Desc order and that earliest time is preferred that adjustment is important)

    With the above sort in place identifying/flagging the "first" best result in a new column is then as simple as checking the combination of INDV Column (A) and DATE Column (B) of the current row against the prior row - if the combination of the two values is different you know (given the sorting) that the current row must be the best result for that INDV on that given Date.

    With the above flag in place you can then - if preferred push all of your data into a Pivot Table and use this new "flag" column as a Page Filter so as only to display where TRUE ... by setting up the other fields in the PT as appropriate (Row Fields, Data Fields) etc you can generate your output quite easily.
    Last edited by DonkeyOte; 12-05-2009 at 05:24 AM.

  4. #4
    Registered User
    Join Date
    12-04-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Identify/highlight maximum value based on multiple criteria

    Genius! I didn't even think of combining the fix and time variables - it totally worked! Thank you DonkeyOte.

    Thanks for your feedback as well Paul - if I post another question in the future, I'll be sure to upload some sample data!

    Cheers,
    Jenn

+ 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