# Help, very basic user here. Trying to match data to most recent match of data in 2 columns and then perform multiple calculations. Thanks for any hel

#### Rick R

##### New Member
First time I have been in a forum and not very experienced with excel, sorry in advance of any errors I make.

Goggle has got me this far but I am stuck. I am trying to create a stock trading journal that has some calculations in it. I am sure it's no work of art but again, not even basic user here.

I would Like to have excel scan the same column, backwards in time for the first exact match of a stock symbol (Whatever symbol I last entered) and confirm its a match by a date in a second column, same row. If its a match then perform a calculation in another column.

See link for picture of my spreadsheet, I removed many of the non important columns.

Currently I am using =IF(D6="Stock",H6/J6,G6*J6/E6) (in the stocks current cost basis columns (K) to give me the cost basis if its a purchase designated by the word stock, otherwise give me the per share cost or profit earned by the trade.
There can be multiple columns based on there being more then one lot of stocks currently open.

What I would really like to have happen is to have it do what it's doing now only to match up the trades and keep a running total of the cost basis increasing or decreasing in column (K) depending on the lot... look back to the date each stock was purchased and then match up the trades based on the stock symbol and purchase date... then reduce the last cost basis by the net premium per share (Column G) and put that total in the (Stocks Current Cost Basis Lot(K) or the column next to it (L) if another column is needed to do the calculation... row by row/ trade by trade.

Can this be done? How?

Please ask me any question if I was not exact or clear.

Thanks,

Rick

### Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Replies
11
Views
313
Replies
6
Views
698
Replies
2
Views
6K
Replies
4
Views
392
Replies
5
Views
429

1,196,322
Messages
6,014,638
Members
441,833
Latest member
Rangerreeve

### 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.

### Which adblocker are you using?

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

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