+ Reply to Thread
Results 1 to 7 of 7

Array Formula — Filtered List— Problem

  1. #1
    Registered User
    Join Date
    09-19-2016
    Location
    Angeles, Pampanga, Philippines
    MS-Off Ver
    2016
    Posts
    4

    Array Formula — Filtered List— Problem

    Hello.

    I need some help with an array formula

    The formula filters out a list from another array.

    I would use 1's as a filter (check the attachment sheet1 for reference) and that usually works fine.
    Like this:

    item A - 1
    item B - 0
    item C - 1
    item D - 1
    item E - 0

    Filtered List:
    item A
    item C
    item D

    But I would have problems when other numbers are there. Like this:
    item A - 1
    item B - 2
    item C - 0
    item D - 0
    item E - 1

    I would like the result to be like this:
    item A
    item B
    item B
    item E

    Is there an array formula that would instead count the instances of the number and then filter out a list from it.
    Thanks

    See attachment for reference on what formula I already have and the result of what I want.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    09-19-2016
    Location
    Angeles, Pampanga, Philippines
    MS-Off Ver
    2016
    Posts
    4

    Re: Array Formula — Filtered List— Problem

    Anyone considering this problem?

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,791

    Re: Array Formula — Filtered List— Problem

    Put zero in E1 and this formula in E2:

    =IF(C2="","",D2+E1)

    Copy the formula down to beyond your list of data in column C. Then you can use this formula in A2:

    =IF(ROWS($1:1)>MAX(E:E),"",INDEX(C:C,MATCH(ROWS($1:1)-1,E:E)+1))

    and copy down until you start to get blanks. No need for array formulae.

    Hope this helps.

    Pete

    Note: you should not bump threads within just a few hours of starting the thread - you first posted at 2:36 am my time.

  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: Array Formula — Filtered List— Problem

    If this was you data...

    Data Range
    C
    D
    2
    item A
    1
    3
    item B
    4
    4
    item C
    1
    5
    item D
    ------
    6
    item E
    1
    7
    item F
    8
    item G
    3
    9
    item H


    Show us what result you expect.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    09-19-2016
    Location
    Angeles, Pampanga, Philippines
    MS-Off Ver
    2016
    Posts
    4

    Re: Array Formula — Filtered List— Problem

    Thanks Pete_UK
    It works well.

    Tomy Valko
    I would expect the list to be:
    item A
    item B
    item B
    item B
    item B
    item C
    item E
    item G
    item G
    item G

  6. #6
    Registered User
    Join Date
    09-19-2016
    Location
    Angeles, Pampanga, Philippines
    MS-Off Ver
    2016
    Posts
    4

    Re: Array Formula — Filtered List— Problem

    Thanks Pete_UK
    It works well.

    Tomy Valko
    I would expect the list to be:
    item A
    item B
    item B
    item B
    item B
    item C
    item E
    item G
    item G
    item G

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

    Re: Array Formula — Filtered List— Problem

    Try this...

    Data Range
    A
    B
    C
    D
    1
    Header
    Header
    Header
    2
    item A
    1
    item A
    3
    item B
    4
    item B
    4
    item C
    1
    item B
    5
    item D
    item B
    6
    item E
    1
    item B
    7
    item F
    item C
    8
    item G
    3
    item E
    9
    item H
    item G
    10
    item G
    11
    ------
    ------
    ------
    item G
    12


    This array formula** entered in D2:

    =IF(ROWS(D$2:D2)>SUM(B:B),"",INDEX(A$2:A$9,MATCH(TRUE,COUNTIF(D$1:D1,A$2:A$9) < SUMIF(A$2:A$9,A$2:A$9,B$2:B$9),0)))

    ** 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 down until you get blanks.

+ 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. VBA Code Problem when Using a Filtered List
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-13-2015, 12:02 PM
  2. Creating filtered array within formula before then calculating percentil
    By bpomeroy in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-05-2014, 09:52 AM
  3. Array formula to create list of filtered results
    By Kris_cs1 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-16-2014, 02:34 AM
  4. [SOLVED] Count number of unique names in a filtered list (non array)
    By IN_FOR_SIN in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 01-31-2014, 04:07 AM
  5. Slightly Different Filtered Validation List Problem
    By alrCompass in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-12-2012, 05:40 AM
  6. Filtered list into an array
    By Macro1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2011, 06:17 AM
  7. Filtered list & maximum no columns problem
    By claytorm in forum Excel General
    Replies: 0
    Last Post: 08-24-2005, 05:52 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