EXCEL: Copy cells from column A -> C ONLY IF column B = X, but only using 1 column

前端 未结 1 887
醉酒成梦
醉酒成梦 2021-01-17 06:09

I have 2 columns of data:

COL_A  COL_B
AAAA   PM
BBBB   PM
CCCC   P
DDDD   M
EEEE   PM

I want to create a 3rd column by filtering Column A

相关标签:
1条回答
  • 2021-01-17 06:50

    In C1 enter the array formula:

    =IFERROR(INDEX($A$1:$B$20,SMALL(IF($B$1:$B$20="PM",ROW($B$1:$B$20)),ROW(1:1)),1),"")
    

    and copy down:

    Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key.

    You can increase the range in the formula to match your table size.

    EDIT#1:

    The INDEX() function pulls data from a column based on row. THE SMALL() function creates an array of rows matching the desired criteria.

    0 讨论(0)
提交回复
热议问题