+ Reply to Thread
Results 1 to 10 of 10

Double vlookup for table array with dates

  1. #1
    Registered User
    Join Date
    04-07-2009
    Location
    Los Angeles, United States
    MS-Off Ver
    Office 2008-Mac
    Posts
    49

    Double vlookup for table array with dates

    I have a table that shows a row of dates, a row of campaigns, and then a row of values I need to reference. I need to pull the values for a specific date and corresponding campaign.

    For example, I need to pull the value for campaign 'notset' on 6/16/09.

    I tried the following, but it would only work on the first and last campaign:

    =IF(VLOOKUP($A3,Campaign!$A:$F,COLUMN(Campaign!$B:$B),FALSE)="notset",VLOOKUP($A3,Campaign!$A$14:$F$23,COLUMN(Campaign!$C:$C), FALSE),"IDIOT")

    $A3 was the date I was referencing.

    Excel gods, please help me here! TIA!
    Attached Files Attached Files
    Last edited by rkrieg; 06-18-2009 at 01:34 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Double vlookup for table array with dates

    Date in E2
    Campaign In F2:

    This array formula, confirmed with CTRL-SHIFT-ENTER to activate the array, in G2:

    =INDEX($C$1:$C$21, MATCH(E2, IF($B$1:$B$21 = F2, $A$1:$A$21), 0))
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Double vlookup for table array with dates

    Please Login or Register  to view this content.
    The formula in G2 is =INDEX($C$1:$C$21, MATCH(E2 & F2, INDEX(A1:A21 & B1:B21, 0), 0))
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Double vlookup for table array with dates

    Assuming that E2 contains the date of interest, and F2 contains the campaign of interest, try the following formula that needs to be confirmed with CONTROL+SHIFT+ENTER...

    =INDEX($C$2:$C$21,MATCH(1,IF($A$2:$A$21=E2,IF($B$2:$B$21=F2,1)),0))

    or

    =IFERROR(INDEX($C$2:$C$21,MATCH(1,IF($A$2:$A$21=E2,IF($B$2:$B$21=F2,1)),0)),"")

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Double vlookup for table array with dates

    Quote Originally Posted by shg
    The formula in G2 is =INDEX($C$1:$C$21, MATCH(E2 & F2, INDEX(A1:A21 & B1:B21, 0), 0))
    Lovely! A new trick for the notebook. Thanks for that, shg.

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

    Re: Double vlookup for table array with dates

    or as nothing is used more than once on same day
    =SUMPRODUCT((A2:A21=A2)*(B2:B21=B2)*(C2:C21))
    but i must admit its interesting how
    INDEX(A1:A21 & B1:B21) shows a1b1:a2b2......... how did someone find that out
    Last edited by martindwilson; 06-17-2009 at 09:23 PM.
    "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

  7. #7
    Registered User
    Join Date
    04-07-2009
    Location
    Los Angeles, United States
    MS-Off Ver
    Office 2008-Mac
    Posts
    49

    Re: Double vlookup for table array with dates

    Wow you guys are awesome thank you!

    The formula worked and I think I understand it, but can you walk me through it so I make sure I'm understanding it and applying it correctly. I modified and used this as I'm going to be expanding the table array each day.

    =INDEX(C:C, MATCH($A3 & $B$1, INDEX(A:A & B:B, 0), 0))

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Double vlookup for table array with dates

    Quote Originally Posted by JB
    Lovely!
    Actually, I believe I picked that up from DLL, JB.

    Quote Originally Posted by rk
    ... but can you walk me through it ...
    It's the same formula as JB's, except that the inner INDEX function avoids the need for an array formula, because INDEX in that form always returns an array, and Excel knows that.

    It catenates the lookup values, looks for an exact match in the catenation of the first two columns of the table, and returns the value in the corresponding position of the third column. Bring up the Formula Auditing toolbar, and use the Evaluate button to see how it works.

  9. #9
    Registered User
    Join Date
    04-07-2009
    Location
    Los Angeles, United States
    MS-Off Ver
    Office 2008-Mac
    Posts
    49

    Re: Double vlookup for table array with dates

    Perfect thanks again!

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Double vlookup for table array with dates

    You're welcome. Would you please mark the thread as Solved?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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