+ Reply to Thread
Results 1 to 6 of 6

ADD YTD Based on Dynamic Month

  1. #1
    Registered User
    Join Date
    04-24-2012
    Location
    NC
    MS-Off Ver
    Excel 2010
    Posts
    34

    ADD YTD Based on Dynamic Month

    I hope this is an easy one. I have a file (starting in A1) with 12 months across the top. I want to dynamically add year-to-date summary column depending on which month I identify. So, if I hard code in a cell JUL (or 07), I want to find a formula that will add each column up to the JUL column. I thought about using a HLOOKUP to do so, but that will only get me the current month selected (not year-to-date). Is there a good formula or trick I can use so that I can type the month in a cell and the formula will calculate YTD based on the cell input?


    YTD.jpg


    Thanks for the help!

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,663

    Re: ADD YTD Based on Dynamic Month

    deleted....
    Last edited by protonLeah; 07-21-2016 at 02:11 PM.
    Ben Van Johnson

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,866

    Re: ADD YTD Based on Dynamic Month

    First, it's nearly always better to attach your file rather than a screenshot.

    Are the months dates, or just strings?

    There are a few different ways to do this. If your hard-coded month name is in, say, A20, and your monthly totals are in row 11 here is one way:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: ADD YTD Based on Dynamic Month

    Here is a slight correction to the formula by 6StringJazzer.
    =SUM(OFFSET(A11,0,0,1,MATCH(A20,A1:L1,0)))

    Here is your example data in a file so that you can "play around" with it.
    Attached Files Attached Files
    Last edited by newdoverman; 07-21-2016 at 03:12 PM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  5. #5
    Registered User
    Join Date
    04-24-2012
    Location
    NC
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: ADD YTD Based on Dynamic Month

    Fantastic! I apologize for not attaching an excel working file. The example attached works perfectly though. Just what I needed. I hadn't used the offset function before. I very much appreciate the help by both of you!

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,866

    Re: ADD YTD Based on Dynamic Month

    Quote Originally Posted by newdoverman View Post
    Here is a slight correction to the formula by 6StringJazzer.
    Much obliged! I shot from the hip on that one.

+ 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. [SOLVED] Determine work days in current month or next month based on day of the month
    By sbrnard in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-29-2014, 05:14 PM
  2. VBA: Piviot table Month auto select based on current month?
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-24-2013, 08:45 AM
  3. VBA: Piviot table Month auto select based on current month?
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2013, 07:18 AM
  4. Replies: 12
    Last Post: 02-08-2013, 02:26 PM
  5. [SOLVED] Help with a system to auto populate month names based on current month
    By rosboy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-01-2012, 05:17 PM
  6. [SOLVED] VBA to identify the current month and previous month based on system date
    By ravikumar00008 in forum Excel General
    Replies: 10
    Last Post: 07-26-2012, 10:04 AM
  7. Auto fill dynamic range based on month
    By [nordis] in forum Excel General
    Replies: 0
    Last Post: 01-14-2005, 08:53 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