+ Reply to Thread
Results 1 to 9 of 9

Sum column based on value of row sum

  1. #1
    Registered User
    Join Date
    09-05-2012
    Location
    Augusta,GA
    MS-Off Ver
    Excel 2010
    Posts
    20

    Sum column based on value of row sum

    I have a list of people that are required to complete 16 units. I need to be able to sum up how many units each person has completed and how many units towards the goal of 16 are completed each month. Once a person earns 16 units the additional units are not counted in the monthly total. The sums listed in B2:B4 will be actual earned units and can be any total value. I tried using sumif but may Range and Sum_range were different sizes so the calculation isnt accurate. Any help would be appreciated.


    Jan Feb Mar Apr May Jun
    Sam 18 4 4 4 4 2
    Bill 22 16 2 2 2
    Mark 20 20
    sum 20 8 8 8 4 2


    Desired Results

    Jan Feb Mar Apr May Jun
    Sam 18 4 4 4 4 2
    Bill 22 16 2 2 2
    Mark 20 20
    sum 20 4 4 20 0 0
    Attached Files Attached Files

  2. #2
    Forum Expert RobertMika's Avatar
    Join Date
    06-22-2009
    Location
    Haverhill, UK
    MS-Off Ver
    Excel 2003-13
    Posts
    1,530

    Re: Sum column based on value of row sum

    I think you need shed somemore light how this calcculations are being done/
    If you are http://www.excelforum.com/image.php?type=sigpic&userid=125481&dateline=1392355029happy with the results, please add to the contributor's
    reputation by clicking the reputation icon (star icon).




    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.
    To undo, select Thread Tools-> Mark thread as Unsolved.
    http://www.excelaris.co.uk

  3. #3
    Registered User
    Join Date
    09-05-2012
    Location
    Augusta,GA
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Sum column based on value of row sum

    Let me try to explain my calculation logic based on my sample file with the table listed under Desired Results. Each person will have a total of all units earn in column B by adding all the values in their respective row. Cell B11=sum(C11:H11), that is the easy part. The issue I have is calculating the monthly accumulated, but each person can only contribute 16 units total to all monthly totals. With this sample population the total for each month in row 14 could never be greater than 48 (3 people x 16 units). In the column for Jan, Sam earns 4, and Bill earns 16, so the monthly total is 20. In Feb Sam earns 4, and bill earns 2, the monthly total only sums Sam 4 because Bill already reached the required amount of 16 the previous month. Any additional units Bill gets above 16 only get summed in B12, and they no longer effect the monthly sums in row 14. Likewise when you look at april, Sam gets 4, and Mark get 20. The monthly total in 20, because 4 units are given for Sam, and 16 to Mark. Mark can only contribute 16 to any month, and Sam has now completed his 16 unit in 4 months.

    When summing the column values for the monthly total, I need to stop counting a row input when the row sum equals 16. Each row needs to contribute 16 units, and anything extra can't be counted in the monthly sum.

  4. #4
    Registered User
    Join Date
    09-05-2012
    Location
    Augusta,GA
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Sum column based on value of row sum

    I got an equation to work, but it will get really large when I apply it to my data set of 104 people vice 3. Does anyone have any ideas how to streamline this equation, so I will be easier to work with. I have attached a updated file with the working equation.

    =SUM(IF(16-SUM($C$3:D3)>=0,D3,IF(16-SUM($C$3:D3)<0,0,16-SUM($C$3:C3))),IF(16-SUM($C$4:D4)>=0,D4,IF(16-SUM($C$4:D4)<0,0,16-SUM($C$4:C4))),IF(16-SUM($C$5:D5)>=0,D5,IF(16-SUM($C$5:C5)<0,0,16-SUM($C$5:C5))))
    Attached Files Attached Files

  5. #5
    Forum Expert RobertMika's Avatar
    Join Date
    06-22-2009
    Location
    Haverhill, UK
    MS-Off Ver
    Excel 2003-13
    Posts
    1,530

    Re: Sum column based on value of row sum

    This sheet does not have any equations...

  6. #6
    Registered User
    Join Date
    09-05-2012
    Location
    Augusta,GA
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Sum column based on value of row sum

    I will repost the file tomorrow morning. I found an error with the equation and made some changes, but I don't have access to the file until I get back to work in the morning.

  7. #7
    Registered User
    Join Date
    09-05-2012
    Location
    Augusta,GA
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Sum column based on value of row sum

    I could see the equations in the sample file after I enabled editing. Like I said I found an error in the calculation late yesterday and I up modified the equation to the following. This equation can be found in D6:H6.

    =SUM(IF(SUM($C$3:C3)>16,0,IF(SUM($C$3:D3)<=16,D3,IF(SUM($C$3:D3)>16,16-SUM($C$3:C3),D3))),IF(SUM($C$4:C4)>16,0,IF(SUM($C$4:D4)<=16,D4,IF(SUM($C$4:D4)>16,16-SUM($C$4:C4),D4))),IF(SUM($C$5:C5)>16,0,IF(SUM($C$5:D5)<=16,D5,IF(SUM($C$5:D5)>16,16-SUM($C$5:C5),D5))))
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-05-2012
    Location
    Augusta,GA
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Sum column based on value of row sum

    Is it possible to move this question into the VBA section. I have been trying to figure out a way to make it work with equations, but maybe it requires vba or macro. any assistance would be greatly appreciated.

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Sum column based on value of row sum

    Aschom,

    Your thread has been moved and this post of mine will bump it up the queue.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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. Replies: 2
    Last Post: 06-06-2013, 08:29 AM
  2. Replies: 1
    Last Post: 04-04-2013, 02:47 PM
  3. Replies: 3
    Last Post: 03-21-2013, 09:28 AM
  4. [SOLVED] Filtering and generating new tabs based on Unique values based in column
    By amlan009 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-02-2012, 09:40 PM
  5. Replies: 2
    Last Post: 08-09-2009, 12:58 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