+ Reply to Thread
Results 1 to 14 of 14

How to pull through a list while not including rows with no matches

  1. #1
    Registered User
    Join Date
    11-04-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    6

    How to pull through a list while not including rows with no matches

    Good day,

    I am trying to pull through a list of birds per location (sheet 2) from a mixed list (sheet 1). I have used a VLOOKUP plus a IF/OR but I am obviously getting unmatched results where that bird is not found in that location. Is there a way to pull the matches through for each location column but have no rows in between where the values do not match? The location list must also look for a match in all 3 location columns in sheet 1. My first post on a forum of any sort so my apologies if I have done something wrong.
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: How to pull through a list while not including rows with no matches

    Please confirm which is sheet 1 and which is sheet 2. Are you trying to populate the Sites List from the information on the species list?
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    11-04-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    6

    Re: How to pull through a list while not including rows with no matches

    Hi dflak, thanks for the response. Apologies, yes sheet 1 is Species List and sheet 2 is Site list and yes, I am trying to populate the site lists from the species list :-)

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,372

    Re: How to pull through a list while not including rows with no matches

    Try in E2

    =IF(OR('Species list'!$C2=E$1,'Species list'!$D2=E$1,'Species list'!$E2=E$1), A2, "No")

    Drag across and down column

    Removed intermediate columns and added locations in alphabetical order "Site List"
    Attached Files Attached Files
    Last edited by JohnTopley; 11-04-2016 at 04:28 PM.

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: How to pull through a list while not including rows with no matches

    Here's a VB implementation with a slight twist.

    First I converted the Species List and Location Validation tables to tables. The main reason is because tables know how big they are, and they also copy down formulas, formats and validations automatically. So you can add and delete data and you don't have to change formulas.

    I overlaid a named dynamic range on the locations table and used it for the data validation for all the locations in the species list. The dynamic range means you can add locations and the validation will expand to cover them.

    Next I made a pivot table against each of these tables in the Working sheet. These ranges are alphabetized (that's what pivot tables do), and I copy and paste them to the Location Sheet as row and column headings.

    From there, I go down the list of species I get the bird name and the location and find it on the grid on the locations page. If there is a location, then it plots a "Y".

    There's a button on the working page that runs the macro.

    I noticed that you had additional columns on your grid that were hidden. I don't know what purpose these serve. If we have to work them back in, let me know.
    Attached Files Attached Files
    Last edited by dflak; 11-04-2016 at 04:56 PM. Reason: Add attachment

  6. #6
    Registered User
    Join Date
    11-04-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    6

    Re: How to pull through a list while not including rows with no matches

    Hi John and dflak. Thank you for your time. This is not quite what I want though. The attached has a sheet called "Example of desired result". You will see that there is a column for each location but only species found in that location (whether as a primary, secondary or tertiary location) pull through. This means someone doesnt have to scan through a lot of spaces of "No" to see which species are found in that location (do not want to have to use filters manually on each column to determine this). Also, if these lists can be updated automatically whether a species is inserted between others or at the bottom of the list on the Species list sheet (think this will require a dynamic range?).
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,372

    Re: How to pull through a list while not including rows with no matches

    VBA code:

    Worksheet event code

    To add this code: click tab "Sites List", "View code", copy and paste

    Please Login or Register  to view this content.
    To add this code: Alt+F11, "Insert" == >"Module" == > copy and paste

    Please Login or Register  to view this content.
    Added named range "Location" which is your list of (sorted) sites

    Data Validation changed to list / =Location

    Selecting from DV will initiate code.
    Attached Files Attached Files

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,260

    Re: How to pull through a list while not including rows with no matches

    ..or if you do want a formula solution, try this. Two array formulae. One in A2, copied down:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    and another in B2, copied across and down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,260

    Re: How to pull through a list while not including rows with no matches

    Oops. I forgot to add:

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...

  10. #10
    Registered User
    Join Date
    11-04-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    6

    Re: How to pull through a list while not including rows with no matches

    Thank you John! Working a dream! I just made the data validation list a table so that it would auto update and include any additional locations added between or at the end of the locations currently on the list. Thanks for everyone's help

  11. #11
    Registered User
    Join Date
    11-04-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    6

    Re: How to pull through a list while not including rows with no matches

    Thanks Glenn. John, is there a way to have the columns in the site list sheet automatically receive the data as you put a new site into the validation list. So lets say there are 4 locations, 1, 2, 3 and 4. That this would automatically be allocated to columns A, B, C and D in the site list. Then, if I add a 5th location, that would automatically be allocated to column E in the site list? (i.e. not having to select a site from a validation in the first row on the site list?) - I know that this has implications on the code, as the location selection is the command for running the code :-(

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,372

    Re: How to pull through a list while not including rows with no matches

    Please Login or Register  to view this content.
    Add tab "Dashboard" and moved "Location" list to this tab: named range "Location" is dynamic so range automatically changes if locations are added/deleted.

    Recommend you insert in sorted order as we naturally like lists in a known sequence!

    Output on tab "Sites Lists"

    Click "RUN" to execute macro

    Oriiginal code with drp-down still available.
    Attached Files Attached Files
    Last edited by JohnTopley; 11-06-2016 at 09:58 AM.

  13. #13
    Registered User
    Join Date
    11-04-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    6

    Re: How to pull through a list while not including rows with no matches

    Thank you! Apologies for constantly shifting the goal posts!

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,372

    Re: How to pull through a list while not including rows with no matches

    Thanks for the rep.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Pull data from one sheet to another if a company name matches
    By toddbn in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-30-2015, 06:08 PM
  2. [SOLVED] Summing the matches of one column only if its corresponding description matches a list
    By bishop-jese-erl in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-19-2015, 04:26 PM
  3. Pull list of names if a value matches in row
    By GigaFluxx in forum Excel General
    Replies: 5
    Last Post: 11-19-2014, 03:58 PM
  4. Macro to search rows for matches from a list of strings, then copy to a new worksheet
    By Conundrum4000 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-23-2014, 08:31 AM
  5. Replies: 0
    Last Post: 06-06-2013, 02:03 AM
  6. Replies: 2
    Last Post: 07-22-2010, 02:57 PM
  7. How to pull cells from other worksheets including color/comments?
    By wendy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-17-2006, 02:25 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