Returning last value in cell based on value of another cell

VBAhelp33

New Member
Joined
Sep 13, 2020
Messages
11
Office Version
  1. 2019
Platform
  1. Windows
Hi all,

I am trying to create a formula that will return the values that are highlighted in red in the below screenshot but am not having much luck. Basically, I would like to return the previous transaction value for that particular stock. If there has been no previous transactions for that stock, I'd like the cell to be blank & if I have purchased the stock in the past, I'd like the cell to return the last transaction value for that particular stock.

Does anyone have any ideas how I can do this?

1611656894017.png
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Try this in cell G2:

=IFERROR(LOOKUP(2,1/($B$1:B1="buy")/($C$1:C1=C2),$F$1:F1),"")
 
Upvote 0

Forum statistics

Threads
1,214,885
Messages
6,122,085
Members
449,064
Latest member
MattDRT

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