+ Reply to Thread
Results 1 to 14 of 14

Use an array formula to perform a two or more criteria lookup in Excel

  1. #1
    Forum Contributor
    Join Date
    09-02-2010
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    283

    Use an array formula to perform a two or more criteria lookup in Excel

    Hi There,
    I hope someone can help me to solve my problem

    I have the attached my worksheet (Master database) & LC monitoring workbook.

    I'm trying to create a formula in "LC monitoring" that look up for invoice no and invoice amount which match "LC number".

    How can I do this?
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    If we assume all invoice references are numbers and 0 never valid then given external references etc I'd suggest something like:

    Please Login or Register  to view this content.
    The above can be copied to Cols D & H also - note in your sample you have cust. code & LC Number mixed up in D & H

    For the amount - use a standard VLOOKUP - eg:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    09-02-2010
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    283

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    Dear Volatility,

    Thanks for your help.
    I try to use the fomula suggested for A7. But it seen given me the difference result.
    I hereby attached the Monitoring sheet again to include how the result I wan it to be show.
    I really appreaciate your help again. Thank you very very much.

    Is it possible for you to re-attached the file with your formula for my better understanding?
    So sorry to trouble you.

    Thanks.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    No attachment.

    I presume you noted that the formula in A7 is an Array and must be confirmed with CTRL + SHIFT + ENTER ?
    Confirming the same with Enter (as you would normally) will not suffice in this instance.

  5. #5
    Forum Contributor
    Join Date
    09-02-2010
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    283

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    Hi Donkey,

    Here I reattached.

    I still blurr
    Attached Files Attached Files

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    Error on my part...

    Please Login or Register  to view this content.
    however, this still won't generate the "results should be" given it matches the LC number

    Quote Originally Posted by cyee
    I'm trying to create a formula in "LC monitoring" that look up for invoice no and invoice amount which match "LC number".
    only 10010254 shares that value (the others though same supplier have different LC number)

  7. #7
    Forum Contributor
    Join Date
    09-02-2010
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    283

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    Hi Donkey,

    Perfectly done!! Thank you very very much.

    Can you spare a time to explain to me? :P
    May I know y is it <9.99E+307> <-- what is this means?


    =LOOKUP(9.99E+307,CHOOSE({1,2},0,INDEX('Monitoring chart'!$C$2:$C$30,LARGE(IF('Monitoring chart'!$O$2:$O$30=B$2,ROW('Monitoring chart'!$O$2:$O$30)-ROW('Monitoring Chart'!$O$2)+1),ROWS(A$7:A7)))))

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    9.99E+307 is a very big number ... 9.99*10^307

    Used in the context of this LOOKUP it is used to retrieve the last numeric value from the lookup_vector

    Here the lookup_vector is populated with 2 values [(c/o CHOOSE({1,2},...)]
    the first value being the default "error handler" value of 0
    the second value being the output of the INDEX array

    It follows that if the Array returns a valid number then this will be returned by the LOOKUP (last number) else if it should return an error it will return 0 (last number).

    Following on from your other thread - it would still be better to return a COUNT of the LC number from the other sheet (file) in one cell and use that as basis for establishing whether or not the INDEX array need be performed.

    Using the above construct the Array is always performed once per cell which is less than ideal IMO.
    It is still preferable to the construct used in your other thread (double evaluation) in which the Array is performed at least once but sometimes twice per cell (twice if valid result)

    In XL2007 MS finally introduced the long overdue IFERROR function to prevent need for double evaluation. The LOOKUP approach is limited in scope unlike IFERROR.
    Many developers have VBA (UDF) equivalents of IFERROR in earlier versions but for most excel users a formula handler is preferable (ie no VBA requirements)

  9. #9
    Forum Contributor
    Join Date
    09-02-2010
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    283

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    Hi DOnkey,

    100000000... of appreciate.

  10. #10
    Forum Contributor
    Join Date
    09-02-2010
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    283

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    Hi Donkey,

    Firstly, Happy New Year to you.

    I would like to check regarding above formula you provided to me sometime ago.
    The formula use to check for Invoice with number (example : 10001010).
    How about if my invoice is "TK1010010" or "I201112101"?
    How should I amend the formula?

    A7:
    =LOOKUP(9.99E+307,CHOOSE({1,2},0,INDEX('Monitoring chart'!$C$2:$C$30,LARGE(IF('Monitoring chart'!$O$2:$O$30=B$2,ROW('Monitoring chart'!$O$2:$O$30)-ROW('Monitoring Chart'!$O$2)+1),ROWS(A$7:A7)))))
    Hope to hear from you soon.

    THanks & best regards

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    I think this is related to the #REF! problem you have raised in your other thread which I have answered in the last few minutes.

    In answer to your question: no change required: the issue you have is outlined above (and in the other thread)

  12. #12
    Forum Contributor
    Join Date
    09-02-2010
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    283

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    Thanks Donkey for your help again.
    After corrected the formula its still seem not working for Invoice number start with "TK".
    The formula only able to copy invoice with number but not alphabetic.
    Attached sheet i highlighted in green should appear in A7 to A11.

    Seek for your help again.
    Thanks.
    Attached Files Attached Files

  13. #13
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    Sorry, I'm an idiot ... yes it will cause issues because the LOOKUP is looking explicitly for numbers.

    To cater for multiple types without need for double evaluation of Array

    Please Login or Register  to view this content.
    then Modify VLOOKUP accordingly

    Please Login or Register  to view this content.
    in truth it would be an idea to store the count of invoices in a separate calculation and use that to determine as to whether or not you need conduct the Array in the first instance.

  14. #14
    Forum Contributor
    Join Date
    09-02-2010
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    283

    Re: Use an array formula to perform a two or more criteria lookup in Excel

    oh no... u are not an idiot but i m... U are a genius!!
    I really appreciate your help. Else my work will be alot of double job

+ 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