+ Reply to Thread
Results 1 to 10 of 10

Excel to return value if multiple criteria met

  1. #1
    Registered User
    Join Date
    04-24-2014
    Location
    melbourne,australia
    MS-Off Ver
    Excel 2010
    Posts
    40

    Excel to return value if multiple criteria met

    Hi Gang,

    Trying to find a formula to return a value of column D:D if multiple criteria has been met. The thing is the same criteria might be there many times so there needs to be some sort of loop to keep returning value in D:D each time the criteria is met

    Example:

    A B C D
    Cuisine Dish Rating Feedback
    Chinese Noodles 1 the food sucked
    Chinese pecking duck 1 it was cold
    Chinese soup 1 not enough seasoning

    Criteria: If Cuisine is Chinese and the Dish is Noodles and the Rating is a 1 then return the feedback

    I have a spreadsheet with hundreds of these entries and I want to be able to extract the negative feedback based on the criteria above. Note, any dish with a rating between 1 and 6 is considered negative.

    Is there one formula I can run that will give me all the negative responses?

  2. #2
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Excel to return value if multiple criteria met

    This one may need a little more information on how the output is displayed. Are you returning the values on a column on the same sheet or being returned on on another sheet? Better yet, upload an example spreadsheet.
    Janos S. Vamos
    Data Systems Technician/Fire Controlman PO1(SW/AW)
    US Navy Retired


    Remember, Record Macro can be your friend for figuring out solutions.

    Good or Bad, let me know how I did by clicking on the "Add Reputation" * just to the lower left of here. it only takes a few seconds to let someone know.

  3. #3
    Registered User
    Join Date
    04-24-2014
    Location
    melbourne,australia
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Excel to return value if multiple criteria met

    Thanks for your help.

    See attached Sample: sample.xlsx

    I would like to list all the negative feedback on one sheet (sheet1). I have another sheet with all the raw data (data).

    Thanks!

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel to return value if multiple criteria met

    Try this...

    Data Range
    A
    B
    C
    1
    Cuisine
    Chinese
    2
    Dish
    Rating 1-6
    Feedback
    3
    Noodles
    1
    the food sucked
    4
    pecking duck
    3
    it was cold
    5
    soup
    5
    not enough seasoning
    6
    lamian
    6
    portion size was too small
    7


    Enter this array formula** in A3:

    =IFERROR(INDEX(data!B:B,SMALL(IF(data!$A$2:$A$13=$B$1,IF(data!$C$2:$C$13<=6,ROW(data!$A$2:$A$13))),ROWS(A$3:A3))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy across to C3 then down until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    04-24-2014
    Location
    melbourne,australia
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Excel to return value if multiple criteria met

    Hi Biff,

    Your method works but I just realised the raw data actually has some columns in between so when I apply your formula it will give me data from the 3 rows next that are next to each other. If I told you which columns the data lives for "Cuisine", "Dish", "Rating" and "Feedback" will you be able to work that in?

    Cuisine = Column C
    Dish = Column D
    Rating = Column H
    Feedback = Column I

    Thanks in advance!

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel to return value if multiple criteria met

    OK, in that case, instead of using one formula and copying it, you'll need three formulas, one for each column.

    ALL formulas are array formulas**.

    Entered in A3:

    =IFERROR(INDEX(data!D:D,SMALL(IF(data!$C$2:$C$13=$B$1,IF(data!$H$2:$H$13<=6,ROW(data!$C$2:$C$13))),ROWS(A$3:A3))),"")

    Entered in B3:

    =IFERROR(INDEX(data!H:H,SMALL(IF(data!$C$2:$C$13=$B$1,IF(data!$H$2:$H$13<=6,ROW(data!$C$2:$C$13))),ROWS(B$3:B3))),"")

    Entered in C3:

    =IFERROR(INDEX(data!I:I,SMALL(IF(data!$C$2:$C$13=$B$1,IF(data!$H$2:$H$13<=6,ROW(data!$C$2:$C$13))),ROWS(C$3:C3))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Select A3:C3 and copy down until you get blanks.

  7. #7
    Registered User
    Join Date
    04-24-2014
    Location
    melbourne,australia
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Excel to return value if multiple criteria met

    works perfectly.. lastly, I am trying to add one more criteria but cant seem to get it to work. I want to add it to all three arrays: IF(data!$D$2:$D$300=$B$2

    Also, i noticed when there is no feedback it outputs the number 0.. can we have it output as blank instead?
    Last edited by emortals; 06-20-2014 at 11:05 PM.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel to return value if multiple criteria met

    Like this...

    Entered in A3:

    =IFERROR(INDEX(data!D:D,SMALL(IF(data!$D$2:$D$13=$B$2,IF(data!$C$2:$C$13=$B$1,IF(data!$H$2:$H$13<=6,ROW(data!$C$2:$C$13)))),ROWS(A$3:A3))),"")

    Entered in B3:

    =IFERROR(INDEX(data!H:H,SMALL(IF(data!$D$2:$D$13=$B$2,IF(data!$C$2:$C$13=$B$1,IF(data!$H$2:$H$13<=6,ROW(data!$C$2:$C$13)))),ROWS(B$3:B3))),"")

    Entered in C3:

    =IFERROR(INDEX(data!I:I,SMALL(IF(data!$D$2:$D$13=$B$2,IF(data!$C$2:$C$13=$B$1,IF(data!$H$2:$H$13<=6,IF(data!$I$2:$I$13<>"",ROW(data!$C$2:$C$13))))),ROWS(C$3:C3))),"")

    Don't forget: Array entered!

  9. #9
    Registered User
    Join Date
    04-24-2014
    Location
    melbourne,australia
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Excel to return value if multiple criteria met

    Quote Originally Posted by Tony Valko View Post
    Like this...

    Entered in A3:

    =IFERROR(INDEX(data!D:D,SMALL(IF(data!$D$2:$D$13=$B$2,IF(data!$C$2:$C$13=$B$1,IF(data!$H$2:$H$13<=6,ROW(data!$C$2:$C$13)))),ROWS(A$3:A3))),"")

    Entered in B3:

    =IFERROR(INDEX(data!H:H,SMALL(IF(data!$D$2:$D$13=$B$2,IF(data!$C$2:$C$13=$B$1,IF(data!$H$2:$H$13<=6,ROW(data!$C$2:$C$13)))),ROWS(B$3:B3))),"")

    Entered in C3:

    =IFERROR(INDEX(data!I:I,SMALL(IF(data!$D$2:$D$13=$B$2,IF(data!$C$2:$C$13=$B$1,IF(data!$H$2:$H$13<=6,IF(data!$I$2:$I$13<>"",ROW(data!$C$2:$C$13))))),ROWS(C$3:C3))),"")

    Don't forget: Array entered!
    Hi Tony, for the formula specified for C3, that will exclude all results with blank feedback. I don't want to exclude them I just want them to be returned as blank instead of zero values.

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel to return value if multiple criteria met

    Try this...

    Still array entered.

    =IFERROR(INDEX(Data!I$2:I$13&"",SMALL(IF(Data!D$2:D$13=B$2,IF(Data!C$2:C$13=B$1,IF(Data!H$2:H$13<=6,ROW(Data!I$2:I$13)))),ROWS(C$3:C3))-ROW(I$2)+1),"")

+ 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] How to return multiple values to a single cell based on multiple criteria
    By lwallace in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-20-2014, 06:32 AM
  2. [SOLVED] Return value based on multiple criteria in Excel
    By amygray1993 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 03-24-2014, 11:27 AM
  3. Match single criteria and return multiple rows in excel
    By taernster in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-07-2014, 05:53 PM
  4. Replies: 0
    Last Post: 10-16-2013, 12:42 PM
  5. User Form to Search multiple Criteria to return multiple Results
    By Calieth in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-16-2011, 11:57 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