How to make a column that only shows data if the cell value is contained in the referenced column?

KING, Dylan 0 Reputation points
2023-03-07T17:12:20.9666667+00:00

Hello, I am looking to use Power Query to do the following:

I have two columns I'm comparing: Column A and Column B

I want it to be so that IF the cell value for a given row in Column A is contained anywhere within Column B, then display the row. ELSE, do not display the row. How would I do this. If it is not possible using Power query, then is there an alternate solution in Excel?

Microsoft 365 and Office | Install, redeem, activate | For business | Windows
Microsoft 365 and Office | Excel | For business | Windows
{count} votes

3 answers

Sort by: Most helpful
  1. Herbert Seidenberg 1,201 Reputation points
    2023-03-12T23:32:21.72+00:00
    1 person found this answer helpful.
    0 comments No comments

  2. Emily Hua-MSFT 27,866 Reputation points
    2023-03-08T10:08:01.9866667+00:00

    Hi @KING, Dylan

    Welcome to Q&A forum~

    As Power Query is not supported on Q&A at current time, it's best post a new thread on Microsoft Power BI community.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    For an alternate solution in Excel, I would suggest you try formulas.

    I will make a simple sample as following image.

    Then please add a helper column to find out cells of A column contained witin B column.

    =IFNA(VLOOKUP(A2,B$2:B$7,1,),"")

    Capture20

    Then please enter INDEX($A$1:$B$7,SMALL(IF($D$1:$D$7<>"",ROW(D$1:D$7)),ROW(A1:A1)),COLUMN(A$1)) formula, drag it right and down until you find the "#NUM!", this action can get the rows that meet your requirement.

    Capture21


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    0 comments No comments

  3. Ashish Mathur 100.8K Reputation points Volunteer Moderator
    2025-07-27T23:45:38.8233333+00:00

    Hi,

    This M code in Power Query works

    let
        Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
        Custom1 = Table.FromList(List.Select(Source[Name],each List.ContainsAny(Source[Name1],{_})))
    in
        Custom1
    

    User's image

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.