+ Reply to Thread
Results 1 to 12 of 12

Modify Sumproduct to include helper column

  1. #1
    Registered User
    Join Date
    03-21-2007
    Posts
    9

    Modify Sumproduct to include helper column **SOLVED**

    Hi all,

    I'm using Excel 2007 and have an Employee Scheduling Program that keeps track of 10 employees on a monthly basis (1 worksheet per month). The days of each month are in columns (I thru AM) and my 10 employees are in Rows 6 thru 15, which creates a grid of cells. I use Conditional Formatting to highlight the Weekends, Todays Date, and Holidays. My Sumproduct formula (shown below) is in each of the cells of my grid and places a number (1 to 10 for each employee) from start date to the end date. My Current formula works great as it finds every occurrence of the argument but I need to modify it to include the contents of the Helper Column.

    If(Sumproduct(($g$44:$g$74=$c$6)*($m$44:$m$74<=i$4)*($t$44:$t$74>=i$4)),1,0).

    where,
    Row 4 (I to AM) = 1 to 31 (days in December)
    Column C (6 to 15) = Numbers 1 to 10
    Column G (44-74) = Numbers from 1 to 10
    Column M (44-74) = Start Dates of a Project
    Column T (44-74) = End Dates of a Project
    Column A (44-74) = Helper Column (ex: finds the 1st No. 1 and puts 11 in the same row column A cell, finds the next No. 1 and puts 12 in the cell, etc.)

    So, the above formula (in cell I$6 copied across) looks in Column G for the number 1, finds the corresponding Start & End Dates for every occurrence and puts the number 1 in each cell of Row 6 (I6 to AM6). The formula in Row 7 compares Column G to $c$7 and if true, places the number 2 in each cell, and so on to Row 15.

    If the Sumproduct is True, my goal is to replace the Numbers (1 to 10) in my formula with a statement that would input the contents of the Helper Column (i.e., 11, 12, 31, 42, whatever) instead of having just the No. 1 in Row 6, just the No. 2 in Row 7, etc. I've tried a Vlookup (shown below) but it only finds the 1st occurrence (i.e, 11, 21, 31, 41, etc.)

    If(Sumproduct(($g$44:$g$74=$c$6)*($m$44:$m$74<=i$4)*($t$44:$t$74>=i$4)),VLOOKUP($C$6&COLUMN($A$44:$A74),$A$44:$T$74,1,0),0).

    A copy of the worksheet can be found on an earlier post dated 12-11-2007 entitled, Conditional Format a string of cells that begin before today & end after today.

    Any help would be greatly appreciated!

    Jim
    Last edited by JDarling; 12-17-2007 at 06:22 PM. Reason: Just wanted to add SOLVED to the Title

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Maybe you can re-post your sample workbook and show examples of expected results and how they should be obtained?
    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
    03-21-2007
    Posts
    9
    As NBVC suggested, I've attached a sample copy of my workbook. The top chart is how it currently works and below is what I'm looking to achieve.

    I went ahead and saved it as a 97-2003 workbook (as someone suggested in my earlier post). Because of the Conditional Formatting issue, I had to manually Highlight the cells in my current Schedule since 2000 only kept my top 3 CF's.

    Jim
    Attached Files Attached Files

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try this formula in I6, then copied down and over

    Please Login or Register  to view this content.
    is that what you need?

  5. #5
    Registered User
    Join Date
    03-21-2007
    Posts
    9
    NBVC,

    Thanks for the quick response.

    I tried your Index/Match formula but it's doing the same thing as the Vlookup, only finds the 1st occurrence in the Helper Column ($A$62:$A$92).

    Jim

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Oh, I see now what you're looking for...

    try this formula in I6:

    Please Login or Register  to view this content.
    this formula must be confirmed with CTRL+SHIFT+ENTER, not just ENTER... you will see curly { } brackets appear, if entered correctly.

    Then copy the formula over and down.

  7. #7
    Registered User
    Join Date
    03-21-2007
    Posts
    9
    NBVC,

    Your Brilliant ... Works Perfectly!

    Now I'm going to try to figure out a Conditional Format to Change cells to Yellow if Cell >= 1 and Today > Start Date but < End Date.

    Can't Thank You Enough.

    Jim

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Now I'm going to try to figure out a Conditional Format to Change cells to Yellow if Cell >= 1 and Today > Start Date but < End Date.
    How about for I6 yellow Conditional Formatting:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-21-2007
    Posts
    9
    NBVC,

    I think I may have mislead you. When I plug your formula into the conditional format, all cells from the 5th to the 18th (m6 to z15) turn Yellow.

    My first 3 Conditions (Today, Weekend, and Holidays) work fine.
    Then I have
    Condition 4: =AND(I6>=1,TODAY()>I$4) - Turns cells RED if Today > cell
    Condition 5: =AND(I6>=1,TODAY()<I$4) - Turns cells Green if Today < cell

    Trying to figure out Condition 6, So far I have
    Condition 6: =SUMPRODUCT(($A$62:$A$92=I6)*($T$62:$T$92>TODAY()))

    This formula is on the right track as it does turn the cells Yellow if the project started before today and hasn't finished yet (End Date > Today). But, it also turns my cells that were previously Green to Yellow also. Maybe just an ordering thing.

    Jim

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Yeah, it probably is an ordering thing...

    Conditional Formatting works like this...

    If the first condition is satisfied, it will apply that format and stop...

    If the first condition is not satisfied, it will go to the next condition and so on...

    so you must be careful of the ordering... if more than one condition applies only the first one that it comes across will be used.

  11. #11
    Registered User
    Join Date
    03-21-2007
    Posts
    9
    NBVC,

    Thank you for all your help!!!

    I changed my Conditional formula to =SUMPRODUCT(($A$44:$A$74=I6)*($M$44:$M$74<=TODAY())*($T$44:$T$74>TODAY())) and had to put that as Condition 4, before my previous Conditions 4 & 5 ... Works Perfectly.

    Again, I can't thank you enough. You guys are Great.

    Regards,
    Jim

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You are very welcome!

+ 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