+ Reply to Thread
Results 1 to 19 of 19

To get the Data from multiple Criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    02-02-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    21

    To get the Data from multiple Criteria

    Dear all,

    Need help. Please refer the attachment.

    Thanks


    i refer this formula, but can't work


    =IFERROR(IF(OR($J$5:$J$13=$I$14),IFERROR(INDEX(I$5:I$13,SMALL(IF($J$5:$J$13=$I$14,ROW($J$5:$J$13)-ROW($J$5)+1),ROWS(I$17:I17))),""),INDEX(I$5:I$13,SMALL(ROW($J$5:$J$13)-ROW($J$5)+1,ROWS(I$17:I17)))),"")
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: To get the Data from multiple Criteria

    Since you have clearly deleted some columns and rows before posting this, your current formula does not make any sense at all. However, I do know what you are doing. However, life would be much simpler for you if the Branch names in H2 were in separate cells. Is this possible? If not, what is the MAXIMUM number of Branches that cou need to include in the query?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Registered User
    Join Date
    02-02-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    21
    Quote Originally Posted by Glenn Kennedy View Post
    Since you have clearly deleted some columns and rows before posting this, your current formula does not make any sense at all. However, I do know what you are doing. However, life would be much simpler for you if the Branch names in H2 were in separate cells. Is this possible? If not, what is the MAXIMUM number of Branches that cou need to include in the query?
    Yes it is seperate cell and repeated.
    branches have only 3

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: To get the Data from multiple Criteria

    I hope that I have understood you correctly. This array formula will search the data for one name and up to three Branches and will return all matching values. Array Formulae are a little different from ordinary formulas in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly braces { } appear around the outside of your formula. If you do not CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly braces yourself - it won't work...

    Formula: copy to clipboard
    =IFERROR(IFERROR(IFERROR(INDEX(B:B,SMALL(IF($A$2:$A$10=$H$1,IF($C$2:$C$10=$H$2,ROW($C$2:$C$10))),ROWS($1:1))),INDEX(B:B,SMALL(IF($A$2:$A$10=$H$1,IF($C$2:$C$10=$I$2,ROW($C$2:$C$10))),ROWS($1:1)-COUNTIFS($A:$A,$H$1,$C:$C,$H$2)))),INDEX(B:B,SMALL(IF($A$2:$A$10=$H$1,IF($C$2:$C$10=$J$2,ROW($C$2:$C$10))),ROWS($1:1)-(COUNTIFS($A:$A,$H$1,$C:$C,$H$2)+(COUNTIFS($A:$A,$H$1,$C:$C,$I$2)))))),"")


    copied across and down.

  5. #5
    Registered User
    Join Date
    02-02-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    21

    Re: To get the Data from multiple Criteria

    Quote Originally Posted by Glenn Kennedy View Post
    I hope that I have understood you correctly. This array formula will search the data for one name and up to three Branches and will return all matching values. Array Formulae are a little different from ordinary formulas in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly braces { } appear around the outside of your formula. If you do not CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly braces yourself - it won't work...

    Formula: copy to clipboard
    =IFERROR(IFERROR(IFERROR(INDEX(B:B,SMALL(IF($A$2:$A$10=$H$1,IF($C$2:$C$10=$H$2,ROW($C$2:$C$10))),ROWS($1:1))),INDEX(B:B,SMALL(IF($A$2:$A$10=$H$1,IF($C$2:$C$10=$I$2,ROW($C$2:$C$10))),ROWS($1:1)-COUNTIFS($A:$A,$H$1,$C:$C,$H$2)))),INDEX(B:B,SMALL(IF($A$2:$A$10=$H$1,IF($C$2:$C$10=$J$2,ROW($C$2:$C$10))),ROWS($1:1)-(COUNTIFS($A:$A,$H$1,$C:$C,$H$2)+(COUNTIFS($A:$A,$H$1,$C:$C,$I$2)))))),"")


    copied across and down.
    thanks, it seem like work. let me try apply more..

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: To get the Data from multiple Criteria

    Apologies. I forgot the attachment. You will be wondering what the hell is going on!!!
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-02-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    21

    Re: To get the Data from multiple Criteria

    Quote Originally Posted by Glenn Kennedy View Post
    Apologies. I forgot the attachment. You will be wondering what the hell is going on!!!
    ok, tried. If let said, i only have 2 branches, Branch A and Branch B

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: To get the Data from multiple Criteria

    You said that there could be up to 3 Branches - so that is what I provided. If any of the H2 toJ2 cells are left blank, it will work perfectly.

    However, if the maximum number of Branches is 2, not 3;then a shorter array formula can be used:

    Formula: copy to clipboard
    =IFERROR(IFERROR(INDEX(B:B,SMALL(IF($A$2:$A$10=$H$1,IF($C$2:$C$10=$H$2,ROW($C$2:$C$10))),ROWS($1:1))),INDEX(B:B,SMALL(IF($A$2:$A$10=$H$1,IF($C$2:$C$10=$I$2,ROW($C$2:$C$10))),ROWS($1:1)-COUNTIFS($A:$A,$H$1,$C:$C,$H$2)))),"")


    copied across and down. It will look for a maximum of 2 Branch names in H2 and I2, and a person's name in H1.

  9. #9
    Registered User
    Join Date
    02-02-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    21

    Re: To get the Data from multiple Criteria

    Quote Originally Posted by Glenn Kennedy View Post
    You said that there could be up to 3 Branches - so that is what I provided. If any of the H2 toJ2 cells are left blank, it will work perfectly.

    However, if the maximum number of Branches is 2, not 3;then a shorter array formula can be used:

    Formula: copy to clipboard
    =IFERROR(IFERROR(INDEX(B:B,SMALL(IF($A$2:$A$10=$H$1,IF($C$2:$C$10=$H$2,ROW($C$2:$C$10))),ROWS($1:1))),INDEX(B:B,SMALL(IF($A$2:$A$10=$H$1,IF($C$2:$C$10=$I$2,ROW($C$2:$C$10))),ROWS($1:1)-COUNTIFS($A:$A,$H$1,$C:$C,$H$2)))),"")


    copied across and down. It will look for a maximum of 2 Branch names in H2 and I2, and a person's name in H1.
    Oh, Ok. Cause i would like to test if they only 2 Branch Names.
    I worried in future there will be less or more.. Branch Names as well, if let said 4 branch name. I need to add more (Index Match), right?

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: To get the Data from multiple Criteria

    Yes... but it's not quite that simple. You also need to modify the formula to reset the row counter. Do you want me to modify the formula to allow for up to 4 names?

  11. #11
    Registered User
    Join Date
    02-02-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    21

    Re: To get the Data from multiple Criteria

    Quote Originally Posted by Glenn Kennedy View Post
    Yes... but it's not quite that simple. You also need to modify the formula to reset the row counter. Do you want me to modify the formula to allow for up to 4 names?
    Yes, please. Thanks

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: To get the Data from multiple Criteria

    OK. I'm on a train and the wifi isn't great. I will have it back online as soon as i can.

  13. #13
    Registered User
    Join Date
    02-02-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    21

    Re: To get the Data from multiple Criteria

    Quote Originally Posted by Glenn Kennedy View Post
    OK. I'm on a train and the wifi isn't great. I will have it back online as soon as i can.
    OK,ok.. sure no problem.. Thank you so much

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: To get the Data from multiple Criteria

    Finally... the wifi starts to work. Here's the file...
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    02-02-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    21

    Re: To get the Data from multiple Criteria

    Quote Originally Posted by Glenn Kennedy View Post
    Finally... the wifi starts to work. Here's the file...
    Ok, thanks. Let me try out.

  16. #16
    Registered User
    Join Date
    02-02-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    21

    Re: To get the Data from multiple Criteria

    Thanks Glenn, its work.

  17. #17
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,654

    Re: To get the Data from multiple Criteria

    Glen, while not using this:

    IF(ISNUMBER(MATCH($C$2:$C$10,$H$2:$K$2,0)),ROW(INDIRECT("1:"&ROWS($C$2:$C$10))),"")

    to create a array of branch match?

    then the formula should be more handsome.
    Quang PT

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: To get the Data from multiple Criteria

    Chacha123,
    Glad to have helped! If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. It'd also be appreciated if you were to click the add Reputation button at the foot of any of the posts of those who helped you reach a solution.

    Bebo...
    Not sure I follow you - can you explain??

  19. #19
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,654

    Re: To get the Data from multiple Criteria

    This version is for multi branches as criteria, for example, up to 5 branches in H2 to L2 and can be expanded as many as needed.

    In G7:

    =IFERROR(INDEX(B$2:B$12,SMALL(IFERROR(IF(MATCH($C$2:$C$12,$H$2:$L$2,0)*
    ($A$2:$A$12=$H$1)>0,ROW(INDIRECT("1:"&ROWS($A$2:$A$12))),""),""),ROWS($1:1))),"")

    Confirmed with Ctrl-shift-enter. Drag down and accross.
    Attached Files Attached Files

+ 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. Consolidating data from multiple worksheets into a summary sheet having multiple criteria
    By Marushka Pinto in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2015, 11:11 PM
  2. Filter Excel Data using vba multiple criteria multiple columns
    By pmyk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2013, 01:32 AM
  3. Replies: 0
    Last Post: 10-16-2013, 12:42 PM
  4. Replies: 1
    Last Post: 12-25-2012, 05:32 PM
  5. Macro to Segregate the data based on Multiple Criteria's in Multiple Columns -Challenging!
    By Novice_To_Excel in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-08-2012, 07:31 AM
  6. Replies: 0
    Last Post: 12-12-2011, 07:27 PM
  7. Replies: 0
    Last Post: 07-27-2011, 01:00 AM

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