Calculation steps are as follows:
1, in cell E2 enter the following formula, and then fill down the formula
=IF (C2>=D2, (C2-D2)*B2, "")
The formula says: If the stock price is greater than or equal to the cost price, then the profit amount for the result of the C2-D2 multiplied by the number of shares; if the stock price is less than the cost price , then return to null;
2, in cell F2 enter the following formula, and then fill down the formula
=IF (C2>=D2,"", (D2-C2)*B2)
The formula says: if the share price is greater than or equal to the cost price, then the loss amount of null; if the share price is less than the cost price, then return to the result of the cost price minus the price of the shares multiplied by the number of shares.