+ Reply to Thread
Results 1 to 14 of 14

Conditional Format a cell for Number closest to the original number but is higher in value

  1. #1
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Conditional Format a cell for Number closest to the original number but is higher in value

    I have been searching for a way to conditionally format 1 of three cells (H4, I4, J4) the goal is to turn the cell that is higher than cell C2 but is closest to the number in C2 green to alert the user of the closest match. I found a thread using vlookup to do something similar but I cannot seem to get it to work as an hlookup formula. Anyone have an idea how to accomplish this?

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    Here!

    Put this in Conditional Formatting -

    =AND(H4>$C$1,H4=MIN($H$4:$J$4))

    Hope it helps!

    Deep
    Cheers!
    Deep Dave

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    But unfortunately that might not work if the Value in any of the cell is lesser than C2

    This is more tuff than it seems.. :O
    Last edited by NeedForExcel; 08-12-2013 at 04:42 PM.

  4. #4
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    It is definitely a tough one. I have tried every combination I could think of without any luck. In this case, maybe it would be easier to say if the value in H4, I4 or J4 is equal to or greater than the value in C2?? Of course the goal would then be to find the number that is either equal to or greater than but is the closest of all 3 cells would turn green with the conditional format...

  5. #5
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    This seems to be getting me closer but the cells that are either under cell C2 or are higher are still getting highlighted:
    Please Login or Register  to view this content.
    Does anyone know how to write the formula differently so that only one cell either H4, I4 or J4 that is greater than (not less than) or equal to C2 but is the closest of the 3 cells to C2to highlight with conditional formatting?

  6. #6
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    Try this:

    Conditional Formatting:

    =H$4=MIN(IF($H$4:$J$4>=$C$2,$H$4:$J$4))

  7. #7
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    @Teethless mama

    Even that does not work -

    Assuming the numbers are 54,21,44 & 35 in C2

    This is complicated..

  8. #8
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    Please see the file attached!

    This is the best I could come up with. A helper cell used..


    Hope it helps!

    Deep
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    Your sample spreadsheet seemed to work well but put a limitation on the maximum number. For instance if 39 is entered into cell C1 then nothing happens. If 38 or less is entered it works properly.
    Last edited by tm1274; 08-13-2013 at 08:58 AM.

  10. #10
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    Yes! That is because there in no entry bigger in Cells H5, I5 & J5 than C1 in the example in the attached sheet. How can it highlight the next biggest number in that case?

    Deep

  11. #11
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    Good point. Only one problem though. It works great in your copy of the spreadsheet but not in mine. Can you think of any reason it would not work in mine after being copied? I copied all 5 cells (includes the helper) and pasted it in, as well as copied each formula and formatting for each cell so it should be exactly the same. For some reason it does not work.

  12. #12
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    This must have something to do with the cells H4, I4 and J4 being calculations?? What this should do is H4 would equal C13*6 for a value of (1800), cell I4 would then be a calculation of the value of H4*6 for (10,800) and J4 would be the calculation of the value of I4*6 (64,800) and so the conditional format would look at cell C2 and see which of these (H4, I4 or J4) would be the number equal to or greater than but the closest to the number in C2. Would the calculation in each of these cells prevent this from working?

  13. #13
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    Can you attach your workbook?

  14. #14
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: Conditional Format a cell for Number closest to the original number but is higher in v

    Sure, here you go, I think I may have it working right now. But to be honest I am not sure how or why it is working. I copied everything from your sheet and it did not work but after I reopened the sheet it appears to be working...
    Calc.xlsx
    Last edited by tm1274; 08-13-2013 at 12:59 PM.

+ 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: 1
    Last Post: 07-19-2012, 05:36 PM
  2. Conditional format closest number in a range
    By purdue7997 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-06-2012, 04:36 PM
  3. Replies: 7
    Last Post: 03-22-2010, 05:22 PM
  4. [SOLVED] comparing a value in a cell to see if it is higher than a number
    By PK in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-06-2005, 03:05 AM
  5. [SOLVED] comparing a value in a cell to see if it is higher than a number
    By PK in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-05-2005, 10: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