google-finance

Google Finance fetch DATE of high and low


I am trying to fetch the dates of the high/low of the last 11 days using the following formula =TO_DATE(INDEX(SORT(GOOGLEFINANCE("nse:BAJFINANCE", "high", today()-11,today(),"DAILY"), 2, 0), 2,1))

=(TO_DATE(INDEX(SORT(GOOGLEFINANCE("nse:BAJFINANCE", "low", TODAY()-11,TODAY(),"DAILY"), 2, 0), 2,1))) What is fetches is 8/13/2022 for both while the correct date is 09/14/2022 for High and 9/7/2022 for low.

Where exactly am i going wrong?


Solution

  • (TO_DATE(INDEX(SORT(GOOGLEFINANCE("NSE:BAJFINANCE", "low", TODAY()-11,TODAY(),"DAILY"), 2, 1), **1,2**))=0
    

    In the above part, the code is indexing and sorting out the values of daily low. It has been seen that in few cases after sorting out, the low value comes out to be ZERO in the first row and second column. Therefore, low date of Second row and first column will be the correct date as taken in the second part of the code

    TO_DATE(INDEX(SORT(GOOGLEFINANCE("NSE:BAJFINANCE", "low", TODAY()-11,TODAY(),"DAILY"), 2, 1), **2,1**))
    

    If the first part of the code returns false value then the correct date will be in the first row and first column

    TO_DATE(INDEX(SORT(GOOGLEFINANCE("NSE:BAJFINANCE", "low", TODAY()-11,TODAY(),"DAILY"), 2, 1), **1,1**)
    

    Hope this will clarify the doubt.