+ Reply to Thread
Results 1 to 9 of 9

Calculating WTD MTD YTD totals

  1. #1
    Registered User
    Join Date
    05-22-2007
    Posts
    26

    Calculating WTD MTD YTD totals

    I am building a running log for myself and would like to have a table showing my total distances week-to-date (Sunday = day 1), month-to-date, and year-to-date totals.

    See yellow highlighted cells in attached spreadsheet.
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Calculating WTD MTD YTD totals

    Hi tania_del,
    Look at a Pivot Table solution on sheet 2. You can group the dates by days or months. You can also expand or collapse the dates. See what you think.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    05-22-2007
    Posts
    26

    Re: Calculating WTD MTD YTD totals

    Not exactly what I had in mind. I was hoping that the WTD, MTD, and YTD totals would automatically be adjusted based on the current date - I am looking for the right formula that will do this for me. So that when I open my spreadsheet, I can see my mileage so far for the week, so far for the month, etc. without having to make selections or update formulas.

    If the SUMIF function allowed you to sum values in one range that meet more than one criteria (different criteria being TODAY, TODAY-1, TODAY-2, TODAY-3, etc. But I don't think this is possible and don't know of a formula that can do this.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating WTD MTD YTD totals

    You can use SUMIFS - syntax wise:

    Please Login or Register  to view this content.
    Given the layout you could also just use basic SUMs and use INDEX w/MATCH (based on dates) or OFFSET to identify start/end positions of each range but the above is perhaps simplest.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating WTD MTD YTD totals

    I'll be off line for a bit so in case you want or need the others

    Please Login or Register  to view this content.
    If you assume you will never have values beyond today then MTD & YTD could be SUMIF (the tests re: <=H3 aren't necessary)

  6. #6
    Registered User
    Join Date
    05-22-2007
    Posts
    26

    Re: Calculating WTD MTD YTD totals

    Thanks! It looks like this will do the trick.

  7. #7
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Calculating WTD MTD YTD totals

    @DonkeyOte - If you're still out there, could you please explain how the YTD code above works?

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

    Re: Calculating WTD MTD YTD totals

    This is an old thread, and you should really start your own thread, but seeing as you are only asking how that formula worked...
    =SUMIFS($F$4:$F$368,$B$4:$B$368,">"&EOMONTH($H$3,-MONTH($H$3)),$B$4:$B$368,"<="&$H$3)
    Did not look at any file of info, but this is what I make of it.

    =SUMIFS($F$4:$F$368,$B$4:$B$368,">"&EOMONTH($H$3,-MONTH($H$3)),$B$4:$B$368,"<="&$H$3)
    this would be the range to sum

    =SUMIFS($F$4:$F$368,$B$4:$B$368,">"&EOMONTH($H$3,-MONTH($H$3)),$B$4:$B$368,"<="&$H$3)

    The trick here is the EOMONTH() function. It is taking the date that is "X" months before the date in H3 - the "X" is being calc'd by determining the month number in H3
    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

  9. #9
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Calculating WTD MTD YTD totals

    What had me confused was the criteria, but if, with what you wrote, I understand correctly, presuming H3 is "today's" date, the second criteria put an "end" limit on the accumulation and the portion that reads
    Please Login or Register  to view this content.
    creates the start.


    Isn't there an easier way to specify the first day of the current year of the date being examined? Why not
    Please Login or Register  to view this content.
    ?

    As it took some determination to come up with what was used I have to believe with good reason, so I would like to learn from it!

+ 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