I have two large lists. One is a list of stores and one is a list of customers. I use a distance formula between Latitude and Longitude to map the store number to the customer list. The issue I have is I need every "store" in the store list to be assigned at least a customer. (Customer list could range between 50k+) I manually do a count on the mapped stores, index the store list and find any zeros. Then I'll filter by that 0 store zipcode and find a mapped store with the largest count and divide that by equal groups. I am looking for a way to do this process across all of my potential 0 stores mapped or even stores with less then "x" number of customer maps. The consolidated list example would be
Customer name, address, Zip, closest store number.
The store list is a full address zip of all stores.
Store number - store Address - zip
The formula I use to map the addresses.
=LOOKUP(1,1/ FREQUENCY(0,SIN((RADIANS(lat1rng-
Lat2))/2)^2+SIN((RADIANS(lng1rng
Lng2))/2)^2*COS(RADIANS(lat1rng))
*COS(RADIANS(lat2))),storenumber)
Sample Data (The customer list changes a little bit pending on how the list comes to me. That's another reason why Zip will be the best rout to go for this.
Store List (approx 2,500)
Store # | area | Address | Zip | Zip 4 | Zip Full | Mapped Calls
1 X X 00001 0001 00001-0001 100
2 X X 00001 0001 00001-0002 0
3 X X 00001 0001 00001-0003 2
4 X X 22222 0001 22222-0001 20
5 X X 22222 0001 22222-0002 0
Customer List (any where from 50k to 1 Mil+ possibly)
Customers| Address | Zip | Zip 4 | Zip Full | Mapped Store
Id1 X 00001 0001 00001-0001 1
Id2 X 00001 0001 00001-0002 1
Id3 X 00001 0001 00001-0003 1
Id4 X 00001 0001 22222-0001 4
Id5 X 00001 0001 22222-0002 4
I Need a way to allocate some of "store 1's 100 calls" into stores 2 and 3 (this is a variable group) Not necessarily even distribution. store 4 and 5 only have a group of 2 to split up the mapping.