+ Reply to Thread
Results 1 to 3 of 3

Take next line if condition fulfilled

  1. #1
    Forum Contributor
    Join Date
    05-19-2009
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2019
    Posts
    212

    Take next line if condition fulfilled

    I have a list of repeating numbers and beside the numbers different types of fruits. so for example
    Please Login or Register  to view this content.
    Question is how to make a form that when I choose the key 14001 it gives me a list of
    Please Login or Register  to view this content.
    but when I choose the key 14002 it gives me the list
    Please Login or Register  to view this content.
    etc.
    Last edited by pansovic; 12-09-2014 at 01:36 AM.

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

    Re: Take next line if condition fulfilled

    Here's one way...

    Data Range
    A
    B
    C
    D
    E
    1
    Code
    Item
    ------
    Code
    Item
    2
    14001
    apples
    14002
    nuts
    3
    14001
    pears
    bananas
    4
    14001
    oranges
    lemons
    5
    14001
    cherries
    6
    14002
    nuts
    7
    14002
    bananas
    8
    14002
    lemons
    9
    14003
    peaches


    This formula entered in E2:

    =IFERROR(INDEX(B:B,AGGREGATE(15,6,1/(A$2:A$9=D$2)*ROW(A$2:A$9),ROWS(E$2:E2))),"")

    Copy down until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

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

    Re: Take next line if condition fulfilled

    Here's another one that requires the data be sorted or grouped by code (as your sample data).

    This formula entered in E2:

    =IF(ROWS(E$2:E2)>COUNTIF(A:A,D$2),"",INDEX(B:B,MATCH(D$2,A:A,0)+ROWS(E$2:E2)-1))

    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. [SOLVED] How to fill a cell with formula if condition fulfilled
    By ruliansyah in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2013, 05:29 AM
  2. open a file if a condition is fulfilled
    By tim5 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-08-2012, 05:21 AM
  3. Importing worksheets if certain condition is fulfilled
    By missf in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2011, 07:59 AM
  4. Script to delete rows when condition fulfilled
    By Rutger in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-02-2010, 08:11 AM
  5. leave a cell blank-condition is not fulfilled
    By nicolas in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-02-2005, 09:05 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