How to separate data in one column into two colums based on data in other column in Excel

Brian Lambert 1 Reputation point
2022-01-20T21:12:13.34+00:00

Hello!

I need to separate number the numbers in one column (Column A) based on the identifiers in another column (Column B). In the attached example, I need all of the identifiers in Column B to be separated out and placed into new columns. For example, Type A numbers need to be in one column and all of the Type B numbers in another column.

How would I go about doing this?

Thank you for any help that you can provide!

166933-screen-shot-2022-01-20-at-40610-pm.png

166914-image.png

Microsoft 365 and Office | Development | Other
Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Herbert Seidenberg 1,201 Reputation points
    2022-01-21T01:52:00.387+00:00
    0 comments No comments

  2. Emily Hua-MSFT 27,876 Reputation points
    2022-01-21T06:34:14.733+00:00

    Hi @Brian Lambert ,

    You could try the Index and Match function.

    Enter the formula =IFERROR(INDEX($A$1:$A$6,SMALL(IF($B$1:$B$6=D$1,ROW($1:$6),4^8),ROW(1:1)))&"","") in Cell D2 on my sample.
    As this formula is an array formula, I need to press Ctrl + Shift + Enter.
    167017-capture6.png
    Then drag down and right.


    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.



  3. Ashish Mathur 100.8K Reputation points Volunteer Moderator
    2025-07-26T00:03:47.46+00:00

    Hi,

    In cell D1, enter this formula

    =DROP(PIVOTBY(BYROW(B2:B6,LAMBDA(a,COUNTIF(B2:a,a))),B2:B6,A2:A6,SINGLE,0,0,,0),,1)

    Hope this helps.

    User's image

    0 comments No comments

  4. Ashish Mathur 100.8K Reputation points Volunteer Moderator
    2025-07-26T02:57:46.03+00:00

    Hi,

    This M code in Power Query works as well

    let
        Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
        #"Grouped Rows" = Table.Group(Source, {"Text"}, {{"Count", each _[Number], type table [Number=number, Text=text]}}),
        Custom1 = Table.FromColumns(#"Grouped Rows"[Count],#"Grouped Rows"[Text])
    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.