You are on page 1of 7
Drawing for Matrix script signed by Keanu Reeves. $B https://store.excel-university.com/) & Learn More (https://news.excel-university.com/matrix- _(https://campus.excel-university.com/login/) Ya drawing) (https://store.excel-university.com/cart?action=viewcart) EXCEL FREE GIFT (/free-gift) UNIVERSITY (HOPE //www.excel-university.com/) Get Current and Historical Stock Prices into Excel Jeff Lenning (https://www.excel-university.com/author/jefflenning/) | July 15,2019 | Comments Off Microsoft recently updated the built-in tools for retrieving stock quotes into Excel. If you're typing closing prices into Excel manually, this article may be able to help you get it done faster. Specifically, we'll talk about how the Stock data type retrieves current quotes and related information, and how Power Query can retrieve historical stock quotes from the web, Welll take them one at a time. Note: This article is presented with Excel 0365 for Windows; not all versions of Excel include the features discussed. Current Prices with the Stock Data Type Let's say you have a handful of tickers and you want to view their current prices or related information. Perhaps your list is stored in a table (Insert > Table) and looks like Figure 1 Drasepateagtey ix script signed by Keanu Reeves. $B thtps://store.excel-university.com/) Lear \s://news.excel-university.com/matrix- _(https://campus.excel-university.com/login/) (https://store.excel-university.com/cart?actioi dra\ iewcart) GOOG Re FREE GIFT (/free-gift) = UNIVERSITY — BE//www.excel-university.com/) (Note: converting your ticker list into a Table isn't required, it just makes this feature easier to use) You can select the tickers, then click the Data > Stocks command in the Data Types group. When you do, Excel attempts to convert those static text values into stocks (Figure 2). a Hi Microsoft Corp (KNAS:MSFT) Alphabet Inc (XNAS:GOOG) Apple Inc (KNAS:AAPL) The little icons indicate Excel has successfully found the ticker symbols and converted them into stocks. So, what is so special about the stock data type? It retrieves a rich collection of market data—including current price, volume, high, low, company name, company description, number of employees and much more. To reveal these additional attributes, just click the little stock icon to the left of the company name and youll see a pop-up card that contains related data. Or, if you want to view the related data in cells, just click the little ‘Add Data icon in the upper right. For example, we can select price, high and low from the list and Excel retrieves the corresponding values (Figure 3). ao ice - a ee - Hi Microsoft Corp (KNAS:MSFT) $ 127.16 $ 128.00 $ 126.73 fim Alphabet Inc (XNAS:GOOG) $ 114190 $1,151.57 § 1,133.51 HBApple Inc (KNAS:AAPL) $ 17905 § 18057 § 177.91 You can manually refresh the values any time by right-clicking any of the stock icons and selecting Data Type > Refresh. If you had previously used the MSN Money Central Investor Stock Quotes connection, this is the replacement feature and provides much more information. But what if you want to retrieve historical quotes? For that, we can import data from a corresponding web page with Power Query. Historical Prices with Power Query At the time of this article, the Stocks data type contains current quotes only, So, if we want historical quotes, welll need to turn to the web. Pull up your favorite historical quotes web page or do a web search. In this article, we retrieve historical quotes from yahoo.com. The Yahoo service works well with Power Query and has a logical URL structure that is easy to customize for your desired ticker symbol. It uses the format: https: //#inance. yahoo. con/quote/YOUR-TICKERHERE/history/ Since Microsoft's ticker is MSFT, we could type the following URL into any web browser to see the historical quotes: + https://finance.yahoo.com/quote/MSFT/history/ Drala Po Flat tk Ser BUEIGRELEH Hee PREEVEENE IC nto agMbiheaWeAtdiclRRARRWerenmMeliife Byeble Led ba WaiRplor NRE TREF GARR AIENCURWRIRASE JotaneeselAear pn Shs Yur ARREARS BAR Ab gH FOU draveiggs.the range on the web page, copy (Ctrl+C) the infous REG: ARES ACRE RUMIEF RRP EGNAS Re PCASH-Mewcart) Paste Special EXEL the webpage formatting, this may or may MBER GkAMdifTeR B89, this uiclgggpy/paste BE//www.excel-university.com/) ‘Another option is to download a file from that webpage (if available) and then open it with Excel. This option typically avoids the formatting issues that can occur with copy/paste. In the case of the Yahoo page, there is a Download Data link that exports a CSV file that can be opened with Excel. And, if this was a one-time project, this option may be sufficient. But, if this was something we needed to update on an ongoing basis, another option is to use Power Query. Going forward, rather than browse to the webpage to view and download or copy the data, we can just click Refresh from within Excel. To do so, click Data > From Web in the Get & Transform group (not the legacy Get External Data group). This will open Power Query's From Web dialog. You simply paste or type your desired URL (Figure 4). x From Web @ Basic Advanced aL httosi//financeyahoo.com/quote/MSFT/history/ OK Cancel This will display Power Query's Navigator dialog where you're provided a list of importable items, which are essentially various tables that appear on the web page. We click through the list of tables until we see the one we want to import. For example, in our case, Table 2 holds the historical quotes (Figure 5). a x Navigator 2 | [BEN Wen view Select multiple tems Table 2 i Display Options ~ 2 ae & Date (Open High tow A fp finance yahoo com quote MSF ‘sha/ieie 2598 12309 A Document sfoa2019 12531 ura tbo 232019 2520 12529 S/a2/19 126.2 12524 Tablet » speyneis 2783 2752 ( Table2 5/20/2019 125: 12759 v FA Table 3 (5/37/2019 128.31 130.45 < > tox |*| [ tansermoas | [ ca With the desired table selected, we just click the down arrow on the Load button and select Load To, In the resulting dialog, we select Table and ... the results are loaded into the specified worksheet (Figure 6) Istore.exce-university.com/) us.excel-university.com/login/) sdbaps://store.excel-university.com/cart?action=viewcart) 126.18 LD7FREE GIFT (/free-gift) 126.90 5/23/2019 126.20 5/17/2019 128.31 Now, the nice thing about using Power Query is that next time we need to retrieve updated historical quotes, we can simply right-click any cell in the results table and select Refresh, Power Query essentially retrieves updated values from the original URL. In Excel, we see the updated table rows. hope these methods provide an efficient way to retrieve current and historical stock quotes into your Excel file. And remember, Excel rules! Posted in + Power and Pivot (https://mww.excel-university.com/articles/cal-cpa/power-and-pivot/) Make Quick Work with 10 Excel Skills — (https://www-excel-university.com/articles/cal-cpa/make-quick-work- with-10-excel-skills/) les Jeff Lenning Love sharing the things I've learned about Excel, and | built Excel University to help me do that. My motto is: Learn Excel. Work Faster. Excel is not what it used to be. You need the Excel Proficiency Roadmap now. Includes 6 steps for a successful journey, 3 things to. avoid, and weekly Excel tips. Free Roadmap (https://www.excel- university.com/roadmap/) Drawing for Matrix script signed by Keanu Reeves. BB tnttps://store.excetuniversity.com/) %"_(https://campus.excel-university.com/login/) eal Learn More (https://news.excel-university. drawing). .excel-university.com/cart?action=viewcart) EXCEL UNIVERSITY awaw.excel-university.com/) Excel University Books (/book) available at amazon — acne Excel University Volume 1 (https://www.amazon.com/dp/1534620109) Drawing for Matrix script signed by Keanu Ree\ = ps://store.exceluniversity.com/) Learn More (https://news.excel-university.com/ atric (hl GiSailiEernpus.excel-university.comvlogin/) WY drawing). bre.excel-university.com/cart?action=viewcart) EXCEL © (free-git) = UNIVERSITY = //www.excel-university.com/) hig ae ati Excel University Volume 2 (https://www.amazon.com/dp/1543187218) eas pay wii Excel University Volume 3 (https://www.amazon.com/dp/1543187242) cong 4 o pore ees Excel University Volume 4 (https://www.amazon.com/dp/1539933083) About Connect About Us (/university-preview/) Linkedin (hteps://www.linkedin.com/in/jefflenning/) Docs (https://help.excel-university.com) YouTube Thttne/hansay uruitiihe ramir/ayreliinivereitvinc) DAHA dr MAHARSEAER Sn ed by Keanu Reeves. ‘Feat inca seiesndnsnvaigncel-university.com/matrix- drawing). Scholarship (/scholarship) tEMEEbonsor) UNIVER: (nop Nea Daas) com/) Privacy Policy (/privacy-policy/) Training Course List (https://store.excel-university.com) Student Login (https://campus.excel- university.com/my/) For CPAs (/courses) For Individuals (/campus-pass) For Groups (/online-group-excel-training) For College Professors (/excel-content-for-accounting- information-systems-or-other-college-course/) Speed Loop (/speedloop) Contact Contact Form (/contact) +1 (949) 200-7688 (tel:+19492007688) support@excelu.com Excel University 307 E Willow St #3, Harrisburg, SD 57032 $B thitps://store.excel-university.com/) (https://campus.excel-university.com/login)) (htggdfssgre.excel-university.corn/cart?action=viewcart) (hpsi/win facebook com/exceluniverstyin) FREE GIFT (/free-gift) _ Instagram = (https://www.instagram.com/exceluniversity/) Twitter (https://twitter.com/exceluniversity) Blog (/blog) Related Excel Forum (https://www.mrexcel.com/board/) Excel Jobs (https://jooble.org/jobs-microsoft-excel) Excel Consulting (https://www.excel- university.com/consultants/) Excel Books (/book) Excel Coaching (/coaching) Free Resources (/learn-excel-free) Excel University (https://www.excel-university.com/) | Copyright © 2012-2020 | All rights reserved

You might also like