+ Reply to Thread
Results 1 to 6 of 6

CALCULATING SUMS

  1. #1
    markstro
    Guest

    CALCULATING SUMS

    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


  2. #2
    Ron Coderre
    Guest

    RE: CALCULATING SUMS

    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
    >
    >


  3. #3
    Biff
    Guest

    Re: CALCULATING SUMS

    Hi!

    Try this:

    Column A = odometer reading
    Column B = vehicle number

    =LOOKUP(2,1/(B$1:B$50000=Vehicle_Number),A$1:A$50000)-INDEX(A$1:A$50000,MATCH(Vehicle_Number,B$1:B$50000,0))

    Biff

    "markstro" <mstrohmeyer@superiorrm.com> wrote in message
    news:1154735202.202464.257980@m79g2000cwm.googlegroups.com...
    >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
    >




  4. #4
    Biff
    Guest

    Re: CALCULATING SUMS

    >subtract the last mileage from the first

    Hmmm.....

    My formula does the opposite!

    Just flip it around so that it's:

    =INDEX(........)-LOOKUP(........)

    Biff

    "Biff" <biffinpitt@comcast.net> wrote in message
    news:Oe5WrODuGHA.2172@TK2MSFTNGP05.phx.gbl...
    > Hi!
    >
    > Try this:
    >
    > Column A = odometer reading
    > Column B = vehicle number
    >
    > =LOOKUP(2,1/(B$1:B$50000=Vehicle_Number),A$1:A$50000)-INDEX(A$1:A$50000,MATCH(Vehicle_Number,B$1:B$50000,0))
    >
    > Biff
    >
    > "markstro" <mstrohmeyer@superiorrm.com> wrote in message
    > news:1154735202.202464.257980@m79g2000cwm.googlegroups.com...
    >>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
    >>

    >
    >




  5. #5
    markstro
    Guest

    Re: CALCULATING SUMS

    I am trying to work out the pivot table suggestion, however, I tried
    yours as well and have a few questions.
    I get an #N/A when I type your formula as shown.
    Vehicle number is in column E titled TRUCK, odometer is column D
    labeled ODO
    What does the 2,1/ mean at the beginning of your formula?
    What should the result look like when I get the bugs out of the
    formula?
    Thanks for your help
    Mark
    Biff wrote:
    > Hi!
    >
    > Try this:
    >
    > Column A = odometer reading
    > Column B = vehicle number
    >
    > =LOOKUP(2,1/(B$1:B$50000=Vehicle_Number),A$1:A$50000)-INDEX(A$1:A$50000,MATCH(Vehicle_Number,B$1:B$50000,0))
    >
    > Biff
    >
    > "markstro" <mstrohmeyer@superiorrm.com> wrote in message
    > news:1154735202.202464.257980@m79g2000cwm.googlegroups.com...
    > >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
    > >



  6. #6
    markstro
    Guest

    Re: CALCULATING SUMS

    Thanks Ron, it worked just fine, you even got me over a hurdle
    regarding pivot tables I have been struggling with (self teaching).
    Thanks again, Mark
    Ron Coderre wrote:
    > 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
    > >
    > >



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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