Multiple returns with 2 criteria from another workbook

  • Hi,


    I hope to get some help here with a problem that I have.


    I have a workbook that retrieves information from different workbooks, this all works well.

    The main problem I have is when there is more then 1 result.


    Please see attached file with a sample.


    Just to clarify the sample is retrieving on a different sheet within the same workbook. The solution needs to be that it needs to retrieve that information from a different workbook.


    Hope you guys can help me out, I would really appreciated it.


    Thanks


    Production Reports_WIP.zip

  • Hello,


    If I am not mistaken, based on your explanations, in the Overview sheet, you should only get the results shown ... since there is no other instance of your combined search for both 13 01 2022 along with A4 ...


    Please clarify

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Carim thank you for your reply, I just saw your message.


    I will recheck my example and give a proper explanation of what I want.


    I appreciate the help.

  • Hello,


    Feel free to build another example to illustrate your potential problem ...


    And be confident about the solution ... since multiple returns with multiple criteria is indeed possible with an Array Formula ;)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Hello,


    To clarify things ... have adjusted with a red font your original data ... so that you can exactly see how the array formula retrieves the first, the second and the third instances ...


    Hope this will help

  • Carim


    Holy moly, that did the trick. I made it work in the original file, it works like a charm.

    You made my day, thank you so much

    Glad you could fix your problem :)


    Thanks for your Thanks AND for the Like 8)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Carim Just a quick update:


    I have successfully implemented the solution, see code below, and it works perfect. All the information is displayed how it should.


    Code
    =IFERROR(INDEX('Database'!$T$1:$T$2002,LARGE(IF(F28&G28&$AW$8='Database'!$B$1:$B$2002&'Database'!$C$1:$C$2002&'Database'!$X$1:$X$2002,ROW('Database'!$C$1:$C$2002),0),SUM(('Database'!$B$1:$B$2002=F28)*('Database'!$C$1:$C$2002=G28)*('Database'!$X$1:$X$2002=$AW$8))-I28+1)),"")

    The retrieval of the information is working without any problems, however when I try to SUM the results it gives me a #value error.

    The code I am using, see below, works perfectly when I type in the value manually, but when used with the first code it gives me an #Value error.

    I tried to change the condition of the cells to Number / General, but nothing seems to help.

    Code
    =SUM(($AO$28:$AO$55+$AP$28:$AP$55+$AQ$28:$AQ$55)*(--($D$28:$D$55=D24)))/60


    Would you be able to assist ?

    Thank for any help you can give me.

  • Hello,


    There is no reason which would explain why you cannot perform a Sum ...


    Could you attach a sample with just 10 to 15 rows to illustrate the problem ?

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Difficult to guess what might have happened ...


    1. Make sure there are no empty cells or text cells within your arrays ...

    2. Arrays can be very "greedy" in terms of memory ... so just check the total number of formulas you are using ...


    Hope this will help

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Carim

    So double checked everything and your nr. 1 suggestion was the solution.


    I now made sure that the array shows an 0 when the cell is empty.


    All is good now, again thank you for the help

  • Pleased to hear you have all sorted it out :)


    Thanks a lot for your Thanks AND for the Like 8)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Carim or somebody else.

    Hi, I hope you are able to help me with a small problem I am having with the code you provided

    The code works perfect and made changes so it works perfect, but when I add a 3 criteria that looks at text, things go wrong.

    the code I am using now

    Code
    =IFERROR(INDEX('Production Reports'!$BL$1:$BL$2000,LARGE(IF(B15&C15&$AZ$3='Production Reports'!$B$1:$B$2000&'Production Reports'!$C$1:$C$2000&'Production Reports'!$BP$1:$BP$2000,ROW('Production Reports'!$C$1:$C$2000),0),SUM(('Production Reports'!$B$1:$B$2000=B15)*('Production Reports'!$C$1:$C$2000=C15)*('Production Reports'!$BP$1:$BP$2000=$AZ$3))-E15+1)),"0")

    In Column BL are my minutes and in Column BP is the category that those minutes belong too (I have 6 categories)

    When I have more than 1 result on a specific day it will retrieve the information perfectly, but only when the categories are the same

    if they are not the same all the info will be added to the first found entry.


    Also when the first entry has no info in column BL&BP but the second entry does, then all the info will be shown in the row of the first entry.



    Is there a way to change the code so it can look at text to ? extra columns and assign a number to a category will give the same results.


    Or is the formula not capable of doing 3 criteria?


    Hope somebody can help me

    Edited 2 times, last by xsmurf ().

  • Hello,


    Quite honestly, attaching a tiny sample file ... to illustrate your latest question ... would allow all the potential ( and multiple ...) confusions to disappear ... ;)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Hi,


    Thanks for your sample file.


    It appears that an approach based on formulas will not generate your expected result ... as you are adding more criteria ...

    If need be, could explain the problems generated by Large(range,k) where k turns out to be the issue ... since it is no longer the same total of identical rows ...


    Would you mind heading towards a faster and more reliable VBA-based solution ?

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!