XIRR with filtered ranges?

I have a table of stock symbols, dates and values for a series of transactions:

AAA	01/01/15	$100.00
BBB	02/01/15	$200.00
AAA	03/13/15	$317.00
CCC	03/13/15	$152.00
BBB	04/01/15	$140.00
AAA	03/21/19	-$500.00
BBB	03/21/19	-$300.00
CCC	03/21/19	-$200.00

How can I calculate XIRR separately for each stock symbol?

Using the function in array mode with conditions.
image description

To introduce the formula as array use [Ctrl+shift+enter] instead [enter]

Thanks! The only tweak I needed to make was for the second IF clause. I changed the ELSE part from “” to “today()”:

IF(A1:A9-$E$1;C1:C9;today())

Without that tweak XIRR returns strange (incorrect) results when IF returns an array that begins with an old or blank date.