Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Marco similar to a SAS program

Hi,

I am not sure where else to ask but this seems like the place.

My job uses Office 2000. Let the groaning commence. What I am trying to do
is create a Macro in Excel 2000 that duplicates what a macro in SAS does?

The macro in SAS takes the Longitude and Latitude for a business, goes
through a list of all our store location long and lat and figures the
distance, then keeps the minimun distance.

There are about 1020 Store locations. The number of Business is currently
10 though that number could change depending on sales.

SAS works great for things like this. The idea is to get it into Excel and
then let the department requesting the information do it on their own.

Any advice would be greatly.

Thanks
Christian Falde
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Marco similar to a SAS program

Excel would have no problem doing this.

Depending on the output you'd like you could approach it a couple different
ways. Are the 10 businesses always going to be the same?

I would set up all your store locations with long/lat on one sheet and all
your business locations with long/lat on another sheet. Define a dynamic
range for the business locations and then use a For Each loop to go through
each location.

Rather than looping through all the store locations I would feed the current
bus location into long/lat cells on the store location sheet and set up
forumlas to determine the distance from a to b using pythagorean. Each time
you loop to a new business location you would reset the long/lat of the
business location on the store location sheet. The formulas will recalculate
and then sort you should use .sort to find the shortest distance




"Christian Falde" wrote:

Hi,

I am not sure where else to ask but this seems like the place.

My job uses Office 2000. Let the groaning commence. What I am trying to do
is create a Macro in Excel 2000 that duplicates what a macro in SAS does?

The macro in SAS takes the Longitude and Latitude for a business, goes
through a list of all our store location long and lat and figures the
distance, then keeps the minimun distance.

There are about 1020 Store locations. The number of Business is currently
10 though that number could change depending on sales.

SAS works great for things like this. The idea is to get it into Excel and
then let the department requesting the information do it on their own.

Any advice would be greatly.

Thanks
Christian Falde

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Marco similar to a SAS program

In column A I would put the store name or id.
In column B the lattitude
In column C the longitude

Pick a business
Fill column D with the business lattitude (all the same)
Fill column E with the business longitude (all the same)

Fill column F with the distance formula found in:

http://www.cpearson.com/excel/latlong.htm

Finally sort cols A thru F by F descending.
The top entry will be the closest.

Repeat for the next business, etc.
--
Gary''s Student - gsnu200810


"Christian Falde" wrote:

Hi,

I am not sure where else to ask but this seems like the place.

My job uses Office 2000. Let the groaning commence. What I am trying to do
is create a Macro in Excel 2000 that duplicates what a macro in SAS does?

The macro in SAS takes the Longitude and Latitude for a business, goes
through a list of all our store location long and lat and figures the
distance, then keeps the minimun distance.

There are about 1020 Store locations. The number of Business is currently
10 though that number could change depending on sales.

SAS works great for things like this. The idea is to get it into Excel and
then let the department requesting the information do it on their own.

Any advice would be greatly.

Thanks
Christian Falde

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to unload the loaded XLL file in Excel? Hi all, I amdebugging XLL link library using Visual C++. Everytime I rebuild the XLL, Ihave to close the whole Excel program and relaunch the Excel program again,and then load in the newly gene LunaMoon Excel Discussion (Misc queries) 0 July 28th 08 11:03 PM
help me with this marco Gary Keramidas Excel Programming 1 April 22nd 06 02:01 AM
Marco program Freeman_100 Excel Programming 1 April 6th 06 12:40 AM
merging excel program with tdc finance program judy Excel Programming 0 November 5th 03 08:01 PM


All times are GMT +1. The time now is 07:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"