+ Reply to Thread
Results 1 to 5 of 5

Find closest values to a given value?

  1. #1
    Registered User
    Join Date
    01-18-2013
    Location
    Minneapoils, Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    15

    Find closest values to a given value?

    Hey there! I've got a question for anyone more literate in Excel than I am.

    So, I'm making a scouting sheet for a robotics competition I'm in. Most of it works just fine, but I'm working on a sheet that gives you details on one team in particular: The team you enter in B1 of that sheet.

    Then, it takes the team number in B2 and gets its basic data from 'Master'. All of the relevant data is in C7:G11 of 'Team Details'. What I want is this: It looks at the data from C7:G11 and finds numbers close to that in the range of Master!AC298:AC354 (for row 7) and finds its corresponding team number. I already have something like this done with these two formulas, for D7 and E7, respectively:

    =SUMIFS(Master!AC298:AC354,Master!X298:X354,'Team Details'!B1)
    =SUMIFS(Master!AW298:AW354,Master!AU298:AU354, 'Team Details'!B1)

    AC is the data lookup row. X is the team number row, which is compared with B1, which houses the team number it picks the data based off of - basically, say B1 houses 171. Only data in the AC column WITH 171 in the corresponding row under the X column would get picked.

    I want to extend this a bit. I want to call up team numbers (X298:X354) that have numbers close to the data shown in, say, E7 of 'Team Details'. So if 1816 had an Autonomous average of 18 and 171 (our B1 team) had an Autonomous average of 16, '1816' would appear in L7, which is the box for "Lower Than..." and "Autonomous Average". It would show the closest team that it had a higher average than in a similar fashion.

    I've found many things online that achieve this, sort of - but I don't understand any of them.

    The sheet is attached via dropbox (it's too big for the forums) - the only ones you need to be worried about are "Master" and "Team Details".

    Download the sheet here. It's called "Scouting_Match_2013_Final.xlsm". - https://www.dropbox.com/sh/lwpc0ae8am77ayo/XHVDnKYB1x

    Thank you so much! If you want me to re-explain anything, as this is probably an incoherent mess, I'd be more than happy to.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Find closest values to a given value?

    Hi

    Team Details!J7: =MAX(IF(Master!AC298:AC354<'Team Details'!C7,Master!AC298:AC354,""))
    L7: =MIN(IF(Master!AC298:AC354>'Team Details'!C7,Master!AC298:AC354,""))

    Both these formulas are array entered (ctrl, shift, enter).

    Is this what you are chasing?

    rylo

  3. #3
    Registered User
    Join Date
    01-18-2013
    Location
    Minneapoils, Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Find closest values to a given value?

    That's really close. It pulls up the relevant number in M1 - in this case, in 'Master', AC316 for what it's just above and AC302 for what it's just below - but I want it to go a step further. For those two cells, the X-column (team) values that correspond to it are 2654 and 2129 respectively.

    I would like it to display the values that are in that row's X-column value, if that makes sense. So if AC316 is the value that it determines is just above Team Details:C7, it would display the value in X316 rather than the value in AC316.

    Does that make sense?

    Thank you for your help!

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Find closest values to a given value?

    Hi

    =INDEX(Master!X298:X354,MATCH(MAX(IF(Master!AC298:AC354<'Team Details'!C7,Master!AC298:AC354,"")),Master!AC298:AC354,0))
    and
    =INDEX(Master!X298:X354,MATCH(MIN(IF(Master!AC298:AC354>'Team Details'!C7,Master!AC298:AC354,"")),Master!AC298:AC354,0))

    Array entered.

    rylo

  5. #5
    Registered User
    Join Date
    01-18-2013
    Location
    Minneapoils, Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Find closest values to a given value?

    Yeah, that works perfectly! Thanks for your help.

+ 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