+ Reply to Thread
Results 1 to 9 of 9

Picking the second value out of two results

  1. #1
    Forum Contributor
    Join Date
    03-16-2007
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2007
    Posts
    202

    Picking the second value out of two results

    Hi guys

    Can someone help me solve this?

    In the example attached, the red formula calculates which of the numbers in columns A-G has the closest value to the number given in the blue column.

    Out of 6, 14 and 18, the closest one to the given number (12) is 14.

    However, when two of the numbers are at the SAME distance to the given number, as in the last two rows, formula returns the first one of them, and i would like it to return the SECOND one.

    So, i want the results of the last two rows to be 10 and 13.

    Any ideas how to fix this?

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: Picking the second value out of two results

    Hey Hitch
    I'm curious why your formula got {} in beginning and the end of it.
    {=INDEX(A1:G1,MATCH(MIN(ABS(A1:G1-H1)),ABS(A1:G1-H1),0))}

    When I edit then enter, the result is #VALUE!

    It's weird

  3. #3
    Forum Contributor
    Join Date
    03-16-2007
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2007
    Posts
    202

    Re: Picking the second value out of two results

    It's done with ctrl+shift+enter

  4. #4
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: Picking the second value out of two results

    Hi another question,
    Please Login or Register  to view this content.
    Another question why you want the last two row to take the high one, but the third row from the last you want 5 not 10?
    5+2.5 = 7.5
    10-2.5 = 7.5
    and you prefer 5 is the closest? why not 10?
    Last edited by BlastRanger; 09-22-2010 at 06:17 AM.

  5. #5
    Forum Contributor
    Join Date
    03-16-2007
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2007
    Posts
    202

    Re: Picking the second value out of two results

    you're right, i want 10 there too, sorry!

  6. #6
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: Picking the second value out of two results

    =INDEX(A4:G4,MATCH(MIN(ABS(A4:G4-H4)),ABS(A4:G4-H4),1)) (Follow by Ctrl+Shift+Enter)
    Copy down
    Is that what you try to get?
    Last edited by BlastRanger; 09-22-2010 at 07:21 AM.

  7. #7
    Forum Contributor
    Join Date
    03-16-2007
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2007
    Posts
    202

    Re: Picking the second value out of two results

    Yes, but why the last two rows (which i added to check the formula) don't work?
    See the file...
    Attached Files Attached Files

  8. #8
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: Picking the second value out of two results

    in this case use this instead :
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    03-16-2007
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2007
    Posts
    202

    Re: Picking the second value out of two results

    Now it's perfect. Thanks!

+ 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