+ Reply to Thread
Results 1 to 14 of 14

Lookup function two fixed and one conditional matches

  1. #1
    Registered User
    Join Date
    11-24-2012
    Location
    Annapolis, Maryland
    MS-Off Ver
    Excel 2010
    Posts
    36

    Lookup function two fixed and one conditional matches

    Good Morning, Excel Forum World.

    See the attached file.

    Step One: TWO Cell Exact Match. Seek formula in yellow highlighted cells in Table 1 seeking exact match of column A and B items to items within Table 2 column H and I.

    Step Two: Conditional Lookup. Enter soonest time from column J exceeding or equalling the column C time but by not more than the time entered in cell M:16.

    Enter Zero (0) if there is no match meeting these conditions.

    NOTE: The formula entered in the E column answers a different question. It asks whether the matching number is the next higher number and enters 0 if it is not the next higher number, apparently ignoring the two cell exact match condition. Example: See cell E:22. The desired answer number for E:22 is in D:22, entered manually. However, the number in J:34 is causing the formula answer to be ZERO, because the desired number is the second number greater than the c:22 number and even though the two matching conditions are not met.

    Any way to do this without decending or ascending sort, or with standard non array formula?

    Thanks so very much
    Attached Files Attached Files

  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: Lookup function two fixed and one conditional matches

    In K1, then copied down:
    =H17&"-"&I17

    In E17, enter this array formula:
    =MAX(IF(A17&"-"&B17=$K$17:$K$32, $J$17:$J$32))
    ...confirmed by pressing CTRL-SHIFT-ENTER to activate the array. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL-SHIFT-ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    _________________
    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 JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Lookup function two fixed and one conditional matches

    Or maybe this array formula:

    =IFERROR(INDEX($J$17:$J$32, SMALL(IF(($K$17:$K$32=A16&"-"&B16)*($J$17:$J$32>=C16), ROW($J$17:$J$32)-16, ""), 1)), 0)

  4. #4
    Registered User
    Join Date
    11-24-2012
    Location
    Annapolis, Maryland
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Lookup function two fixed and one conditional matches

    Thanks for the two options.

    Having trouble with both.

    Couple of things. Need not less than the time in column C. And need reference to m:16 as a max on the condition.

    The original formula was close, but it defaulted to zero if the "right" answer was not the lowest number exceeding the threshold, seemingly ignoring the fixed conditions requirement for items in a and b columns.

  5. #5
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Lookup function two fixed and one conditional matches

    Try this regular formula, it's a bit long, but works with the data provided :
    In C17:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Drag down

    Hope this helps
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  6. #6
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Lookup function two fixed and one conditional matches

    Or this Array Formula (Cntrl+Shift+Enter,not just Enter) in c17:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Drag down

    Edit-
    Added workbook, both formulas are in the green shaded cells

    Hope this helps
    Attached Files Attached Files
    Last edited by dredwolf; 03-02-2013 at 01:31 PM. Reason: Added Workbook

  7. #7
    Registered User
    Join Date
    11-24-2012
    Location
    Annapolis, Maryland
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Lookup function two fixed and one conditional matches

    Dear Dredwolf:

    Looks great. Works perfect in the model. I did change the H,I and J reference row from 32 to 35. Also changed the data for testing purposes. Will examine function in real file. Once I do this, I'll get back to forum and hopefully mark this one as solved.

    Thanks you so much. This is really awesomest!

  8. #8
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Lookup function two fixed and one conditional matches

    You are welcome

  9. #9
    Registered User
    Join Date
    11-24-2012
    Location
    Annapolis, Maryland
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Lookup function two fixed and one conditional matches

    Thanks for all the help with this query. Getting closer for sure.

    General Objective: Examine the times in column C. Search for the time in column J that equals or exceeds the C column time, but which is also less than the value in M1 plus the C column time, and which also has an exact match in the A, B and H, I columns. The formula is to be placed in column E at cell E17 downward.
    Update: The formula has been pasted to and copied to E17:E33. The formula works as long as there are no column A and B duplications in Table 1. I apparently had no column A, B, H & I duplications in the original file. It appears that Column H and I duplications impact the results too, but only if there is a greater time value. (Copy the contents of L22:M22 to H22. The change results in a Zero value in cell E21. The lower time value at J30 does not impact the E21 result standing alone). The two table below have been modified to create duplications A and B duplications in Table 1 and H & I duplications in Table 2. The fill colors visually direct the viewer to the matching desired answers. If the reconcile column (F) is greater than zero, then there is an error.
    Attached Files Attached Files

  10. #10
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Lookup function two fixed and one conditional matches

    Try this instead:
    in E17:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Drag down

    this is a lot shorter than the original

    Hope this helps
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-24-2012
    Location
    Annapolis, Maryland
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Lookup function two fixed and one conditional matches

    Dear dredwolf: Revised model works perfectly in the model. Will examine formula in "real" file. So far so good. Will mark as solved once proffing completed. Thanks so much for your help with this. Take the rest of this Sunday off!

  12. #12
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Lookup function two fixed and one conditional matches

    You are welcome
    Here's crossing my fingers for the "real" data test
    And this is how I relax...LOL..

  13. #13
    Registered User
    Join Date
    11-24-2012
    Location
    Annapolis, Maryland
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Lookup function two fixed and one conditional matches

    It works. Yes! Thank you all!

  14. #14
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Lookup function two fixed and one conditional matches

    You are 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