Maybe a pivot table?:

<Data><Pivot Table>
Use: Excel
Select your data
Click the [Layout] button

ROW: Drag the TruckNUmber field here

DATA:
Drag the Odometer field here
dbl-click it and set it to Min

Drag the Odometer field here, again
dbl-click it and set it to Max

Click [OK]
Select where you want the Pivot Table...and click the [Finish] button

That will list each truck and the Min and Max odometer readings...but, in
the wrong configuration (stacked instead of side by side).

Click and hold on the DATA heading
Drag it on top of the Total heading and release.

Now the Min and Max are side by side

All that's left to do is put formulas to the right that subtract the Min
from the Max.
If Excel keeps creating the GetPivotData function when you attempt to build
the formula....you can disable that feature by following the instructions at
Debra Dalgleish's website:
http://www.contextures.com/xlPivot06.html#GetPivotData

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"markstro" wrote:

> I have a collection of data in a spreadsheet that is 50,000 + lines
> long for truck mileage sorted by vehicle number.
> The column left of the truck number is the odometer reading when it was
> fueled.
> I need a formula or function that will find the first entry and last
> entry for each vehicle and subtract the last mileage from the first to
> give me total mileage for each vehicle.
> The total lines for each vehicle varies from vehicle to vehicle.
> Hope I gave enough info to figure this out.
> Thanks, Mark
>
>