Apr 10, 2019 11:27 AM
Im running a stock return spreadsheet and have zapier updating the current price on one column. I then calculate the difference that I bought the stock at vs the current price. I want to add another column that watches for the highest return I have had and the percent return. Is there an if statement that can be watching the price difference and only change the cell if its higher than the previous high I’ve had?
Example. I buy a stock for $10 its now at $15. The net profit is $5. My highest return column shows $5. Tomorrow the stock goes to $20, the highest return column now shows $10 because its higher than the $5.
Solved! Go to Solution.
Apr 16, 2019 05:11 PM
For that, you’d create a Lookup in your “Stock Values” table that look at the TICKER Table linked record, and the “Highest Price” field — let’s call this field “Max Value”.
Doing that pulls the “Highest Price” (the MAX(value)
of all the prices) into the “Stock Values” table, so that every Stock Value record knows what the Highest Price of it’s associated Stock type was at any point in time. Since that each record for a given type of stock now knows what it’s highest ever value was, you can tell it to compare its own value to the highest ever in a new formula field, and if it matches (ie, that row recognizes itself to be the highest value for that stock), return the Date for that record (the date for the highest value) — let’s call this one “Max Value Date?”:
IF(
Value = {Max Value},
Date
)
Now only those stocks of a given type that contain the highest value will return their dates into this field - note, it could be more than one…
Back in your TICKER table, we will create a Rollup field, call it “Date of Highest Price” — point it at the “Stock Values” table, and the “Max Value Date” field, and use the MAX(values)
rollup function to ensure you get the most recent of all the dates that this stock hit that highest value.
Apr 17, 2019 11:47 AM
Jeremy, Thank you for all of the help. You answered every single question I had. I am now understanding the table logic as well and how to bring certain data sets over from one another.
Cheers!