+ Reply to Thread
Results 1 to 8 of 8

Sumif across columns-Sum pay-

  1. #1
    Registered User
    Join Date
    09-23-2008
    Location
    kc, mo
    Posts
    25

    Sumif across columns-Sum pay-

    I have data set up across multiple columns with dates included for each pay date, for example:

    Person Pay-1 Date-1 Pay-2 Date-2 Pay-3 Date-3
    002 10 1-2008 15 5-2008 30 10-2008
    003 10 1-2008 20 4-2008 45 9-2008
    004 5 2-2008 14 7-2008 55 8-2008

    The sum I want to work would be as so: Sum pay-1 if date-1 is within 2 years of today, sum pay-2 if date-2 is within 2 years of today, etc. and so on to get a final sum value for each person based on when they were paid out in relation to today.

    Any help would be MUCH appreciated. Thanks!

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Assuming your table occupies A1:G4 including Headers..

    then try:

    Please Login or Register  to view this content.
    Adjust ranges to suit.

    in F2, copied down.

    Sample attached
    Attached Files Attached Files
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    09-23-2008
    Location
    kc, mo
    Posts
    25
    thank you for the quick reply NBVC!

    The sum seems to be working just fine, but the "if" part of the date is not working. I think i tried to simplify it too much, let me add the rest of it. So if the data looked like this:


    Person Pay-1 Date-1 Pay-2 Date-2 Pay-3 Date-3 Term Date
    002 10 1-2005 15 5-2007 30 8-2008 9-2008
    003 10 1-2005 20 4-2007 45 6-2008 9-2008
    004 5 2-2005 13 7-2007 55 8-2008 9-2008

    So basically what I want is a sum of person 002 based on their term date and the date-1/date-2/date-3 dates. So if "date-1" is within 2 years of the term date, i want that to be included in the sum. If the date is more than 2 years ago i dont want it to be included.

    So the sums would be: (none of pay-1 would be included because date-1 is more than 2 years from the term date)

    002 = 15+45 = 60
    003 = 20+45 = 65
    004 = 13+55 = 68

    Thanks again for the help!
    Last edited by mremmenga; 11-12-2008 at 04:07 PM.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try then:

    Please Login or Register  to view this content.
    copied down

  5. #5
    Registered User
    Join Date
    09-23-2008
    Location
    kc, mo
    Posts
    25
    NBVC, that seems to be working better thanks!
    2 questions:

    1-The formula ignores the first 2 columns of data to the right, and jumps right to the 3rd, any reason why it is doing that?

    2- Each row ends at a different column, so if there are blank cells the formula will return an error. Any thoughts?

    Thanks!
    Last edited by mremmenga; 11-12-2008 at 05:26 PM.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Because the arrays have to be the same size for each of the sumproduct conditions, I am really just offsetting the ranges to keep the sizes the same... and because you have different alternating columns with same type of info, offsetting the range for the dates gets the right data in line in order to compare properly after Sumproduct has created the TRUE/FALSE resultant arrays.

    Not sure what you mean by the 2nd question... can you give example of what you mean?

  7. #7
    Registered User
    Join Date
    09-23-2008
    Location
    kc, mo
    Posts
    25
    sure thing, so:

    person 002 could have 4 values paid out, and 4 pay dates, for 8 columns
    person 003 may only have 2 values paid out, and 2 pay dates, for 4 columns

    the formula is copied for hundreds of rows, so the people like person 003 who have less data and thus blank cells in columns to the right get an error and no value for the formula, that make sense?

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    I think as long as the formula takes into account the largest number of columns in all your data, then it will be fine for when there are less..

    e.g if 4 values paid out, and 4 pay dates, for 8 columns is the most anyone could/does have, then adjust the initial formula to accomodate that

    (e.g.
    Please Login or Register  to view this content.
    and copy that down.. so even if a person had half as many dates/paid outs, it should still work for you.

+ 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