+ Reply to Thread
Results 1 to 11 of 11

Get the column to the right of a Sumproduct & Max formula

  1. #1
    Registered User
    Join Date
    10-10-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    69

    Get the column to the right of a Sumproduct & Max formula

    Ok I have a formula that checks a table of data and checks to make sure the animal matches and that the date associated to that animal is less than a specified date. The formula is as follows:

    Please Login or Register  to view this content.
    and this brings back the date column info and this works fine. However I now need to bring back the info on the column to the right of it called 'Number Key' and I am struggling to get it going. So the formula should bring back 3 as that row is DOG and its date is just less than the 19/03/13. I have tried the below formula:

    Please Login or Register  to view this content.
    and although it looks like it's working it doesn't work for different test scenarios like if I choose BIRD and the date 18/01/2013 it gets the wrong Number Key. Does anyone have any ideas of how I can extend my original formula to get the column to the right, or how I can modify the array formula to bring back the right info? I have attached the spread sheet to show you what I mean. Your help is much appreciated!

    bringing back the column to the right.xlsx

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Get the column to the right of a Sumproduct & Max formula

    Try this array formula...
    =INDEX($C$2:$C$14,MATCH($E$3&$E$7,$A$2:$A$14&$B$2:$B$14,0))
    entered using CTRL SHFT ENTER

    (I hate what the Table structure does to formulas, so I just typed in the values)
    Last edited by FDibbins; 03-05-2014 at 01:45 AM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Get the column to the right of a Sumproduct & Max formula

    Or regular formula not an array

    =INDEX($C$2:$C$14,MATCH($E$3&$E$7,INDEX($A$2:$A$14&$B$2:$B$14,0),0))
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Registered User
    Join Date
    10-10-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Get the column to the right of a Sumproduct & Max formula

    Thanks so much FDibbins and AlKey for your responses! I had no idea you could simply put an & to concatenate both the lookup value and the search array. This will come in so handy - thanks once again, it is much appreciated!

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Get the column to the right of a Sumproduct & Max formula

    You're welcome and thank you for the feedback!

  6. #6
    Registered User
    Join Date
    10-10-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Get the column to the right of a Sumproduct & Max formula

    Hey Guys,

    I just realised that the formulas you gave me don't work. Your formulas only bring back matching dates, but I need this formula to bring back a date less than the date in F3.

    None of your formulas do this and instead you changed the reference date to E7 so that way you could find a matching date. So to clarify the formula needs to match the animal in E3 and the date should be less than F7 and it should bring back the result in column C. Do you have any ideas? Thanks,

  7. #7
    Registered User
    Join Date
    10-10-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Get the column to the right of a Sumproduct & Max formula

    Ahhr don't worry, I figured it out using your techniques, thanks once again!

    Please Login or Register  to view this content.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Get the column to the right of a Sumproduct & Max formula

    Range concatenation is inefficient.

    This array formula** is faster to calculate:

    =INDEX(C2:C14,MATCH(E3,IF(B2:B14=E7,A2:A14),0))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  9. #9
    Registered User
    Join Date
    10-10-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Get the column to the right of a Sumproduct & Max formula

    Hi Tony,

    Thanks for your reply. Unfortunately though your formula doesn't check if the date is less than F7. You have done the same thing as everyone else for some reason. Do you know how to make your formula work so it solves the 2 criteria?

    Thanks,

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Get the column to the right of a Sumproduct & Max formula

    Tony's formula works for me - he's using the result of your original MAX date formula in E7, so that is already guaranteed to be < F3. Alkey and FDibbins did the same thing with their suggestions so all of those should give you correct results. If you don't want the formula to use the value calculated in E7 you can use this version

    =INDEX(C2:C14,MATCH(E3,IF(B2:B14=MAX(IF(A2:A14=E3,IF(B2:B14<F3,B2:B14))),A2:A14),0))
    Last edited by daddylonglegs; 03-05-2014 at 09:00 PM.
    Audere est facere

  11. #11
    Registered User
    Join Date
    10-10-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Get the column to the right of a Sumproduct & Max formula

    Thanks guys, yeah it works great. I didn't know you guys were referencing E7. I thought you were trying to say that the formula was 'all inclusive' so to speak. Because what I need to do is have just 1 formula to do this, I wont be able to split it up into 2 calculations on my project. But this was a silly mistake on my behalf. Thanks once again all for your help.

+ 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] Help to amend sumproduct formula to minus depending on entry in another column
    By KELLIS in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-14-2013, 02:15 PM
  2. [SOLVED] sumproduct formula only counting dates in column
    By jyadayada in forum Excel General
    Replies: 17
    Last Post: 08-09-2012, 03:40 PM
  3. Replies: 3
    Last Post: 06-16-2010, 02:38 AM
  4. Add another Condition Column to Sumproduct formula
    By bdb1974 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-24-2009, 10:39 AM
  5. sumproduct problem-When the #s in the E column are negative my formula
    By jrcream in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2008, 06:00 PM

Tags for this Thread

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