+ Reply to Thread
Results 1 to 5 of 5

Conditional Formatting highlight closest value in range without going under

  1. #1
    Registered User
    Join Date
    07-25-2017
    Location
    ontario canada
    MS-Off Ver
    office 2007
    Posts
    2

    Thumbs up Conditional Formatting highlight closest value in range without going under

    Hi there,

    I am looking to find out how to highlight one cell of a group of cells where it is closest to a target number without going under said number.

    Here is my example.


    ...... R . S . T . U . V . W
    34 | 28 58 68 . . . . 57.556
    35 | 56 86 96
    36 | .. 116 126
    37 | . . . . 136


    I would like to know how I can conditionally format to highlight the closest number to W34 from the selection of R34:R35,S34:S36,T34:T37 without going under. So right now S34(58) would be highlighted, and if W34 changed to 59, then T34(68) would highlight instead.

    I am having a hard time figuring this out, and I have googled my brain out.

    Can anyone help me? Thank you in advance!

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional Formatting highlight closest value in range without going under

    Hi, welcome to the forum.

    If your range is from R34 to T37, like in your example, highlight R37:T37 > Conditional Formatting > New Rule > Use a formula

    =R34=MIN(IF($R$34:$T$35>$W$34,$R$34:$T$35))

    Format: Fill color of your choice > OK > OK.

  3. #3
    Registered User
    Join Date
    07-25-2017
    Location
    ontario canada
    MS-Off Ver
    office 2007
    Posts
    2

    Re: Conditional Formatting highlight closest value in range without going under

    Wow yes thank you so much! This helped perfectly.

    I don't understand the =R34= part of the formula. So I kept getting stuck. Is there an explanation on how this works? I wouldn't mind knowing for future, and I love learning new formulas.

  4. #4
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional Formatting highlight closest value in range without going under

    Great! Happy to help.

    The MIN IF section returns the minimum value in R34:T35 that is greater than the value in W34.

    The formula returns TRUE if the value in R34 is equal to the value from the MIN IF formula.
    You use the top left cell of the selected range in a Conditional Formatting formula.

    The Conditional Formatting formula runs for all of the cells in the range (R34, S34, T34, R35, S35, and T35) and highlights any cell where the formula returns TRUE.

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional Formatting highlight closest value in range without going under

    I just realized that there should be an equal sign added to the MIN IF formula from post #2 in the event that a value in the range is equal to W34.

    That is:
    =R34=MIN(IF($R$34:$T$35>=$W$34,$R$34:$T$35))

    If that solved your question, please mark this thread as SOLVED.

+ 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. Replies: 5
    Last Post: 01-26-2017, 10:15 PM
  2. Conditional formatting - highlight between date range
    By Kiwi129 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-04-2016, 08:32 PM
  3. [SOLVED] Conditional Formatting to Highlight a Range when Today is between Two Dates DD/MM
    By AliGW in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-04-2015, 11:10 AM
  4. [SOLVED] Conditional Formatting - highlight cells if range count = 0
    By VBA FTW in forum Excel General
    Replies: 2
    Last Post: 11-25-2013, 04:45 PM
  5. Conditional Formatting to highlight duplicate numbers in a range
    By mungel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-21-2013, 02:54 PM
  6. Conditional formatting - highlight range of cells when it equals a cell
    By kingkong321 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-20-2012, 05:13 AM
  7. highlight comparison using conditional formatting with formula in range
    By tjc0ol in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-29-2011, 08:48 AM

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