+ Reply to Thread
Results 1 to 5 of 5

Returning Closest Match between "y" and "z" to "X"

  1. #1
    Registered User
    Join Date
    12-05-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    1

    Returning Closest Match between "y" and "z" to "X"

    Problem :

    I have to RETURN the CLOSEST match to "X"

    EG. X=60, y=61, z=58
    Y (61) is the closer match to 60 and needs to be displayed

    or lets look at this one :

    X=0, y=-1, z=2

    Y is closer to X than z and therefor needs to be displayed.

    I found solutions if you have a table...but I have one specific cell i need to reference against.

    any ideas anyone?

  2. #2
    Forum Contributor ianh's Avatar
    Join Date
    11-19-2010
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Returning Closest Match between "y" and "z" to "X"

    Please Login or Register  to view this content.
    Have a look at my sample attached. Is this what your trying to achieve?
    Attached Files Attached Files
    2+2=5 for extremely large values of 2.

  3. #3
    Forum Contributor
    Join Date
    08-17-2009
    Location
    West Midlands
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Returning Closest Match between "y" and "z" to "X"

    Or, assuming your X values are in column A, your Y values in column B and your Z values in column C you could try:

    =IF(ABS(B2-A2)>=ABS(C2-A2),C2,B2)

    Which will get around the problem of a SUM returning a negative value.

    Steve

  4. #4
    Forum Contributor ianh's Avatar
    Join Date
    11-19-2010
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Returning Closest Match between "y" and "z" to "X"

    sorry, that wont work will it.
    change the formula in C5 in my sample to
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor ianh's Avatar
    Join Date
    11-19-2010
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Returning Closest Match between "y" and "z" to "X"

    Hadnt considered the minus values fully either.

    try
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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