+ Reply to Thread
Results 1 to 8 of 8

Conditionally format: Only if unique identifier and exceeds % of previous record

  1. #1
    Registered User
    Join Date
    09-13-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    20

    Question Conditionally format: Only if unique identifier and exceeds % of previous record

    So my problem pretty much is as the title states. I basically want to design a way to test if a patient's value for a parameter is abnormal compared to the rest of their values (previous record, adjacent records, average of all their records). I am not sure on the best method. For example, I might want to be able to flag blood pressures that are 25% greater or smaller than their other records as a way to systematically find which records I need to manually check for validation.

    I want to conditionally format cells only if:
    A) they have the same unique patient ID (PID) found in the first column
    B) The value is 15% or greater than the previous record (or, even better, greater / lower than 15% of adjacent records values, or best, 15% against their average)

    Each patient has a record per day of visit. I have sorted by newest date and then PID.
    Example.ConditionalHighlight.xlsx
    I have already tried this for SBP (you can see my example as green colored)
    Format values where this formula is true: =J2/1.15>J3 and Applies to =$J:$J
    While this works, for some cells (marked as good), when it is compares records from different people, or worse, blanks, it fails (WRONG).

    What is the best way to go about solving this? I already have conditional formatting for extreme highs or lows a column, but nothing to figure out relative to their own records.

    Any help would be appreciated. I'm just really tripped up on how to design a formula find "I want to highlight this cell based on this parameter, ONLY IF they have the same record."

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Conditionally format: Only if unique identifier and exceeds % of previous record

    I tested this on column J, and it looks like it works, but you can judge that better than me. it did not pull out a TRUE for row 8, because both sets of data are the same, so +- 15% doesnt work for that. anyway, give it a shot and let me know...

    =AND(J2<>"",OR(J2<=AVERAGEIF($A$2:$A$35,A2,$J$2:$J$35)*0.85,J2>=AVERAGEIF($A$2:$A$35,A2,$J$2:$J$35)*1.15))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Conditionally format: Only if unique identifier and exceeds % of previous record

    hi JJ22. if you are indeed using Excel 2003 as stated, then replace the AVERAGEIF formula provided by FDibbins & use SUMIF divided by SUMPRODUCT like this:
    Please Login or Register  to view this content.
    and if your requirement is less/more than 15%, then remove the "=" signs beside the "<" & ">"

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Conditionally format: Only if unique identifier and exceeds % of previous record

    Thanks beni I based my assumption of 200+ on the .xlsx file the OP uploaded

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Conditionally format: Only if unique identifier and exceeds % of previous record

    sure thing~ just providing a backup.
    =)

  6. #6
    Registered User
    Join Date
    09-13-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Conditionally format: Only if unique identifier and exceeds % of previous record

    I'll try this out today. Forgot my flash drive at my office with the document... doh.

    P.S. I can't believe you caught that I had 2003 in profile. Talk about level of detail! I've changed it to reflect what I use.
    Last edited by JJ22; 11-19-2012 at 09:34 AM.

  7. #7
    Registered User
    Join Date
    09-13-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Conditionally format: Only if unique identifier and exceeds % of previous record

    Works like a charm! It averages the values for each patient and then compares the cell to the average if it is 15%+/-. I think this will work. I'll play with it tonight and report back.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Conditionally format: Only if unique identifier and exceeds % of previous record

    happy to help and thanks for the rep

+ 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