The formula:
=MAX(INDEX(GOOGLEFINANCE(C7, "high", A7, B7), , 2))
…will return the stock's high price between the dates A7 and B7 in your example.1
How does it work?
Using the formula:
=GOOGLEFINANCE(<symbol>, "high", <StartDate>, <EndDate>)
or
=GOOGLEFINANCE(C7, "high", A7, B7)
(in your example),
…will return an array which looks something like this:
Using the INDEX()
function, you can convert that array to a single column of the high values:
=INDEX(GOOGLEFINANCE(C7, "high", A7, B7), , 2)
Now you can pass that array into the MAX()
function to get the highest value in a single cell:
=MAX(INDEX(GOOGLEFINANCE(C7, "high", A7, B7), , 2))
1 Important Note:
If you include a date range in GOOGLEFINANCE's "high" function, it will not include today's price during the current trading day — so if you need to include today's high price in your range, you will need to compare today's high price to the historical data explicitly.
E.g., the function =GOOGLEFINANCE(symbol, "high")
gives you today's high price, so:
=MAX(GOOGLEFINANCE(C7, "high"), MAX(INDEX(GOOGLEFINANCE(C7, "high", TODAY()-30, TODAY()), , 2)))
…will give you the high price over the last 30 days, including today.
If there's a possibility that your date range might include today only (i.e. no historical data where A7 and B7 both equal today), unfortunately, the formula above will return #NA. I have the ultimate solution to generate the correct array even if it does not contain historical data.
The Bullet-Proof Solution
The formula below traps the #NA condition and builds the array to include today's high no matter what date range is specified:
=MAX(INDEX({IFNA(GOOGLEFINANCE(E7, "high", A7, TODAY()), {"Date", "High"}); NOW(), GOOGLEFINANCE(E7, "high")}, , 2))
I've been bitten by this quirk a few times and this solution seems to be cover all scenarios. Enjoy!