+ Reply to Thread
Results 1 to 23 of 23

How to use formula to search for result that satisfy 3 criteria

  1. #1
    Forum Contributor
    Join Date
    12-06-2015
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    513

    How to use formula to search for result that satisfy 3 criteria

    Dear all

    I want to know how i can get the result that would satisfy 3 criterias

    I have a data base that categorized into city, company, service and price

    I would like to get the price based on city that user choose
    Then, the city filter the company that can select
    Once they got the company,service then can be selected

    finally, the price of the services

    See attached excel file

    Thanks
    Eric
    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,419

    Re: How to use formula to search for result that satisfy 3 criteria

    Delete the helper column and use this (see sheet as this refers to the sample MINUS helper column).

    =INDEX($G$5:$G$12,MATCH(1,INDEX(($D$5:$D$12=I5)*($E$5:$E$12=J5)*($F$5:$F$12=K5),0),0))
    Attached Files Attached Files
    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
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2021
    Posts
    5,977

    Re: How to use formula to search for result that satisfy 3 criteria

    Or try:

    =LOOKUP(2,1/($D$5:$D$12=J5)/($E$5:$E$12=K5)/($F$5:$F$12=L5),$H$5:$H$12)

  4. #4
    Forum Contributor
    Join Date
    12-06-2015
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    513

    Re: How to use formula to search for result that satisfy 3 criteria

    Dear all

    Thanks so much

    I use a helper column that =CONCAT(J6,K6,L6)as in M5

    =INDEX($H$5:$H$12,MATCH($M5,$G$5:$G$12,0))

    It seems better

    I get the idea from https://www.youtube.com/watch?v=zjfpA2kJhm8&t=261s

    Thanks

    Eric

  5. #5
    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,419

    Re: How to use formula to search for result that satisfy 3 criteria

    Why useit, if there is no need? formulae with concatenation also have a reputation of being a bit slow.

    Anyhow.

    You're welcome.



    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 all members who helped you reach a solution.

  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,419

    Re: How to use formula to search for result that satisfy 3 criteria

    You can use a helper, of course, but the problem is relatively simple to solve without a helper. Most people want to avoid helpers!!! Even in circumstances where they are really helpful.

    =INDEX($H$5:$H$12,MATCH(J5&K5&L5,$G$5:$G$12,0))

    will work in your case.

  7. #7
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,799

    Re: How to use formula to search for result that satisfy 3 criteria

    D
    E
    F
    G
    H
    I
    J
    K
    L
    2
    DataBase
    3
    4
    City Company Service Costs City Company Service Costs
    5
    BJS A Transfer
    10
    SIA B Coach
    19
    6
    BJS A Tour
    11
    7
    BJS A Meal
    12
    8
    BJS A Acc
    13
    9
    BJS B Transfer
    15
    10
    BJS B Tour
    17
    11
    SIA B Coach
    19
    12
    SIA B Acc
    20


    L5=SUMIFS(G5:G12,D5:D12,I5,E5:E12,J5,F5:F12,K5)
    Last edited by CARACALLA; 11-23-2019 at 12:34 PM.

  8. #8
    Forum Contributor
    Join Date
    12-06-2015
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    513

    Re: How to use formula to search for result that satisfy 3 criteria

    Glenn

    I try to apply to the real case, it does not work.

    Can you enlighten me what wrong?!

    Eric
    Attached Files Attached Files

  9. #9
    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,419

    Re: How to use formula to search for result that satisfy 3 criteria

    I don't know which one you were trying to replicate!! But see the file attached.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    12-06-2015
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    513

    Re: How to use formula to search for result that satisfy 3 criteria

    Caracalla

    Thanks, i never think of the Sumifs to work like this

    But in real case, the Costs has variety items not just 1 cost

    see the attached, i though the Index and Match would be a good choice

    Eric
    Attached Files Attached Files

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,500

    Re: How to use formula to search for result that satisfy 3 criteria

    You have marked the thread as solved - is it?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  12. #12
    Forum Contributor
    Join Date
    12-06-2015
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    513

    Re: How to use formula to search for result that satisfy 3 criteria

    Glenn

    I like your solution but when i try to change the service, the Price did not change.

    Did i did something wrong again?

    Eric

  13. #13
    Forum Contributor
    Join Date
    12-06-2015
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    513

    Re: How to use formula to search for result that satisfy 3 criteria

    Ali

    Sorry, as Glenn has given a very good advice of not to use the Helper.

    I am eager to learn more

    Thanks for your understanding

    Eric

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,500

    Re: How to use formula to search for result that satisfy 3 criteria

    Then please remove the solved tag until you have learnt what you need to know.

  15. #15
    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,419

    Re: How to use formula to search for result that satisfy 3 criteria

    How can two services have the same code?? That does not make sense...

  16. #16
    Forum Contributor
    Join Date
    12-06-2015
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    513

    Re: How to use formula to search for result that satisfy 3 criteria

    Glenn

    Same code as Transfer
    But the service is different, go to different airport in the same city

    Airport transfer - Captial Airport
    Airport transfer - Daxing Airport

    Eric

  17. #17
    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,419

    Re: How to use formula to search for result that satisfy 3 criteria

    I deleted your VLOOKUP. It will always return the FIRST matching result (i.e. to Capital airport).
    Attached Files Attached Files

  18. #18
    Forum Contributor
    Join Date
    12-06-2015
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    513

    Re: How to use formula to search for result that satisfy 3 criteria

    Dear Glenn

    Thanks so much ..

    Why and what mean by Match(1,...what is this 1 mean?

    Thanks
    Eric

  19. #19
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,799

    Re: How to use formula to search for result that satisfy 3 criteria

    V4=IF($A4<>"",SUMPRODUCT(($A$4:$A$100=$P4)*($B$4:$B$100=$Q4)*($C$4:$C$100=$R4)*($D$4:$D$100=$S4)*($E$4:$E$100=$T4)*($F$3:$M$3=$U4)*($F$4:$M$100)),"")

    copy down
    Attached Files Attached Files

  20. #20
    Forum Contributor
    Join Date
    12-06-2015
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    513

    Re: How to use formula to search for result that satisfy 3 criteria

    Caracalla

    Thanks. I perfer Glenn 's solution.

    Appreciated

    Eric

  21. #21
    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,419

    Re: How to use formula to search for result that satisfy 3 criteria

    1 means .... 1 !!

    Eaxh of the ($A$4:$A$5=P4) bits resolves to TRUE or FALSE. When you start multiplying these together you get 1 or zero. There is only one correct result, so the formula returns an array of zeros and a singe 1. The MATCH returns the row number of the only value that returns a 1 (ie when all criteria have been met).

  22. #22
    Forum Contributor
    Join Date
    12-06-2015
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    513

    Re: How to use formula to search for result that satisfy 3 criteria

    Glenn

    Thanks
    Eric

  23. #23
    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,419

    Re: How to use formula to search for result that satisfy 3 criteria

    You're welcome.



    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 all members who helped you reach a solution.

+ 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. [SOLVED] Search multpile criteria to get a result
    By Beach Walker in forum Excel General
    Replies: 4
    Last Post: 07-07-2014, 09:25 PM
  2. [SOLVED] Lookup formula required to search for two criteria and return result
    By dave1983 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-12-2012, 03:29 PM
  3. search for name that satisfy criteria
    By gloom52 in forum Excel General
    Replies: 12
    Last Post: 06-13-2010, 03:02 AM
  4. How do I satisfy 3 of 4 conditions and get a true/false result?
    By Baron J79 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 04-15-2008, 03:21 AM
  5. Replies: 2
    Last Post: 09-04-2007, 08:43 PM
  6. [SOLVED] Satisfy 2 and more criteria
    By Mark McDonough in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-28-2006, 03:15 AM
  7. [SOLVED] Satisfy 2 and more criteria
    By Mark McDonough in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-27-2006, 09:30 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