+ Reply to Thread
Results 1 to 7 of 7

Extract rows from a big table based on criteria in the Same column

  1. #1
    Registered User
    Join Date
    08-16-2017
    Location
    london, england
    MS-Off Ver
    2013
    Posts
    4

    Extract rows from a big table based on criteria in the Same column

    Hi,

    I'm trying to set up a formula so that I can extract rows from a big flat file, based on different criteria in the same column. I know you can do this with advanced filtering, but I need it to be formula driven.

    For example, I would like to take the below to be filtered to include rows that contain ABA, ABC and ABD only, and then of those rows, only those that contain Hong Kong and England.

    Code Country Price
    ABA England 1
    ABA Finland 1.36
    ABC England 4.68
    ABC Hong Kong 5.31
    ABD Singapore 1.63
    ABD US 2.48
    ABH Mexico 6.14
    ABH India 5.04

    I can do it based on 1 criteria from each column using an index match array, but cannot do it from multiple criteria in the same column. Please could someone help??

    Thanks!

  2. #2
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Extract rows from a big table based on criteria in the Same column

    Welcome to the forum!

    Will you please attach a sample Excel workbook? Include the array formula that you already have that works with one criterion per column.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    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.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Extract rows from a big table based on criteria in the Same column

    Hi Madzilla and welcome to the forum,

    I'm pretty lazy and it seems to me you are looking for an Auto Filter. If you click anywhere in the data and then on the Data Tab and then the Filter Icon, you will get filter dropdowns on your Code, Country and Price headings column. Now simply click the dropdown in each column and filter away. See the attached showing what I mean.

    Also, if you make your data a "Table" you can insert a Slicer Tool and filter using this newer tool.

    http://blog.contextures.com/archives...in-excel-2010/

    AutoFilter for Madzilla.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    08-16-2017
    Location
    london, england
    MS-Off Ver
    2013
    Posts
    4

    Re: Extract rows from a big table based on criteria in the Same column

    Hi,

    The reason why I don't want to use filters is because I want this to roll forwards time and time again, only having to change the link of the source file, as opposed to going in every time to change it.

    Thanks for the suggestion though! If it's not possible to do, then I will definitely use this.

    Madzilla

  5. #5
    Registered User
    Join Date
    08-16-2017
    Location
    london, england
    MS-Off Ver
    2013
    Posts
    4

    Re: Extract rows from a big table based on criteria in the Same column

    I've attached an example of what I want. My index/match isn't working anymore (I've had to recreate it) but it was something like that.

    Thanks!
    Attached Files Attached Files

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Extract rows from a big table based on criteria in the Same column

    Hey Madzilla,

    I've see a few of the "Formula Guru's" on this site use an Array Formula that does a filter and then packing of the desired data like you want. I think there are about 4 people that can produce those long CSE formulas. I'm an Advanced Filter guy and would write a macro behind the Advanced Filter to press a single button and do all the work.

    When you suggest you have a lot of different files that you want to apply this filter to, this leads me to a newer tool in Excel called Power Query. Using it, you can create a filter and apply it to any file you point to. You can also apply the filter to an entire folder worth of files and append all of them together.

    Your problem reminds me of some data cleanup I did a few years ago. If there were less than 50 then I could do it manually about as fast as I could write code to do it. If over 100, I'd surely create a formula or macro to accomplish the task. In your case if you daily get a file that you need to filter like you suggest above, AND you don't know how many rows the data has, I'd be learning Power Query.

    My concern is that using a CSE formula, you would still need to define the number of rows (and columns?) the data has and modify the formula. If you didn't do this but instead used a Dynamic Named Range of data, you still need to apply the DNR. A lot of this answer depends on how you get the data and how you need to see the data in the end.

    https://www.microsoft.com/en-us/down...3-17638048727f

  7. #7
    Registered User
    Join Date
    08-16-2017
    Location
    london, england
    MS-Off Ver
    2013
    Posts
    4

    Re: Extract rows from a big table based on criteria in the Same column

    Hello!

    Thanks for responding. I was planning on just using the whole column references e.g. A:A to get over the fact that the number of rows may change, as all the data is always in one sheet. Alas, sounds like it'll be quite complicated, so I'll try my hand at a Macro or check out the Power Query tool.

    Cheers again!
    Madzilla

+ 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. Remove rows from a table based upon multiple column criteria
    By thence2 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-20-2017, 12:25 AM
  2. [SOLVED] Extract entire rows from list based on criteria
    By Test123Test in forum Excel General
    Replies: 5
    Last Post: 04-29-2013, 09:28 AM
  3. Replies: 3
    Last Post: 02-14-2013, 10:25 AM
  4. [SOLVED] I want to extract the rows when a column met criteria
    By wantaku11 in forum Excel General
    Replies: 7
    Last Post: 11-19-2012, 09:18 AM
  5. extract rows from sheet based on multiple criteria
    By frederikk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2012, 04:12 AM
  6. Trying to extract rows based of criteria
    By hrrvett in forum Excel General
    Replies: 1
    Last Post: 08-05-2011, 11:58 PM
  7. Extract rows based on criteria
    By gkeith in forum Excel General
    Replies: 7
    Last Post: 07-30-2010, 02:16 PM

Tags for this Thread

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