Excel formula for figuring Profit and loss

SALO

Board Regular
Joined
Jul 27, 2008
Messages
66
If in column (A) I have a "B" for buy and a "SS" for sell short. Then in column (B) I have the fill price of a certain stock such as "$98.5" for example. Then in Colomn (C) I have the Closing price for this particular stock such as "$99.5."(since I will hold to the end of the day). In Column (D) I want to have the profit or loss. The problem is that the formula needs to be different depending if the opening transaction is Buy "B" or a "SS" Sell Short. So in other words I need a formula that says if in column (A) there is a "B", then take the closing price column (C) and minus the Fill price in column (B) to give the Profit or loss in Column (D). But at the same time or in the same formula cell if in column (A) there is "SS" then it needs to be reverse and take the fill price Column (B) and minus the Closing Price Column (C) to put the Profit or loss in Column D. Is there a formula I can put in the cells in column D that can do this? Any help is much apreciated.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Welcome to the Board!

Maybe something like this:

=IF(A2="","",IF(A2="B",C2-B2,IF(A2="SS",B2-C2)))

Hope that helps,
 
Upvote 0

Forum statistics

Threads
1,214,959
Messages
6,122,476
Members
449,087
Latest member
RExcelSearch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top