+ Reply to Thread
Results 1 to 5 of 5

Dynamic Column reference in filter command?

  1. #1
    Forum Contributor
    Join Date
    07-19-2019
    Location
    Illinois, USA
    MS-Off Ver
    365
    Posts
    164

    Dynamic Column reference in filter command?

    I am using the "Filter" formula and would like to make the "reference" to a particular column in a table be dynamic, so that I don't have to have different formulas on different tabs - I can just make the fomrula reference a cell on each individual tab to get the name of the column needed.

    The code I am using is as follows:

    Please Login or Register  to view this content.
    In this case, I would like "Weight" to be interchangeable with other options that can be decided on different sheets, so instead of referencing TABLE1[WEIGHT] it would reference TABLE1[A3] where A3 is not a name of a column in Table 1, but rather the value of cell A3 on the worksheet.

    I've tried a few variations of the following, but am either messing it up - or completely off base... Im' not sure which ><

    Please Login or Register  to view this content.

  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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,427

    Re: Dynamic Column reference in filter command?

    Gut instinct: INDIRECT function,

    e.g. INDIRECT("Table1["&$A3&"]"

    However ...

    There are instructions at the top of the page explaining how to attach your sample workbook.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, relevant cells highlighted and a few explanatory notes.

    The code I am using ...
    ... is a formula, not code. Semantics, I know, but code is what is created in VBA or PowerQuery.
    Last edited by AliGW; 12-31-2021 at 06:41 AM.
    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 Contributor
    Join Date
    07-19-2019
    Location
    Illinois, USA
    MS-Off Ver
    365
    Posts
    164

    Re: Dynamic Column reference in filter command?

    I've attached an example that outlines what I am trying to do w/ the "FILTER" formula.

    Thank you!
    Attached Files Attached Files

  4. #4
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,493

    Re: Dynamic Column reference in filter command?

    worksheet name : formula

    Cell E4 formula

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

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: Dynamic Column reference in filter command?

    Please try

    =FILTER(data!A2:A8,(data!C2:C8=B2)*(FILTER(Table1,data!A1:L1=B3)="Y"))
    Attached Files Attached Files

+ 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. Dynamic reference of table column in VBA
    By shashankgupta22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-26-2021, 07:10 AM
  2. [SOLVED] can I reference a dynamic range from another column?
    By juntjoo in forum Excel General
    Replies: 31
    Last Post: 10-08-2019, 01:46 PM
  3. VBA filter on dynamic column if text contains..
    By Bundi999 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2018, 07:50 AM
  4. SUMIF across workbooks with dynamic column reference
    By stabbolt in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-23-2014, 06:16 PM
  5. a Dynamic Vlookup (Column Reference)
    By SunOffice in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-27-2013, 04:27 PM
  6. Dynamic range column reference
    By tuna666 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-17-2013, 04:42 AM
  7. Dynamic Column with Find Command
    By neghsmoke in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-26-2012, 02:19 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