+ Reply to Thread
Results 1 to 13 of 13

Formula (array?) to list unique entries that match criteria?

  1. #1
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    Formula (array?) to list unique entries that match criteria?

    Hi, I am completely stuck and could really use your help.

    Here is some sample data to use as a reference:

    A | B | C
    1 ITEM | QTY | LOCATION
    2 Item 1 | -1 | Location 1
    3 Item 2 | 1 | Location 2
    4 Item 3 | -1 | Location 3
    5 Item 4 | 1 | Location 3
    6 Item 5 | -1 | Location 3
    7 Item 6 | 1 | Location 3
    8 Item 7 | -1 | Location 3
    9 Item 8 | 1 | Location 4
    10 Item 9 | -1 | Location 2
    11 Item 10 | 1 | Location 3

    What I need help with, I need range D2:D6, to show a list of all unique location(s) that have a negative QTY, or show blank. In the example above, the list would show:

    D
    1 LOCATIONS
    2 Location 1
    3 Location 3
    4 Location 2
    5 <blank>
    6 <blank>


    Note: Alphabetical would be preferred, but not required

    What is a formula I could use for D2:D6?

    Thanks in advance!!

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula (array?) to list unique entries that match criteria?

    In D2 enter this array formula and copy down

    =IFERROR(INDEX($C$2:$C$11,MATCH(0,IF(B$2:B$11>0,"",COUNTIF(D$1:$D1, $C$2:$C$11)),)),"")

    ...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 your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Row\Col
    A
    B
    C
    D
    1
    ITEM QTY LOCATION
    2
    Item 1
    -1
    Location 1 Location 1
    3
    Item 2
    1
    Location 2 Location 3
    4
    Item 3
    -1
    Location 3 Location 2
    5
    Item 4
    1
    Location 3
    6
    Item 5
    -1
    Location 3
    7
    Item 6
    1
    Location 3
    8
    Item 7
    -1
    Location 3
    9
    Item 8
    1
    Location 4
    10
    Item 9
    -1
    Location 2
    11
    Item 10
    1
    Location 3
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    Re: Formula (array?) to list unique entries that match criteria?

    Brilliant, thank you!!!!

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula (array?) to list unique entries that match criteria?

    Thank you for the feedback!

  5. #5
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    Re: Formula (array?) to list unique entries that match criteria?

    Can I trouble you for one more formula?

    Let's say I wanted column "E" to list all of the unique items, where the location matched cell "D2"?

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula (array?) to list unique entries that match criteria?

    just change D$1:$D1 to E$1:E1

  7. #7
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    Re: Formula (array?) to list unique entries that match criteria?

    I don't think I explained it very well...

    I'd like to have column "E" return the unique item(s) from column "A", where column "C" matches the value in cell "D2" (or "D3", "D4", etc)


    Does that make more sense?

    Thanks!

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula (array?) to list unique entries that match criteria?

    Array entered

    =IFERROR(INDEX(A$2:A$11,MATCH(0,IF(B$2:B$11>0,"",COUNTIF(E$1:$E1,A$2:A$11)),)),"")

  9. #9
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    Re: Formula (array?) to list unique entries that match criteria?

    Quote Originally Posted by AlKey View Post
    Array entered

    =IFERROR(INDEX(A$2:A$11,MATCH(0,IF(B$2:B$11>0,"",COUNTIF(E$1:$E1,A$2:A$11)),)),"")
    That seems to list all of the items in column "A", that have a negative value in column "B"...

    Can we have it match cell $D$2 with column "C", AND has a negative value in column "B"?
    Last edited by Rerock; 11-11-2014 at 03:21 PM.

  10. #10
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula (array?) to list unique entries that match criteria?

    It lists only those that meat criteria for the locations listed in column D.

    The result is

    Item 1
    Item 3
    Item 5
    Item 7
    Item 9

    Location 1

    Item 1

    Location 2

    Item 9

    Location 3

    Item 3
    Item 5
    Item 7
    Last edited by AlKey; 11-11-2014 at 03:31 PM.

  11. #11
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    Re: Formula (array?) to list unique entries that match criteria?

    Row\Col
    A
    B
    C
    D
    E
    F
    1
    ITEM QTY LOCATION LOC_RESULTS LOC_TO_MATCH ITEMS_MATCH
    2
    Item 1
    -1
    Location 1 Location 1 Location 3 Item 3
    3
    Item 2
    1
    Location 2 Location 3 Item 5
    4
    Item 3
    -1
    Location 3 Location 2 Item 7
    5
    Item 4
    1
    Location 3
    6
    Item 5
    -1
    Location 3
    7
    Item 6
    1
    Location 3
    8
    Item 7
    -1
    Location 3
    9
    Item 8
    1
    Location 4
    10
    Item 9
    -1
    Location 2
    11
    Item 10
    1
    Location 3


    Okay,
    I'm using this as a form generator, and the table above is close to how I will be using the data. I NEED the array formula in column F to list unique items from column "A" that meet two criteria:
    1) if the value in column "C" matches cell $E$2
    2) if the value in column "B" is a negative value.

    This is the final hurdle, then the rest of this form generator is smooth sailing.

    Thanks for all of you help so far, I really appreciate it!
    Last edited by Rerock; 11-11-2014 at 04:10 PM.

  12. #12
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula (array?) to list unique entries that match criteria?

    Not quite sure what you need at this point. If you want to extract items for locations listed in D to columns to the right you can do this with this array formula:

    in E2 and copy to the right and then down.

    =IFERROR(INDEX($A$2:$A$11,SMALL(IF(($C$2:$C$11=$D2)*($B$2:$B$11<0),ROW($C$2:$C$11)-ROW($E$2)+1),COLUMNS($E2:E2))),"")

    ...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 your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    1
    ITEM QTY LOCATION Locations Items
    2
    Item 1
    -1
    Location 1 Location 1 Item 1
    3
    Item 2
    1
    Location 2 Location 3 Item 3 Item 5 Item 7
    4
    Item 3
    -1
    Location 3 Location 2 Item 9
    5
    Item 4
    1
    Location 3
    6
    Item 5
    -1
    Location 3
    7
    Item 6
    1
    Location 3
    8
    Item 7
    -1
    Location 3
    9
    Item 8
    1
    Location 4
    10
    Item 9
    -1
    Location 2
    11
    Item 10
    1
    Location 3

  13. #13
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    Re: Formula (array?) to list unique entries that match criteria?

    Your table is certainly one solution, and I'll look in to that method if what I'm thinking of doesn't/ can't work.

    In my example table in post #11, I would ideally like the items in column "F" to change as you change the value in cell $E$2...

    Say that in post #11, cell $E$2 is a dropdown list populated from range $D$2:$D$11. As the user selects one of the items in the dropdown list, the corresponding items in column "F" are populated based on the value in cell in $E$2 (and also have a negative value in column "C").

    Does that make sense?

+ 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] Looking to create a list of unique names that match criteria without using an array
    By john dalton in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 03-28-2014, 04:28 AM
  2. [SOLVED] Create a list of unique entries that did not meet a specific criteria
    By joannelittell in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-23-2013, 12:08 PM
  3. Replies: 2
    Last Post: 02-22-2013, 07:16 AM
  4. Unique list Array Formula dependent of two criteria
    By ron2k_1 in forum Excel General
    Replies: 3
    Last Post: 09-01-2011, 10:50 PM
  5. Non-array formula listing of unique entries in a DB field
    By quatrecouleurs in forum Tips and Tutorials
    Replies: 0
    Last Post: 05-11-2010, 09:45 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