I'm working on a tracking spreadsheet for stock trading and want to create a "current profit/loss" cell that needs to search for the most recent "type" of trade and return a corresponding value.
Ex: Below is a scenario that shows (6) different trades and I want to select the most recent "Sold CSP" trade (in this case, 11/10/24) and return the value of $5.00. Example Scenario
I have tried VLOOKUP, though this either always selects the first/top "Sold CSP" value of $19.50 if I make the final argument "FALSE", and if the final argument is "TRUE", it returns the bottom row with "Sold CC" and the value of $10.00.
Assuming your data setup has the dates by default sorted ascending(as in screenshot), you can utilize xlookup search_mode parameter -1
(-1 is to search from the last entry to the first)
=xlookup(F4,A:A,D:D,,,-1)