+ Reply to Thread
Results 1 to 37 of 37

Dynaimc Sum Range

  1. #1
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Talking Dynaimc Sum Range

    Hi Excel Savants!

    Im getting tired of manually updating my sum ranges in my Workbook. Heres the situation.

    We r working with a 3 month average. So for example in august we need to take july june & may and divided by the numerator. The problem im facing is that i need to work back from august. All the formulas are on summary page referencing to the data worksheet.

    Any thoughs on how to structure this so that each month i found possiably reference the current month on the summary page and have the sum function move and sum the prior 3 months? Maybe use index match ???

    Any thoughts would be great, thanks!

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,620

    Re: Dynaimc Sum Range

    Perhaps post a small sample of your data so we can see the layout?

  3. #3
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    Equation: sum(d6:f6) now we have the sum of april - june assuming the woorksheet month is july.

    Next month august, the equation will need to be update for reflect may - july (e6:g6)

    On top of the nunbers we r summing on the data sheet are the months. Same format as the current month on the summary page

    Im thinking i could use edate and index but not exactly sure how, thoughts?!

  4. #4
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    Here is a sample of what I'm trying to do! Please help! Thank you!
    Attached Files Attached Files

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

    Re: Dynaimc Sum Range

    I should it do this way.
    Attached Files Attached Files
    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
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    I see what you are doing, but my hope is that I can leverage the data validation list with the months so that I can change that month in the list and the formula will automatically update accordingly... I'm thinking using edate and index could work but not sure how to do it.... Thoughts?

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

    Re: Dynaimc Sum Range

    If you change the format of your data, you can easy use an pivot table.

    See the attachment.
    Attached Files Attached Files

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Dynaimc Sum Range

    Possibly try this ...
    In Sheet "Summary" B3
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  9. #9
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    That's an awesome formula and I will use that in the future. Thank you for your time; not many people would help out like that.

    For this particular instance, I will have to use prior year information as well so I think the Month equation may not work..... I've updated the sample. For example for Feb 2012, I would need to use Jan 2012 Dec 2011 and Nov 2011 data. I feel like an edate formula would work has anyone used that before?
    Attached Files Attached Files

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Dynaimc Sum Range

    ''''^''''1
    Last edited by shg; 08-11-2012 at 06:34 PM.
    Entia non sunt multiplicanda sine necessitate

  11. #11
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    What does that mean? ''''^''''1

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Dynaimc Sum Range

    Withdrawn comment.

    Ignoring getting the months right, what is your formula supposed to compute?

  13. #13
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Dynaimc Sum Range

    =SUM(OFFSET(Data!A2,,MATCH(B1,Data!A1:L1,)-4,,3))/SUM(OFFSET(Season!A2,,MATCH(B1,Season!A1:L1,)-4,,3))

  14. #14
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Dynaimc Sum Range

    I feel like an edate formula would work has anyone used that before? OH Yea!!!

    =SUMPRODUCT((EDATE(B1,{-1;-2;-3})=Data!A1:L1)*Data!A2:L2)/SUMPRODUCT((EDATE(B1,{-1;-2;-3})=Season!A1:L1)*Season!A2:L2)
    Last edited by Teethless mama; 08-12-2012 at 12:44 PM.

  15. #15
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    Teethless that works AWESOME! Can you explain it? I'm confused when you do *Data!A2:L2 ? Thank you soooo much!!!

  16. #16
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    Do you think it's posiable to reference the date on the summary page for a full year sum? So it it's august he sum would be jan - aug. when the date is changed to sep the formula would sum jan-sep?

  17. #17
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Dynaimc Sum Range

    Quote Originally Posted by Excel"*" View Post
    Do you think it's posiable to reference the date on the summary page for a full year sum? So it it's august he sum would be jan - aug. when the date is changed to sep the formula would sum jan-sep?
    Yes it's possible. See the attached
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    How would you incorporate the edate idea you had? so I can reference the month and it will go one back and sum from jan. So if it says Aug it will sum from Jan-July? Wow you really know your Excel!! Below is my try... Thanks for the learning opportunity!
    Attached Files Attached Files

  19. #19
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Dynaimc Sum Range

    Quote Originally Posted by Excel"*" View Post
    How would you incorporate the edate idea you had? so I can reference the month and it will go one back and sum from jan. So if it says Aug it will sum from Jan-July? Wow you really know your Excel!! Below is my try... Thanks for the learning opportunity!

    B1: Your current month

    =SUMPRODUCT((EDATE(B1,{-1;-2;-3})=Data!F1:Q1)*Data!F2:Q2)

    This formula will adjust automaticly

  20. #20
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    It seems that the edate part is taking the last 3 months, I'm looking for an equation that would look @ B2 (the date) minus one month then sum to Jan from that date. It seems like I need to start with Jan than use edate -1.. with match index but not really sure how to do that?

    Does what I'm thinking make sense? Thanks for your time!
    Attached Files Attached Files

  21. #21
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Dynaimc Sum Range

    Very confusing. In your speadsheet you said "I would like the above equation to use the Date in B1 to automatically go back 3 months from that date. So in September, the equation in B3 would take the sum of Aug July & June. Note) I can not re-structure the data. Now, you said "I'm looking for an equation that would look @ B2 (the date) minus one month then sum to Jan from that date. It seems like I need to start with Jan than use edate -1.. with match index but not really sure how to do that?

    B1: your current date

    =SUM(Data!F2:INDEX(Data!F2:Q2,MATCH(Summary!B1,Data!F1:Q1,0)-1))

    This formula is sum up from January to your curent month -1 month.

  22. #22
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    Thank you so very much! Sorry for the confusion; your time is greatly appreciated. Very smart Teethless mama!!! Do you even have to think about this! haha

  23. #23
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Dynaimc Sum Range

    You're Welcome!

  24. #24
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Dynaimc Sum Range

    Are we singing off the same hymnsheet here?

    In your second sample workbook Sheet "Data" has 4 extra columns, 2 of which you state that you "Can not remove"
    As you want to calculate based on the 3 preceding dates from any given month, I would have thought you would need another column for Oct-11 to allow a 3 month figure to be returned for Jan-12.

    Sheet "Season" does not have these extra columns, so what can we base the Jan-12 figure on?
    Should this sheet not have the same number of columns as sheet "Data"?

    What is in the columns "Can not remove", is it text or numbers and what are the real headers?

    See this workbook, I have assumed that Sheets "Data" and "Season" have an identical layout and Columns "Can not remove" could have text entries.

    Checkout the Data Validation in Sheet "Summary" D1
    Select from the drop-down in D1 to see the changes in A3:D3
    Attached Files Attached Files

  25. #25
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    The formula in the attached file was working yesterday but now it's now!!! Any thoughts?! The formula was...

    I tried to do Ctrl+Shift+Enter for the array but it's not working....... I turned on my analysis toolpack for edate as wel..

    =SUMPRODUCT((EDATE(B1,{-1;-2;-3})=Data!A1:H1)*Data!A2:H2)/SUMPRODUCT((EDATE(B1,{-1;-2;-3})=Season!A1:L1)*Season!A2:L2)
    Attached Files Attached Files

  26. #26
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    It was working on my Mac if that helps @ all.

  27. #27
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,712

    Re: Dynaimc Sum Range

    That formula doesn't require CTRL+SHIFT+ENTER....

    Your profile says Excel 2007 but I presume that's on your Mac, do you have Excel 2003 on your PC? That formula doesn't work in Excel 2003 because that version can't handle an "array" in EDATE function, i.e. this part

    =EDATE(B1,{-1;-2;-3})

    Is the formula actually doing what you want, because I notice you were talking about summing Jan to July if B1 is August? Using {-1;-2;-3} means it's only looking at the last 3 months (May, Jun and July if B 1= Aug).
    Audere est facere

  28. #28
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    Yes the formula does what I need it to due assuming the words for my issue is correct.. Any thoughts on how to get it working in 2003?

  29. #29
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,712

    Re: Dynaimc Sum Range

    This should work in Excel 2003

    =SUMPRODUCT((Data!A1:L1<B1)*(Data!A1:L1>=EDATE(B1,-3)),Data!A2:L2)/SUMPRODUCT((Season!A1:L1<B1)*(Season!A1:L1>=EDATE(B1,-3)),Season!A2:L2)

  30. #30
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    Thanks that does work really well, do you know how you would add an indirect so I could change that data worksheet to whatever sheet I had in a data validation list? I tried to add it but I think my syntax is off... Like most time! Thanks all!

  31. #31
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,712

    Re: Dynaimc Sum Range

    Instead of

    Data!A1:L1

    You can replace all instances with this:

    INDIRECT(Z2&"!A1:L1")

    where Z2 contains the sheet name.........but that only works if the sheet name is without spaces....and not numeric, for a sheet name like two words you need to have apostrophes either side of the name so a generic version of INDIRECT to accommodate any type of sheet name in Z2 would be

    INDIRECT("'"&Z2&"'!A1:L1")

  32. #32
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    Im struggling with the correct syntax, i keep getting an error...... Thoughts....

  33. #33
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    This is my shot, I replaced like you said but I get a Ref.... Thanks for your help, thought this would be easy. Sure you will make it look that way!
    Attached Files Attached Files

  34. #34
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    I got it to work using this:

    =SUMPRODUCT((INDIRECT(E1&"!A1:L1")<B1)*(INDIRECT(E1&"!A1:L1")>=EDATE(B1,-3)),INDIRECT(E1&"!A2:L2"))

    Thank you for your time, you really know you Excel!! Thank you again.

  35. #35
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    Can u explain what you did after the * sign... It does not seem like an array....

  36. #36
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,712

    Re: Dynaimc Sum Range

    Quote Originally Posted by Excel"*" View Post
    Can u explain what you did after the * sign... It does not seem like an array....
    Not sure which bit you mean, can you be more explicit?

  37. #37
    Registered User
    Join Date
    05-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Dynaimc Sum Range

    *(INDIRECT(E1&"!A1:L1")>=EDATE(B1,-3)) that section I don't understand. I was under the impression that you used * when the array is not the same... Can you explain this... Why did you use >=?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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