RETURNS CALCULATION.dochello,

I am trying to write a code that would calculate the return of a trade based on the first "BUY" order and the first "SELL" or "STOP LOSS" order. The problem I am encountering is that I get many "BUY", "SELL" OR "STOP LOSS" orders, and I want Excel to consider only the first one.
My other problem is to make Excel do another find after it has calculated the first return, starting from the cell just under the last calculated return.

I am attaching an example of my spreadsheet. The formula for return calculation is "price at the moment of sale divided by the price at the moment of purchase minus 1". Thank you for all your help,
Daniela