Share via

STOCKHISTORY usage

Anonymous
2024-08-19T01:36:53+00:00

I use the following table extensively in my excel workbook:

Jan-2018 Feb-2018 Mar-2018 ... Aug-2024 Sep-2024 Oct-2024
GBP/USD
EUR/USD

The currency pairs are in a dynamic range referenced by A2#. The dates are in a dynamic spill array referenced by B1#

I populate this historic and current data using the stockhistory function.

Wanted to check the following as I find the table takes a long time to fill and shows BUSY quite often.

  1. What is the best way to call stockhistory. I have tried: stockhistory(b1#, A2#,, 2, 0, 1) and it works sometimes.
  2. I have also tried running stockhistory individually using reduce as follows: =LET(dates, B1#, getStockData, LAMBDA(x, STOCKHISTORY(x, dates,,2,0,1)), result, REDUCE(dates, A2#, LAMBDA(acc,x, VSTACK(acc, getStockData(x)))), drop(result,1)).
  3. Which method is recommended for optimal use?
  4. Also, is stockhistory a volatile function, namely will it be updated regularly, or can I somewhere set the update to manual as the data changes only once a month for some cells?
Microsoft 365 and Office | Excel | Other | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2024-08-25T04:20:40+00:00

    Dear KHQD

    That's great, it's good news that Stockhistory can calculate normally.

    If you think the above answer is helpful to you, please click "Yes" or "No" to help us improve the support experience and help other users with similar problems.

    We also appreciate your trust in Microsoft. If you encounter other problems in the future, you are always welcome to ask questions in the Microsoft Community. There will be technicians like me willing to assist you.

    And I sincerely wish you a happy life and all the best!

    Best Regards,

    Tracy - MSFT | Microsoft Community Support Specialist

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Anonymous
    2024-08-22T06:01:11+00:00

    Dear KHQD

    Sorry to bother you again. We have also received replies from users in other language sections who encountered the same problem as yours. Some users replied that they solved the problem by changing the uppercase and lowercase of the function. You can use this as a reference:

    English thread:

    Image

    Therefore, we recommend that you try changing the case of the function to see if it can be temporarily restored to normal. We also recommend that you submit feedback for this issue so that the relevant team can pay attention to this issue.

    Best Regards,

    Tracy - MSFT | Microsoft Community Support Specialist

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-08-20T09:51:25+00:00

    Dear KHQD

    Thank you for your reply.

    It needs to be explained that the calculation of the STOCKHISTORY function depends on a specific external service provider, which is an online service. Usually the prompt "connect" is related to the temporary server of the data source, which makes it impossible to return results.

    But please rest assured that this problem usually does not last too long.

    We also recommend that you submit it on theExcel feedback platform so that the relevant provider can notice the problem as soon as possible. If it is convenient, please provide as many details as possible, including pictures, copy videos, etc., where there will be dedicated developers to pay attention to and comment on your feedback.

    After sending feedback, you can share the feedback link in this forum, so that other users with similar problems in the forum, including me, can vote for your feedback. The more votes, the easier it is to get the attention of the development team. Thank you for your cooperation.

    Best Regards,

    Tracy - MSFT | Microsoft Community Support Specialist

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-08-20T03:22:37+00:00

    Thanks Tracy. I have checked all the changes you have suggested, but the issue with stockhistory persists. The biggest issue is that the data retrieval is erratic. Sometimes, the stock info obtained with stockhistory is populated, and other time many are not populated. So the only option I have is to close and reopen the workbook and hope it gets populated.

    The command: =STOCKHISTORY(E82#,F81#,,2,0,1)

    will produce data such as:

    ₹     1,508.20 1,583.50 1,356.20 1,338.30 1,527.15 # 1,550.50 1,568.80
    #CONNECT! #CONNECT! #CONNECT! #CONNECT! #CONNECT! # #CONNECT! #CONNECT!
    ₹        557.25 641.05 556.50 606.55 592.45 # 743.75 469.75
    ₹        700.15 772.60 650.55 612.35 641.05 # 601.00 #CONNECT!
    ₹   18,136.65 19,402.60 18,276.75 17,488.75 18,699.70 # 19,817.45 #CONNECT!
    ₹        205.10 194.45 170.95 164.80 173.60 # 142.80 152.15
    #CONNECT! #CONNECT! #CONNECT! #CONNECT! #CONNECT! # #CONNECT! 1,548.40
    #CONNECT! #CONNECT! #CONNECT! #CONNECT! #CONNECT! # #CONNECT! 2,782.85
    ₹        221.95 247.80 259.60 258.20 279.55 # 265.15 #CONNECT!

    The connect issue is random. This causes excel to keep waiting until I hit ESC.

    Hence making just one stockhistory call does have some issues.

    On the other hand if I have individual calls like: =TRANSPOSE(STOCKHISTORY(E82, $F$81, CurrentDate,2,0,1))

    I get output like:

    ₹    1,716.40 ##### ₹     1,508.20 1,583.50 1,356.20 1,338.30
    #CONNECT!
    ₹       629.50 ##### ₹        557.25 641.05 556.50 606.55
    #CONNECT!
    ₹  19,343.80 ##### ₹   18,136.65 19,402.60 18,276.75 17,488.75
    ₹       185.85 ##### ₹        205.10 194.45 170.95 164.80
    #CONNECT!
    #CONNECT!
    ₹       223.80 ##### ₹        221.95 247.80 259.60 258.20

    At least this approach does not block and require me to hit ESC. When I see this type of missing data, I will close and reopen the workbook and often the #connect! issue will go away. Very erratic.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2024-08-20T02:41:09+00:00

    Dear KHQD

    Thanks for raising your concerns in Microsoft Community.

    We understand that you want to inquire about the use of the STOCKHISTORY function. We simulated a simple call, such as the following figure:

    Usually, the busy prompt is related to the network connection, Excel version or settings, and the requested exchange.

    Because you need to select an exchange to use stock data, the data corresponding to different exchanges will fluctuate, so this situation may occur and cause it to fail to load. Usually, the data will appear after a while after the busy appears. If it is displayed as busy for a long time, you can try to change the exchange.

    STOCKHISTORY function - Microsoft Support

    You can also try the following steps:

    Disable Excel's hardware graphics acceleration(You need to close all Office components first):

    1. Press Windows key + R, enter regedit to open the registry editor:
    2. Find the following path:
        HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\Graphics 
      

    (If there is no Graphics, please create this item manually)

    1. Select Graphics, right-click "New DWORD (32-bit)", name it DisableHardwareAcceleration. Double-click to open this key value and set the value to 1.
    2. Reopen the Office component to confirm the situation.

    Disclaimer: Generally, modifying registry subkeys or work group is intended for advanced users, administrators, and IT Professionals. It can help fix some problems, however, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For further protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, clickHow to back up and restore the registry in Windows - Microsoft Supportto view the article.

    Change network settings:

    • Change your computer's network connection, which can be switched to mobile hotspot.
    • Click Windows+R and type ncpa.cpl.
    • Click on the name of the network you are now connected to, open the Network Status window, click Properties, in the Network Properties window, double-click on Internet Protocol version 4 (TCP/IPv4), change the Auto-DNS to "4.2.2.1" and "4.2.2.2", and then click "OK".
    • Tap Windows+R and type inetcpl.cpl to open Internet Options.
    • Click "Connections" in the upper menu bar, click "LAN Settings", tick "Auto-detect settings", and make sure the remaining two are unchecked, click "OK".
    • Click "Advanced" on the right side of the upper menu bar, pull down the slider, tick "Restore Advanced Settings", click "Apply" on the bottom right corner, and then click "OK".

    You can try the above steps and then check the operation of Excel.

    In addition, regarding the Let and reduce functions you mentioned, this is also possible, but it may cause performance problems due to multiple calls to the STOCKHISTORY function in the formula. Because your STOCKHISTORY formula is a direct usage, if the amount of data is not large, we would recommend that you use it. But if the range of the table is large, it may affect performance.

    STOCKHISTORY is indeed volatile, because it is a dynamic array function, it will be automatically updated according to the update of network data. It updates data based on changes in the stock market, usually instantly.

    If you prefer to have data updated less frequently, you can set the data update of the STOCKHISTORY function to manual. Although Excel itself does not directly support full manual updates, you can use the following methods to reduce the frequency of updates:

    Turn off automatic calculation: Go to the Formulas tab, select Calculation options, and set it to Manual. This way, Excel will not automatically recalculate all formulas every time a change is made.

    I hope the above information is helpful to you. If you need further assistance, please feel free to reply.

    Best Regards,

    Tracy - MSFT | Microsoft Community Support Specialist

    Was this answer helpful?

    0 comments No comments