+ Reply to Thread
Results 1 to 5 of 5

How do i highlight a cell that is the closest number to a different cell.

  1. #1
    Registered User
    Join Date
    04-04-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    27

    How do i highlight a cell that is the closest number to a different cell.

    Please Login or Register  to view this content.
    New member so forgive my lack of formating on this site...pretend it is on the top left beginning of the excel page.

    I am running a time series linear regression on a credit card company. The left most column is the amount of cards they had on a certain year and the prediction is the cards the regression formula predicted. The + and - are the columns added or subtracted the standard error which is 3.25. I am trying to highlight the closest +/- number to the original cards. For example, in the first Row 76.98 is closer to 78 than 83 is so i would like to have 76.98 highlighted...showing that subtracting the standard error gave us the closest prediction. The second column the 87.085 cell should be highlighted because adding the standard error gave us the closest prediction to 86.4.

    Thank You in advance!!
    Last edited by JBeaucaire; 04-04-2014 at 03:42 PM. Reason: formatting

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How do i highlight a cell that is the closest number to a different cell.

    Assuming those +/- values are in columns C and D:

    1) Highlight C2:D9 (or as far down as needed)
    2) Apply this conditional formatting formula:

    =MIN(ABS($A2-$D2),ABS($A2-$C2))=ABS($A2-C2)

    http://screencast.com/t/6ACwcO7J2l
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,312

    Re: How do i highlight a cell that is the closest number to a different cell.

    If your data is in columns A to D, with headers in row 1, select from B2 to D??? - with B2 as the activecell - and use CF with the formula option, using the formula

    =ABS($A2-B2)=MIN(ABS($A2-$B2:$D2))
    Bernie Deitrick
    Excel MVP 2000-2010

  4. #4
    Registered User
    Join Date
    04-04-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: How do i highlight a cell that is the closest number to a different cell.

    You are awesome! Thank You

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How do i highlight a cell that is the closest number to a different cell.

    I've marked this thread as SOLVED for you.
    Next time, select Thread Tools from the links above to mark a thread as SOLVED. Thanks.

+ 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. [SOLVED] Cell with text and number, not rounding to closest full number
    By cblp in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-03-2014, 07:51 PM
  2. [SOLVED] How to round cell value to closest whole number? Excell programming / VBA / MAcros
    By akbar1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2014, 09:43 PM
  3. Replies: 13
    Last Post: 08-13-2013, 12:51 PM
  4. Replies: 2
    Last Post: 07-28-2013, 05:41 PM
  5. use vba to highlight closest number match
    By Toidz77 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-07-2009, 12:55 PM

Tags for this Thread

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