How to dynamically transpose array of data sorted by date & time and group them horizontally?

marklcrns

New Member
Joined
Aug 30, 2019
Messages
1
Please help me with my excel project. I have a stock trading spreadsheet with a database I export from my trading platform sorted vertically by execution date (regardless of whether Its a buy or a sell). I am trying to think of a way to dynamically transpose my database horizontally, grouped by their corresponding ticker symbol and sorted out from left to right by date (see desired transposed data below).


Spreadsheet structure:
- Each trading cycle has their own single row sorted by execution sequence.
- buying and selling trades should be logged in separate tables.
- can only have up to a total of 3 entries and 3 exits within a single trade
- can both have long (buying stock as an entry trade and selling to close) and shorting (selling stock as entry trade and buying to close).
*short trades should have negative shares, as shown in the image below, for both entries and exits (for later calculations convenience).


Challenges:
- after buying a stock, I might increment or decrement my shares of stock later on after buying and/or selling different stocks, or after buying or selling the stock thereof.
- after selling all my shares from a single stock, I might open a new position and buy the same stock multiple times immediately after or later on after many different trades from different stocks have been executed.
- buying and selling stock(s) may occur within the same day.


Raw data pulled from platform: https://i.imgur.com/6Gt94gm.jpg
6Gt94gm.jpg

*ignore the following header: Order Type, Pos effect and Spread.


Desired dynamically transposed data: https://i.imgur.com/Bs0G5VF.jpg
Bs0G5VF.jpg
This image is has been cut due to resolution. Please view the full image with the link above.

"Filled" header contains the entry prices and "Cover" contains the exit prices. "Shares" are the quantity.

I would deeply appreciate it if anyone would be of any help to my project. Thank you in advance.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

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