+ Reply to Thread
Results 1 to 5 of 5

Finding the closest locations with 2 variables

  1. #1
    Registered User
    Join Date
    02-19-2013
    Location
    Earth
    MS-Off Ver
    Excel 2010
    Posts
    15

    Finding the closest locations with 2 variables

    I have created a locator spreadsheet previously by just finding the closest location via latitude and longitude previously using the following formula. However, now I need to add a second variable need to find the associated National Account then find the closest wholesaler of that specific National Account. I am having trouble implementing the first variable into the array formula below. For example: I want to find the closest locations of National Account "Fast Food 1" and only those entries in the table. The formula below only finds the closest locations via latitude and longitude, which would include Wholesalers not associate with "Fast Food 1".

    I linked a image of the sheet I am working on below. the way I have it set up right now is it finds the closest 8 locations and returns the Name of the wholesaler into cells E2-L2. The latitude and longitude in cells C2 and B2 change with a vlookup off of a zip entered on another sheet.

    I am stumped on how to first find the associated National Account in cell B2 then find the closest locations of only that National account using their latitude and longitude. Any help would be appreciated.

    {=INDEX(Table3[Name], MATCH(SMALL(SQRT((Table3[Latitude]-$C2)^2+(Table3[Longitude]-$D2)^2), E$1), SQRT((Table3[Latitude]-$C2)^2+(Table3[Longitude]-$D2)^2), 0))}

    http://imgur.com/a/2ElqE

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,640

    Re: Finding the closest locations with 2 variables

    Try array formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    02-19-2013
    Location
    Earth
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Finding the closest locations with 2 variables

    I tried that array formula and it returned #NUM. I have attached the sample file as well.
    Attached Files Attached Files

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,640

    Re: Finding the closest locations with 2 variables

    In E2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-19-2013
    Location
    Earth
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Finding the closest locations with 2 variables

    that works perfect. Thank you very much.

+ 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. Finding the closest-lower value in a range of data, using 2 variables
    By Vermili0n in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-30-2015, 08:32 PM
  2. [SOLVED] Closest match multiple variables
    By zack7373 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-11-2013, 11:30 AM
  3. create variables refering to cell locations with VBA
    By KATIEexcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2012, 05:56 AM
  4. VB code to compare distances and give me a list of locations Closest to furthest
    By kal-el.Kanata in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2011, 03:33 PM
  5. Replies: 0
    Last Post: 07-25-2011, 05:58 PM
  6. Locations finding
    By tbobo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-02-2008, 07:16 PM
  7. Find the closest date based on 2 variables
    By WPeters in forum Excel General
    Replies: 2
    Last Post: 08-15-2007, 06:38 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