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
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.