+ Reply to Thread
Results 1 to 16 of 16

Filter data from a sheet using a list as criteria

  1. #1
    Registered User
    Join Date
    09-12-2008
    Location
    Riversul
    MS-Off Ver
    2016
    Posts
    83

    Filter data from a sheet using a list as criteria

    Hello, I wonder if this situation could be solved without VBA, but who knows? So here's the problem:

    There's "Sheet1", which has several names of different companies in column A. Then, there're other two different columns in there (B and C); one where you write people's names, the other one the e-mail addresses. Most of companies have different people working there, so it's not uncommon to find more than 1 row for every company name.

    Ok, so there's also "Sheet2". This one has a single column (A), containing a certain name of companies, I mean, not all of those that you can find in "Sheet1". But the idea here, it'd be to import all the data from "Sheet1" (like filtering A,B,C from "Sheet1"), using only the names of these particular companies that are present in column A in "Sheet2", as criteria. I mean, is it even possible to automate this process like this?

    It's perfectly possible doing it manually, but considering the volume of data, optimizing would definitely help a lot. If anyone has a suggestion, I'd be really thankful. Nonetheless, thank you for taking your time to come here!

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter data from a sheet using a list as criteria

    Hi Zenart,

    If my understadning is correct, you can easly do this manually by 2 steps. Copy column 1 from sheet1 & paste is in column 1 in sheet2 then remove duplicates .. and this could be obtained from a macro recorder like below

    Let me know if this does what you need

    Please Login or Register  to view this content.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  3. #3
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Filter data from a sheet using a list as criteria

    Suppose in sheet 1 :
    COMPANY --- NAME --------- EMAIL
    AAA ----------- John --------- John@
    BBB ----------- Bill ----------- Bill@
    BBB ----------- Lia ----------- Lia@
    CCC ----------- Char --------- Char@

    In sheet 2 (first conditon)
    COMPANY
    BBB

    The wanted result in sheet 2
    COMPANY --- NAME -------- EMAIL
    BBB ----------- Bill ----------- Bill@
    BBB ----------- Lia ----------- Lia@

    Maybe something like that ?
    Last edited by karmapala; 06-05-2020 at 02:22 PM.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Filter data from a sheet using a list as criteria

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter data from a sheet using a list as criteria

    Maybe, we need to get his feedback

  6. #6
    Registered User
    Join Date
    09-12-2008
    Location
    Riversul
    MS-Off Ver
    2016
    Posts
    83

    Re: Filter data from a sheet using a list as criteria

    Hello nankw83, thank you for your reply!

    What I need to do in this case, is like karmapala mentioned below. In that case, I need to filter all the data related to the names of these specific companies, like all the workers / contacts in company "AAA", for example

  7. #7
    Registered User
    Join Date
    09-12-2008
    Location
    Riversul
    MS-Off Ver
    2016
    Posts
    83

    Re: Filter data from a sheet using a list as criteria

    Hello, karmapala, thank you for your reply!

    It's kinda like that! I'll follow xladept's advice below and attach the file to provide an idea of what I'm hoping to achieve

  8. #8
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter data from a sheet using a list as criteria

    Ok, if that's the case maybe the below code suffice …

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    09-12-2008
    Location
    Riversul
    MS-Off Ver
    2016
    Posts
    83

    Re: Filter data from a sheet using a list as criteria

    Hello, xladept! Thank you for your reply!

    I've followed your instructions and made a quick sheet to demonstrate what I'm hoping to achieve. Please tell me if it's good enough to illustrate the idea. Thanks!
    Attached Files Attached Files

  10. #10
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter data from a sheet using a list as criteria

    The code in post #8 does what you need … And in your sample you've forgot to add the results of CCC | PAUL | [email protected] in your expected results

    Just delete the first 2 rows in sheet2 & let the header starts in cell A1

  11. #11
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Filter data from a sheet using a list as criteria

    Hi Zenarte,

    Maybe something like this ?

    Please Login or Register  to view this content.
    To test the code, please clear the cells content in Sheet2 from C4 to E12 first.

  12. #12
    Registered User
    Join Date
    09-12-2008
    Location
    Riversul
    MS-Off Ver
    2016
    Posts
    83

    Re: Filter data from a sheet using a list as criteria

    Hello again, yeah, it works fine indeed, thanks for your feedback, nankw83!

  13. #13
    Registered User
    Join Date
    09-12-2008
    Location
    Riversul
    MS-Off Ver
    2016
    Posts
    83

    Re: Filter data from a sheet using a list as criteria

    Wow, it perfectly works! Thank you very much for helping me out with this problem, karmapala!

  14. #14
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Filter data from a sheet using a list as criteria

    You're welcome, Zenarte.
    Glad I can help .

  15. #15
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Filter data from a sheet using a list as criteria

    You're welcome and thanks for the rep!

    Try this:

    Please Login or Register  to view this content.

  16. #16
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter data from a sheet using a list as criteria

    Quote Originally Posted by Zenarte View Post
    it works fine indeed, thanks for your feedback, nankw83!
    You are welcome, glad to help & thanks for the reps

+ 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] Filter and extract list of data based on criteria using INDEX MATCH
    By brake in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-13-2018, 08:30 AM
  2. [SOLVED] Copy specific column data from one sheet to another sheet using Certain filter Criteria
    By xlhelp7 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-02-2017, 12:09 AM
  3. Replies: 1
    Last Post: 12-12-2014, 06:46 AM
  4. Filter for Two Criteria and Unique list copy another sheet
    By rr1050 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-27-2014, 10:36 PM
  5. [SOLVED] Using data as criteria to set a filter on an other sheet
    By Tino XXL in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-04-2013, 09:01 AM
  6. [SOLVED] FILTER DATA IN SHEET A WITH CRITERIA IN SHEET B (macro)
    By ronz77 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 09-17-2012, 12:38 AM
  7. filter data using named list criteria
    By Lizzietish11 in forum Excel General
    Replies: 3
    Last Post: 11-19-2009, 12:49 PM

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