+ Reply to Thread
Results 1 to 24 of 24

Cumulative Sum of Units Per Week

  1. #1
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Cumulative Sum of Units Per Week

    Hi,

    I am trying to make a summary for a units distribution on a weekly basis.
    I have the units distribution data on a daily basis which needs to be summarised per week.( The cut-off day is Monday)
    First Monday in the data is 21-Nov-16 so all units upto and including 21 should be added up in the cumulative units.
    Similarly near to date 28-Nov units for dates 22,23,....upto 28 should be added up.
    I require a formula to get this result in Column C (I have attached workbook with data and desired output)

    VBA Request
    ----------------
    I would like to get a VBA solution for the same.
    After the cumulative units for all Mondays are obtained,the other rows should be deleted and only the Monday dates with cumulative values should remain.
    Also the column for daily units should be deleted.


    Thanks in advanc
    Attached Files Attached Files

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Cumulative Sum of Units Per Week

    Try this in C2 and filled down
    =SUM(Data!$B$3:INDEX(Data!$B:$B,MATCH($A3,Data!$A:$A,0)))-SUM($C$2:$C2)

  3. #3
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Re: Cumulative Sum of Units Per Week

    The sit is throwing me all over the place at the moment. I don't know if this attachment will actually attach. Basically all I did was write a formula that says If the date is a monday sum the cell to the left adn the 6 cells above. If not then "Delete"
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Cumulative Sum of Units Per Week

    Hi Jonmo1,

    thanks for the reply
    but it doesnt work

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Cumulative Sum of Units Per Week


  6. #6
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Re: Cumulative Sum of Units Per Week

    Chullan,

    Is you look at my workbook that I attached and use the VBA code:

    Please Login or Register  to view this content.
    That should do what you want.

  7. #7
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Cumulative Sum of Units Per Week

    Quote Originally Posted by Jonmo1 View Post
    Works for me.
    This formula works...

    Thanks...

    But actually i wanted the formula to be in the same sheet itself..

    The desired output sheet is with cells deleted afterwards..
    Last edited by chullan88; 02-23-2017 at 11:30 AM.

  8. #8
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Cumulative Sum of Units Per Week

    Quote Originally Posted by DannyJ View Post
    Chullan,

    Is you look at my workbook that I attached and use the VBA code:

    Please Login or Register  to view this content.
    That should do what you want.
    hi dannyj,

    it deletes the other rows but the cumulative value gets wrong after running the macro

  9. #9
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Cumulative Sum of Units Per Week

    Quote Originally Posted by DannyJ View Post
    Chullan,

    Is you look at my workbook that I attached and use the VBA code:

    Please Login or Register  to view this content.
    That should do what you want.
    hi dannyj,

    it deletes the other rows but the cumulative value gets wrong after running the macro

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Cumulative Sum of Units Per Week

    I see.

    Try
    =SUM($B$3:INDEX($B:$B,MATCH(WORKDAY.INTL($A3-1+(7*(ROWS($A$1:$A1)-1)),1,"0111111"),$A:$A)))-SUM($C$2:$C2)

  11. #11
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Cumulative Sum of Units Per Week

    Quote Originally Posted by Jonmo1 View Post
    I see.

    Try
    =SUM($B$3:INDEX($B:$B,MATCH(WORKDAY.INTL($A3-1+(7*(ROWS($A$1:$A1)-1)),1,"0111111"),$A:$A)))-SUM($C$2:$C2)

    It gives value corresponding to Mondays but I need the values to appear only in the cell next to Monday

    i.e in Sheet Data,cell C3 and C4 should be blank and then C5 should have value ...

  12. #12
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Cumulative Sum of Units Per Week

    Quote Originally Posted by Jonmo1 View Post
    I see.

    Try
    =SUM($B$3:INDEX($B:$B,MATCH(WORKDAY.INTL($A3-1+(7*(ROWS($A$1:$A1)-1)),1,"0111111"),$A:$A)))-SUM($C$2:$C2)

    It gives value corresponding to Mondays but I need the values to appear only in the cell next to Monday

    i.e in Sheet Data,cell C3 and C4 should be blank and then C5 should have value ...

  13. #13
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Cumulative Sum of Units Per Week

    Oh, well that makes it even easier.

    Try this in C3 and filled down.
    =IF(OR(WEEKDAY(A3)=2,A4=""),SUM(B$3:B3)-SUM(C$2:C2),"")

  14. #14
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Cumulative Sum of Units Per Week

    Quote Originally Posted by Jonmo1 View Post
    Oh, well that makes it even easier.

    Try this in C3 and filled down.
    =IF(OR(WEEKDAY(A3)=2,A4=""),SUM(B$3:B3)-SUM(C$2:C2),"")
    Excellent!!

    Thank you so much..

    My problem is partially solved , could you help with the macro?

  15. #15
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Cumulative Sum of Units Per Week

    You're welcome.

  16. #16
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Re: Cumulative Sum of Units Per Week

    Sorry, didn't think of the formulae.

    Try this, it pastes the values of the formulae before deleting.

    Please Login or Register  to view this content.
    Use Jonmo's formula, I changed this to work with that one.

  17. #17
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Cumulative Sum of Units Per Week

    Hi DannyJ,

    Maybe because Im not so familiar with VBA, I can't get it to work.
    Can you send me a workbook with the above macro?

    Thanks

  18. #18
    Valued Forum Contributor
    Join Date
    05-11-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    586

    Re: Cumulative Sum of Units Per Week

    Hi,

    Or you could do it with a Pivot Table - please see attached.

    Regards

    peterrc
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Cumulative Sum of Units Per Week

    Hi peterrc,

    Thanks for the new take on the problem.

  20. #20
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,228

    Re: Cumulative Sum of Units Per Week

    In B3 of "Desired output"

    =SUMIFS(Data!B:B,Data!A:A,">=" &A3-6,Data!A:A,"<=" &A3)

    copy down

  21. #21
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Cumulative Sum of Units Per Week

    Thanks for your message JohnTopley.

    Could you please look into the VBA part?


    Regards

  22. #22
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Re: Cumulative Sum of Units Per Week

    Chullan,

    Change with Sheet 1 to whatever sheet number it is. (The sheet number is the numbers on the right of the brackets in vba)

    It will be displayed as Sheet 1 (Name of sheet).

    The vba code works fine for me, what error are you getting?
    Last edited by DannyJ; 02-25-2017 at 07:28 AM.

  23. #23
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,228

    Re: Cumulative Sum of Units Per Week

    VBA creates totals then deletes rows (using amended VBA from DannyJ)

    Input:" Data" Output: "Output"
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JohnTopley; 02-25-2017 at 09:40 AM.

  24. #24
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Cumulative Sum of Units Per Week

    Quote Originally Posted by JohnTopley View Post
    VBA creates totals then deletes rows (using amended VBA from DannyJ)

    Input:" Data" Output: "Output"
    Please Login or Register  to view this content.
    Thanks dannyj and JohnTopley!!
    It works!!

+ 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. Convert units and units of measure
    By AntiPivotTable in forum Excel General
    Replies: 1
    Last Post: 10-21-2016, 07:22 PM
  2. [SOLVED] Formula to determine number of units at each location and status of units
    By Klimer in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-18-2016, 10:01 AM
  3. [SOLVED] Total units made by week number with varying manufacturing periods
    By BRISBANEBOB in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2016, 06:49 PM
  4. Trying to do conditional counting, units within units
    By Butcher1 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-17-2016, 01:01 PM
  5. Week cumulative
    By beneesetas14 in forum Excel General
    Replies: 1
    Last Post: 04-23-2014, 08:15 AM
  6. [SOLVED] Calculate the Bonus units according to the quantity of the units bought (Help)
    By mo_naf in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-15-2012, 05:51 PM
  7. Week-over-week cumulative sum
    By mldsmith in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-28-2009, 02:23 PM

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