There are two ways to use the PC*MILER Rail-Spreadsheets formula: either type it directly into a cell or use the Formula Wizard (see the Excel on-line Help for more information). All PC*MILER Rail-Spreadsheets formulas will accept strings for station names, integers for SPLC codes, etc. For example, 380000 is a valid SPLC, as is “380000”.

NOTE:  A sample file for Spreadsheet functions – PCRSTEST.XLSX – is in the …\Connect\Excel folder of the PC*MILER Rail installation folder.

Getting the Miles Between Two Points

Currently, the only Excel interface function for PC*MILER Rail-Connect is the function Rmiles, which covers all necessary DLL API functions in order to allow users to calculate mileage between any two points in the PC*MILER Rail rail network database. 

The prototype for this function is:

Rmiles (orig, origRR, origGeo, dest, destRR, destGeo [, RouteHow, RouteFam, RouteType, IncEx] )

Rmiles returns the distance (in tenths of miles) from the origin to the destination calculated using the PC*MILER Rail database. The origin and destination may be designated using any of the available geocode types in PC*MILER Rail (i.e. station/state, SPLC, ERPC, FSAC, and Rule260). The orig/destGeo arguments denote which type of place identifier is being given, while the railroad fields expect (up to) 4-character railroad SCACs (‘CSXT’, ‘NS’, etc.). 

The optional arguments denote the routing options for that particular calculation. Omitting them will cause Rmiles to use defaults. The valid values for the parameters to Rmiles are as follows (bolded, underlined characters indicate the single letter is the parameter):

Any PC*MILER Rail place name or geocode
Any valid railroad abbreviation (SCAC)
City/state, SPLC, ERPC, FSAC, or Rule260
Any PC*MILER Rail place name or geocode
Any valid railroad abbreviation (SCAC)
City/state, SPLC, ERPC, FSAC, or Rule260
Practical, Intermodal, Shortest, Coal/Bulk, Auto Racks, Fuel Surcharge  (Default = P)
Familized, Non-familized
(Default = F for AutoRoute, N for Standard)
Interactive*, AutoRouting
(Default = I)
NOTE: If RouteType is I, the IncEx field should be left blank.
* i.e. “Standard” routing
Include, Exclude – to be valid, double quotes must be included, e.g. type “I”.
NOTE: If RouteType is I, the IncEx field should be left blank.

CAUTION: The PC*MILER Rail database contains several cities and towns that share the same name. For instance, in New Jersey there are three locations called “Port Elizabeth”. If there are multiple instances of the station name you enter, the Rmiles function will match to the first instance of the station name it finds as it searches the database. For this reason, you may want to enter an alternate geocode type for the origin and destination rather than station names.


Rmiles returns -1 if the origin, destination, or a routing option is not valid.  Default route options are for Practical (RouteHow), Familized (RouteFam) , and Interactive (RouteType) routing.

Using Overrides

Overrides are automatically detected and used based on their existence in the PC*MILER Rail override file(s).