+ Reply to Thread
Results 1 to 11 of 11

Trying to add cells with multiple criteria that are less than or equal to a date

  1. #1
    Registered User
    Join Date
    12-22-2014
    Location
    Platteville, WI
    MS-Off Ver
    2010
    Posts
    5

    Trying to add cells with multiple criteria that are less than or equal to a date

    I am not an Excel expert and am having troubles with a spreadsheet for work. I am trying to add multiple cells that are in columns that are less than or equal to a given date, but only in the row that matches an index criteria. For example

    Index 5/1/14 6/1/14 7/1/14 8/1/14
    SHC $50 $500 $5000 $50000
    SOS $100 $1000 $10000 $100000
    SEI $200 $2000 $20000 $200000
    SBS $300 $3000 $30000 $300000

    Sum all values for SOS with a date less than or equal to 7/1/14.

    My spreadsheet is a bit more complicated than this, but this is the gist of the problem. I was trying to figure out how to use an array with Index Match, but I can't get that to show all values less than or equal to the date, only the exact match.

    Any ideas?
    Thanks in advance for helping out a confused user.
    Ryan

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Trying to add cells with multiple criteria that are less than or equal to a date

    try with your data in a1:k5 and date to search for in a1
    =SUMPRODUCT(($A$2:$A$5="shc")*($B$2:INDEX($B$2:$K$5,0,MATCH($A$1,$B$1:$K$1,0))))
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    1
    06/01/2014
    05/01/2014
    06/01/2014
    07/01/2014
    08/01/2014
    2
    SHC
    50
    500
    5000
    50000
    3
    SOS
    100
    1000
    10000
    100000
    4
    SEI
    200
    2000
    20000
    200000
    5
    SBS
    300
    3000
    30000
    300000
    6
    7
    8
    9
    SHC
    550
    formula in b9 is >>> filled down =SUMPRODUCT(($A$2:$A$5=A9)*($B$2:INDEX($B$2:$K$5,0,MATCH($A$1,$B$1:$K$1,0))))
    10
    SOS
    1100
    11
    SEI
    2200
    12
    SBS
    3300
    13
    14
    Last edited by martindwilson; 12-22-2014 at 11:40 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,327

    Re: Trying to add cells with multiple criteria that are less than or equal to a date

    Like this...???
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Registered User
    Join Date
    12-22-2014
    Location
    Platteville, WI
    MS-Off Ver
    2010
    Posts
    5

    Re: Trying to add cells with multiple criteria that are less than or equal to a date

    Thank you Glenn. That does it. I tried using sumproduct before, but for some reason I couldn't get it to work. I must have had the syntax wrong. This is great. Ahh, I just don't think in Excel and have been wracking my brain trying to get it and the answer was so simple. Is there a way to do this with index, match?

    Martindwilson, I tried your index match solution and just got back an #N/A.
    Thanks all.
    Ryan

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Trying to add cells with multiple criteria that are less than or equal to a date

    well it works ! otherwise it wouldnt show the results i posted, but glens is shorter
    t

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,327

    Re: Trying to add cells with multiple criteria that are less than or equal to a date

    Yeas, but it would be a bit of a nightmare. By the way, Martin's formula works perfectly. i've added it onto the sheet I posted earlier...
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-22-2014
    Location
    Platteville, WI
    MS-Off Ver
    2010
    Posts
    5

    Re: Trying to add cells with multiple criteria that are less than or equal to a date

    Thanks Glenn and Martin. Now I see how Martin's works. I don't know why I couldn't get it to work.

    So I am curious on Martin's solution. I don't understand how that is getting all the values that have a date less than or equal to the selected value. To my eye it seems like it would only get the exact match, but it doesn't. Why?

    This is extremely helpful.

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Trying to add cells with multiple criteria that are less than or equal to a date

    the index creates the range so for 7/1/2014
    $B$2:INDEX($B$2:$K$5,0,MATCH($A$1,$B$1:$K$1,0)
    $B$2:INDEX($B$2:$K$5,0,3)
    $B$2:INDEX($D$2:$D$5,0)

    resolves to b2:d5
    Last edited by martindwilson; 12-22-2014 at 12:50 PM.

  9. #9
    Registered User
    Join Date
    12-22-2014
    Location
    Platteville, WI
    MS-Off Ver
    2010
    Posts
    5

    Re: Trying to add cells with multiple criteria that are less than or equal to a date

    Ah. I see. So that only works if the dates are listed in ascending order. For my current case that will probably always be true, but for some other cases I have that won't always be true so I think I will stick with Glenn's solution. Thanks Martin. It really helps to understand how these work so I can use them appropriately in the future.
    Ryan

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,327

    Re: Trying to add cells with multiple criteria that are less than or equal to a date

    A happy man!! If that's it, can you please mark the thread as solved by selecting Thread Tools from the menu link above and mark this thread as SOLVED, and preferably also click the add reputation button at the foot of the post(s) of all members who helped you reach a solution.

  11. #11
    Registered User
    Join Date
    12-22-2014
    Location
    Platteville, WI
    MS-Off Ver
    2010
    Posts
    5

    Re: Trying to add cells with multiple criteria that are less than or equal to a date

    Of course. Done.

+ 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. [SOLVED] Index Match equal to or less than date with multiple criteria
    By harrismlzn in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-19-2014, 05:38 PM
  2. [SOLVED] Not Equal To Multiple Criteria
    By amartin575 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-23-2013, 04:35 PM
  3. [SOLVED] If not equal to multiple criteria/worksheets
    By ANDREWA in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2012, 12:02 PM
  4. Formulas, multiple criteria based on date in other cells
    By simesPSB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-24-2011, 02:30 PM
  5. [SOLVED] criteria for a given date equal or -greater then-
    By J_J in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-22-2005, 05:06 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