+ Reply to Thread
Results 1 to 14 of 14

Filter two columns by one value

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Filter two columns by one value

    I have lists of contracts; they come in two flavors, "Regular" and "Special". Each has backup data residing in different areas. Each is in it's own column. I am frequently given a contract number, no telling which column it's in, so I have to filter one column first and, if that's the wrong one, filter the second column. Is there a way to have one filter which will filter both columns?

    BTW, putting the contract numbers in one column, with a "Regular" and "Special" lable to one side, isn't really workable, because for each contract I have about 50 data fields, and there are thousands of these contracts. To put them in one column would double the information in my workbook, which is pretty large as it is.
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Filter two columns by one value

    Are the contract numbers numbers?

    Do they have a consistent number of digits and no leading zeros?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Filter two columns by one value

    No.
    No.

    Some have leading zeros. Some have mixes of text and numbers. Some have dashes, some have underscores. Label length is between 15 and 100 characters. It's a hodgepodge of formats all considered "Contract Numbers".

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Filter two columns by one value

    Not knowing what the layout is, why not just do a Find All for the given string?

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Filter two columns by one value

    Since some contracts might hit various regions, I would need to pull up all the lines that that contract falls in. Doing a Find All I could find all those lines, but how would I go about filtering to just those lines, so I can see all the related data on each line?

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Filter two columns by one value

    Again, I don't know the data layout, but once you find them all, you could apply filters (via the UI or code) in each column where they appear.

    I confess, I can't really envision what you're trying to do, or why the data is scattered hither, thither, and yon.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Filter two columns by one value

    I do have a short piece of code that applies autofilter to filter the column for the currently selected value:

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Filter two columns by one value

    Never have been able to figure out where "Yon" is.

    I've attached a small example. If you'll filter for any contract in column f, you'll find multiple lines for that contract. For the most part, the vendor is the same (but not in all) but the Strategy, PAC (Program Code) and DeptID might differ. There are tons more criteria fields I haven't added to this example. Since my job is to trace funding streams (I'm in Budget) for any contract I need to trace where the expense should hit for a specific criteria. Easiest way is to filter for that contract number, so I can see the whole picture. Since the pertinent contract may be in either Column E and Column F (or both) I want to, if possible, filter both columns at the same time.
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Filter two columns by one value

    sorry, missed your last post as I was typing mine. I also have a quickfilter macro, but the problem is that I want to filter the second column by the same filter criteria I filtered the first one by, and get the full results of both columns.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Filter two columns by one value

    You could add a column that catenates cols E & F and filter on that:

    E
    F
    G
    H
    2
    Special Regular HDR_VENDOR_NAME Filter Here
    633
    24308647 ROWNSHELLY B ::24308647:
    634
    24308647 ROWNSHELLY B ::24308647:
    635
    E529-15-0004-00015 E529-15-0004-00015 MATTINCSHERRYHEWS :E529-15-0004-00015:E529-15-0004-00015:
    636
    E529-15-0004-00015 MATTINCSHERRYHEWS :E529-15-0004-00015::
    637
    E529-15-0004-00015 530-15-7777-00098 MATTINCSHERRYHEWS :E529-15-0004-00015:530-15-7777-00098:
    638
    E529-15-0004-00015 E529-15-0004-00015 MATTINCSHERRYHEWS :E529-15-0004-00015:E529-15-0004-00015:
    639
    E529-15-0004-00015 MATTINCSHERRYHEWS :E529-15-0004-00015::
    641
    E529-15-0004-00015 MATTINCSHERRYHEWS :E529-15-0004-00015::
    643
    53000-7-Z160100433 INCSHI GOVERNMENT SOLUTIONS :53000-7-Z160100433::
    Last edited by shg; 07-14-2017 at 12:00 PM.

  11. #11
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Filter two columns by one value

    You mean the columns I want to filter on? in the example, it's F and G. BOTH contain contract numbers.

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Filter two columns by one value

    Looks like E F, no?

    Filter col H for CONTAINS :ContractNum:

  13. #13
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Filter two columns by one value

    Why is it the straight-forward easy answers are the hard ones for me? Simple, elegant, easy solution. Thank you so much!

  14. #14
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Filter two columns by one value

    You're welcome.

+ 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] Cant filter 2 columns even with advance filter
    By pingpong1 in forum Excel General
    Replies: 19
    Last Post: 07-03-2015, 04:40 PM
  2. One filter on more columns
    By gianluketto in forum Excel General
    Replies: 1
    Last Post: 06-15-2015, 02:59 PM
  3. Replies: 5
    Last Post: 11-24-2014, 11:58 AM
  4. Replies: 6
    Last Post: 10-16-2014, 08:42 AM
  5. Using filter to highlight/filter duplicates in multiple columns but within 1 day
    By DaveBre in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2014, 04:07 AM
  6. [SOLVED] How to Filter Many Columns with One Dropdown Filter?
    By garrett.grillo in forum Excel General
    Replies: 6
    Last Post: 03-20-2014, 01:27 AM
  7. Sheet1 is possible with 10 columns and filter columns 3 and paste in Sheet2?
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 03-17-2012, 05:08 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