+ Reply to Thread
Results 1 to 18 of 18

Help Needed With Current Mileage Calculation

  1. #1
    Registered User
    Join Date
    07-30-2016
    Location
    Atlanta, GA
    MS-Off Ver
    2011
    Posts
    13

    Lightbulb Help Needed With Current Mileage Calculation

    Screenshot.png

    Looking for some knowledgeable help to figure out how I may be able to construct a formula, unless a Macro is needed for this instance, to calculate the current mileage for cell G21 without showing a negative or incorrect number. Currently, I have cells D11, D15, H11, and H15 calculating the quarterly mileage with a simple formula of =SUM(D9-D10), showing just Q1 formula for the example. Cells D17, D19, G17, and G19 are just restating the total mileage per quarter. What my goal is, is to have cell G21, which is currently using a formula of =SUM(D17+D19+G17+G19), be able to show the current mileage so far for the year but the issue I run into is that if you have Q1 fully calculated out and submit the beginning mileage for Q2, it throws the total current annual mileage off with an incorrect mileage reading. Is there a helpful way or formula that can be built or used to show a calculated current mileage without other input per quarter throwing it off?

    A little background info - I am using some spare time off from work to build a spreadsheet for my boss that helps us keep record keeping for expenses, costs, mileage, ect. for our trucking company. At this point, I may be overlooking something simple to my problem/question as I am about burnt out!

    Thank you in advance for any help, response, or time in looking into my proposed question. I really appreciate it!

    Sincerely,

    BaconFanatic2

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,855

    Re: Help Needed With Current Mileage Calculation

    Hi and welcome to the forum

    Pictures are of little value. Honestly, no one wants to re-type your data to try and solve your issue. Additionally, we would only be guessing at how your data was structured, ie. formulas, formatting, etc.

    Please attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not) and an "After" of what you wish the output to be.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    07-30-2016
    Location
    Atlanta, GA
    MS-Off Ver
    2011
    Posts
    13

    Re: Help Needed With Current Mileage Calculation

    Alan,

    Please let me apologize as I should've looked for some forum rules and standards prior to posting. However, thank you for informing me as well as briefing me on how to post appropriately.

    Attached is a copy of the spreadsheet. Below are the formulas used for specific cells. The outcome I am looking for is to get cell G14 (attached sample workbook) to show a current mileage based on adding each quarter together without showing a negative calculation or a wrong number due to inputting the beginning mileage for the next quarter and not being able to show a full quarter worth of mileage yet.

    Please let me know if this is a correct way to post my question in this forum as I would like to make my question easier for anybody who takes the time to read my post. If not, I will edit and repost.

    Thank you for the warm welcome!

    -BaconFanatic2

    Quarterly Mileage:

    Cell D4: =SUM(D2-D3)
    Cell D8: =SUM(D7-D6)
    Cell H4: =SUM(H2-H3)
    Cell H8: =SUM(H7-H6)

    Total Mileage for Year:

    Cell G14: =SUM(D10+D12+G10+G12)
    Attached Files Attached Files

  4. #4
    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,926

    Re: Help Needed With Current Mileage Calculation

    Hi, welcome to the forum

    I will take a look for you.

    Just a quick pointer - you dont need to use SUM to add 2 (or 3 ) cells together, you just use =A1+B1+C1. What you have is not wrong, just unnecessary. You normally use SUM for a range of cells =SUM(A1:J1)
    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

  5. #5
    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,926

    Re: Help Needed With Current Mileage Calculation

    OK I have restructured your table into a more streamlined format...
    A
    B
    C
    D
    16
    Start End Mileage
    17
    Q1
    100000
    124000
    24000
    18
    Q2
    124000
    148000
    24000
    19
    Q3
    20
    Q4
    21
    YTD Total
    48000


    I have also attached your revised file, let me know what you think. Apart from B17 (opening start mileage), you wont need to enter any start mileages, it gets taken from the prev QTR, and if there is no closing mileage entered, then there is no opening mileage shown.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-30-2016
    Location
    Atlanta, GA
    MS-Off Ver
    2011
    Posts
    13

    Re: Help Needed With Current Mileage Calculation

    Ford,

    Hi and thank you for the warm welcome! It is much appreciated.

    I won't lie, it's been some time since college since I used Excel to this degree, but I have enjoyed getting back into the swing of things with it. You are right though and you make a good point! Sometimes the unnecessary things take up time!

    Thank you for taking some time to look at my proposed question.

    Sincerely,

    BaconFanatic2

  7. #7
    Registered User
    Join Date
    07-30-2016
    Location
    Atlanta, GA
    MS-Off Ver
    2011
    Posts
    13

    Re: Help Needed With Current Mileage Calculation

    Ford,

    This is exactly what I was searching for! I cannot thank you enough for your time and help. Looks like your IF function along with a more streamlined layout as you said, was the answer to my question. Your layout allows for an easier view and more feasible presentation.

    Wonderful!!! Thank you very much!!!

    I'm intrigued enough now to go browse around the forum and see what other interesting formulas and posts I can come across.

    Sincerely,

    BaconFanatic2

  8. #8
    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,926

    Re: Help Needed With Current Mileage Calculation

    I am really happy that I was able to assist you (you can delete all the rows above my table if you want, it wont affect what I have)

    You could perhaps take that 1 step further and, instead of using QTR, use actual dates (1/1/2016, 2/1/2016 etc) and get more finite of your data. You could then run summaries to compare Jan this year, to Jan last year etc. It could still be set up to show QTR's but if you use just QTR1 instead of actual dates, it would be hard to compare QTR1 (this year) with QTR1 (last year), if you see what I mean?

  9. #9
    Registered User
    Join Date
    07-30-2016
    Location
    Atlanta, GA
    MS-Off Ver
    2011
    Posts
    13

    Re: Help Needed With Current Mileage Calculation

    That's actually a really great idea that would help to simplify the layout and allow one to view more data with less effort involved.

    I enjoy figuring out ways to build spreadsheets like this, something fun to learn and to challenge myself with in my off time.

    What would you recommend or suggest for a way to show and present summaries to compare current year to last year Ford?

  10. #10
    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,926

    Re: Help Needed With Current Mileage Calculation

    Give me a few minutes to see what I can come up with for you

  11. #11
    Registered User
    Join Date
    07-30-2016
    Location
    Atlanta, GA
    MS-Off Ver
    2011
    Posts
    13

    Re: Help Needed With Current Mileage Calculation

    Much appreciated Ford!

  12. #12
    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,926

    Re: Help Needed With Current Mileage Calculation

    OK try this.

    I used another sheet.

    1. I added a helper column - which I have hidden - column E, to ID the QTR and add the year to it.
    2. way off to the side, I added a small table to pull the QTR from, based on the month number. I could have included this in the formula, but then it would have got more complex than needed (and you may not have been able to maintain it later)
    3. I added a summary table that you can grow as time passes. It shows the year and the QTR, and uses SUMIFS() to tally the mileages for you.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    07-30-2016
    Location
    Atlanta, GA
    MS-Off Ver
    2011
    Posts
    13

    Re: Help Needed With Current Mileage Calculation

    Looked over what you put together and now understand what you are saying/proposing. And I couldn't agree more with you that this presents the needed data in a much simpler, cleaner, well thought out way.

    Ford I cannot thank you enough for the help you have provided me in this. This is exactly, and more, what I was seeking!

    Hope to keep in touch!

    Sincerely,

    BaconFanatic2

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

    Re: Help Needed With Current Mileage Calculation

    I used the file of FDibbins to show you a pivot table.

    See the attached file.
    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.

  15. #15
    Registered User
    Join Date
    07-30-2016
    Location
    Atlanta, GA
    MS-Off Ver
    2011
    Posts
    13

    Re: Help Needed With Current Mileage Calculation

    Oeldere,

    Thank you for the added informative pivot table! Goes to show there is always more than one way to get it done.

    Thanks again!

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

    Re: Help Needed With Current Mileage Calculation

    Thanks for the rep.

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

  17. #17
    Registered User
    Join Date
    07-30-2016
    Location
    Atlanta, GA
    MS-Off Ver
    2011
    Posts
    13

    Re: Help Needed With Current Mileage Calculation

    My pleasure! And thanks for the heads up on the 'Solved' indicator.

    Have a great rest of your weekend!

  18. #18
    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,926

    Re: Help Needed With Current Mileage Calculation

    Thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Mileage log calculation
    By computerdesign in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-03-2016, 12:48 AM
  2. [SOLVED] IFTA Mileage calculation spreadsheet killing me
    By dceremuga in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-06-2014, 02:41 PM
  3. Replies: 5
    Last Post: 10-01-2012, 12:11 PM
  4. Replies: 1
    Last Post: 02-08-2012, 11:37 AM
  5. Simple Mileage Calculation Form
    By maxima302 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-05-2008, 01:08 PM
  6. [SOLVED] Mileage Calculation
    By Cathy Landry in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-07-2005, 04:35 PM
  7. Mileage calculation
    By Hardy03 in forum Excel General
    Replies: 2
    Last Post: 08-30-2005, 08:05 AM

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