+ Reply to Thread
Results 1 to 6 of 6

Monthly milage calulation

Hybrid View

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    New England
    MS-Off Ver
    Excel 2007
    Posts
    3

    Monthly milage calulation

    I have been tasked with creating a form to track mileage on several vehicles in our fleet.

    What they want to do is calculate the mileage difference every month for a total year, but only show the mileage difference in the total mileage column.

    For example: row 1 list every month for the year starting with DEC of the previous year.
    Capture.PNG

    The final cell is for the total (P2). That cell needs to calculate the difference over every month and only show the subtracted total from each month. example: the difference between cell F2(23,605) - E2(22,000), answer 1,605. Then it needs to change the value in P2(1,605) to be the difference between G2(24,812) - E2(22,000), answer 2,605. the new answer of 2,605 now needs to replace the number P2.



  2. #2
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: Monthly milage calulation

    =index(c2:l2,0,match(1,(c2:l2>0)*1,1))-index(c2:l2,0,match(1,(c2:l2>0)*1,0))

  3. #3
    Registered User
    Join Date
    10-24-2012
    Location
    New England
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Monthly milage calulation

    Thank you. I did try the calculate you posted but it does not work.

    He is a jpeg of the sheet I am using. Please keep in mind that there will be nothing in the blank cells until that month is over.

    Mileage report.JPG

    Please help.


    Quote Originally Posted by eisayew View Post
    =index(c2:l2,0,match(1,(c2:l2>0)*1,1))-index(c2:l2,0,match(1,(c2:l2>0)*1,0))
    Last edited by rlevesque; 10-31-2012 at 08:30 AM.

  4. #4
    Registered User
    Join Date
    10-24-2012
    Location
    New England
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Monthly milage calulation

    Just tried the formula again; =index(c2:l2,0,match(1,(c2:l2>0)*1,1))-index(c2:l2,0,match(1,(c2:l2>0)*1,0)) and found that this step was missed:

    Press CTRL+SHIFT+ENTER to enter the formula as an array formula.
    Last edited by rlevesque; 10-31-2012 at 12:53 PM.

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Monthly milage calulation

    in F3

    =f2-e2
    and drag to the left and right.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,956

    Re: Monthly milage calulation

    not every1 can open .png files, myself included. It would be far better if you could upload a sample of your file, showing what you have, and an example of your expected outcome. Thanks
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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