The easiest way to have LIVE cryptocurrencies prices, and any other data, on excel! With a custom function! (Importing from Coinmarketcap)

in #cryptocurrency7 years ago (edited)

I've seen some tutorials on how to import Coinmarketcap data into excel, but most of them are a little too time consuming as you need to create a new worksheet for every different coin. Here is the way I found that works the best for me. We will be creating a custom excel funcion. Here is the step by step guide:

<p dir="auto">Edit: I've just update the article to include variants of the custom function for data other than price. (Market Cap, Volume, Supply, etc). <hr /> <ol> <li><p dir="auto">First, create a new file (or use your own portifolio workbook) and on the "Data" tab click on "New Query" -> "From Other Sources" -> "From Web".<br /> <img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmcr6f7uzYsArNQTLPa1svUoB3PKKiqQMGCB37bwm4hnX1/image.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmcr6f7uzYsArNQTLPa1svUoB3PKKiqQMGCB37bwm4hnX1/image.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmcr6f7uzYsArNQTLPa1svUoB3PKKiqQMGCB37bwm4hnX1/image.png 2x" /> <li><p dir="auto"><span>Past this link: "<a href="https://api.coinmarketcap.com/v1/ticker/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://api.coinmarketcap.com/v1/ticker/" and click OK. <li><p dir="auto">A new widow will pop up. Click on "To Table" at the top left corner and hit OK. <li><p dir="auto">Click on the small grey box with two arrows pointing in opposite directions next to "Column1" and press OK. Here you can select what info do you want excel to load. I personally load all of them as you can later retreive any data you want from this source.<br /> <img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmdZCZFzNCZz1oFcSnkZrtxmeNnCmS6KNiVbzF6kypmxb2/image.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmdZCZFzNCZz1oFcSnkZrtxmeNnCmS6KNiVbzF6kypmxb2/image.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmdZCZFzNCZz1oFcSnkZrtxmeNnCmS6KNiVbzF6kypmxb2/image.png 2x" /> <li><p dir="auto">Now click on "Close & Load" <li><p dir="auto">A new worksheet will be created. Rename it to "CMC".<br /> <strong>Note: It's important to rename it exactly to "CMC", we will use a macro that will search for a "CMC" worksheet. <li><p dir="auto">Select the first cell of the first column and click on the "Data" tab -> Refresh All -> "Connection Properties" -> Select "Refresh every" and set the interval you want your prices updated (I set to 20) and select "Refresh data when opening the file"<br /> <img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmPJsT5PvGdhBMoec9JB4x7cu1GyqXiDBaRtrju6hkC1UW/image.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmPJsT5PvGdhBMoec9JB4x7cu1GyqXiDBaRtrju6hkC1UW/image.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmPJsT5PvGdhBMoec9JB4x7cu1GyqXiDBaRtrju6hkC1UW/image.png 2x" /> <li><p dir="auto">Press ALT+F11 and a new widnow should open up. Now create a new module as shown below.<br /> <img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmeg8zsVHntt9DhTftJkp7rKytEdnWk7baDdvGTsn6KJ65/image.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmeg8zsVHntt9DhTftJkp7rKytEdnWk7baDdvGTsn6KJ65/image.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmeg8zsVHntt9DhTftJkp7rKytEdnWk7baDdvGTsn6KJ65/image.png 2x" /> <li><p dir="auto">Past this code: <p dir="auto"><code>Function CMCPrice(CMCTokenSymbol As String)<br /> <code>Application.Volatile<br /> CMCPrice = WorksheetFunction.VLookup(CMCTokenSymbol, Worksheets("CMC").Range("$C:$M"), 3, 0) <code>End Function` <p dir="auto">Now it's all set. The code above added a custom function to excel. You can now retrieve the price of any coin registered on Coinmarketcap. To retrieve a price from Bitcoin for example, type <em>=TokenPrice("BTC") on the cell you want the price at. <p dir="auto">Let's say you track the value of your crypto holdings in this worksheet and you have one bitcoin: <p dir="auto"><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmUJe8612imCethi86oySpjvHUzsJj2PUGh7iZh7uuQdmA/image.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmUJe8612imCethi86oySpjvHUzsJj2PUGh7iZh7uuQdmA/image.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmUJe8612imCethi86oySpjvHUzsJj2PUGh7iZh7uuQdmA/image.png 2x" /> <p dir="auto">But now you just bought 2 Ethereum and want to add it tho the table. Just select and drag the cells as following:<br /> <img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmXHNQrZUdTFcvWmZ7DVY8DW8hSAQShDqDE4JV26e5e9EA/image.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmXHNQrZUdTFcvWmZ7DVY8DW8hSAQShDqDE4JV26e5e9EA/image.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmXHNQrZUdTFcvWmZ7DVY8DW8hSAQShDqDE4JV26e5e9EA/image.png 2x" /> <p dir="auto">And change the refence name to ETH:<br /> <img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmVL2zCsDWhinou81GiTaAuYpm8Bbk6SqCakdefbYqVrFf/image.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmVL2zCsDWhinou81GiTaAuYpm8Bbk6SqCakdefbYqVrFf/image.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmVL2zCsDWhinou81GiTaAuYpm8Bbk6SqCakdefbYqVrFf/image.png 2x" /> <p dir="auto">You can add as many crypto as you want. e.g.<br /> <img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmWtGZqL6hrRBdXQRSFt16hDyCeCHu9KVWbnXLJR8q6Mg2/image.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmWtGZqL6hrRBdXQRSFt16hDyCeCHu9KVWbnXLJR8q6Mg2/image.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmWtGZqL6hrRBdXQRSFt16hDyCeCHu9KVWbnXLJR8q6Mg2/image.png 2x" /> <p dir="auto">I've uploaded an <a href="https://drive.google.com/file/d/0B634XdeaWr4iR2F2elhYc0UtQm8/view?usp=sharing" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">example workbook to google drive. <p dir="auto">I hope I've helped you! :D <p dir="auto"><em>Note: Remember to save your workbook as a macro enabled workbook or else the macro will not be saved. <hr /> <p dir="auto">Edit: I've created variants of the custom function for data other than price. (Market Cap, Volume, Supply, etc).Paste the function you want in the module window as we did with the price function. <p dir="auto">For the coin rank on CMC:<br /> <code>Function CMCRank(CMCTokenSymbol As String)<br /> <code>Application.Volatile <br /> <code>CMCRank = WorksheetFunction.VLookup(CMCTokenSymbol, Worksheets("CMC").Range("$C:$M"), 2, 0) <br /> <code>End Function <p dir="auto">For the coin price in BTC:<br /> <code>Function CMCPriceBTC(CMCTokenSymbol As String)<br /> <code>Application.Volatile<br /> <code>CMCPriceBTC = WorksheetFunction.VLookup(CMCTokenSymbol, Worksheets("CMC").Range("$C:$M"), 4, 0)<br /> <code>End Function <p dir="auto">For the trading volume in the last 24h:<br /> <code>Function CMCVolume24h(CMCTokenSymbol As String)<br /> <code>Application.Volatile <br /> <code>CMCVolume24h = WorksheetFunction.VLookup(CMCTokenSymbol, Worksheets("CMC").Range("$C:$M"), 5, 0)<br /> <code>End Function <p dir="auto">For the market cap:<br /> <code>Function CMCMarketCap(CMCTokenSymbol As String)<br /> <code>Application.Volatile<br /> <code>CMCMarketCap = WorksheetFunction.VLookup(CMCTokenSymbol, Worksheets("CMC").Range("$C:$M"), 6, 0)<br /> <code>End Function <p dir="auto">For the available supply:<br /> <code>Function CMCAvailableSupply(CMCTokenSymbol As String)<br /> <code>Application.Volatile<br /> <code>CMCAvailableSupply = WorksheetFunction.VLookup(CMCTokenSymbol, Worksheets("CMC").Range("$C:$M"), 7, 0) <br /> <code>End Function <p dir="auto">For the total supply:<br /> <code>Function CMCTotalSupply(CMCTokenSymbol As String)<br /> <code>Application.Volatile<br /> <code>CMCTotalSupply = WorksheetFunction.VLookup(CMCTokenSymbol, Worksheets("CMC").Range("$C:$M"), 8, 0)<br /> <code>End Function <p dir="auto">For the percent change in the last 1h:<br /> <code>Function CMCPercentChange1h(CMCTokenSymbol As String)<br /> <code>Application.Volatile<br /> <code>CMCPercentChange1h = WorksheetFunction.VLookup(CMCTokenSymbol, Worksheets("CMC").Range("$C:$M"), 9, 0) <br /> <code>End Function <p dir="auto">For the percent change in the last 24h:<br /> <code>Function CMCPercentChange24h(CMCTokenSymbol As String)<br /> <code>Application.Volatile<br /> <code>CMCPercentChange24h = WorksheetFunction.VLookup(CMCTokenSymbol, Worksheets("CMC").Range("$C:$M"), 10, 0)<br /> <code>End Function <p dir="auto">For the percent change in the last 7d:<br /> <code>Function CMCPercentChange7d(CMCTokenSymbol As String)<br /> <code>Application.Volatile<br /> <code>CMCPercentChange7d = WorksheetFunction.VLookup(CMCTokenSymbol, Worksheets("CMC").Range("$C:$M"), 11, 0)<br /> <code>End Function <p dir="auto">Now you can easily create tables like this one, in the <a href="https://drive.google.com/file/d/0B634XdeaWr4iR2F2elhYc0UtQm8/view?usp=sharing" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">example workbook: <p dir="auto"><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmdv1L8N11Ya6WSEBR54yjUiXmfcEN8RkFnXrRjLeyDs45/image.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmdv1L8N11Ya6WSEBR54yjUiXmfcEN8RkFnXrRjLeyDs45/image.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmdv1L8N11Ya6WSEBR54yjUiXmfcEN8RkFnXrRjLeyDs45/image.png 2x" /> <p dir="auto">:)
Sort:  

I saw your post on Reddit and came here to vote it up.

... And this, people, is how you help Steem go up in value!

Same here. I saw this post on Reddit.

I tried posting some of my Steem posts on r/cryptocurrency but got shadow ban each time.

Loading...

I love you for this!

Can't get it to work.

Try understanding how it works in the example workbook!

Thank you! Very helpful and simple to use. Updating my spreadsheet now.

Congratulations @aacoimbra! You have received a personal award!

1 Year on Steemit
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard:

Introducing SteemitBoard Ranking

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @aacoimbra! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!