No matter how many [specialized accounting tools](https://en.wikipedia.org/wiki/Comparison_of_accounting_software) there may exist nowadays, Microsoft Excel is still one of the best choices for keeping track of personal finances. It is easy to start with, incredibly flexible, and scales well to most accounting tasks a layperson might encounter in practice. If you want to include cryptocurrencies to an Excel spreadsheet of your assets, you might discover a slight inconvenience - the prices of cryptocurrencies float like crazy all the time and updating them manually is a pain. Fortunately, Excel makes it possible to add a custom function which will conveniently query the current exchange rates for you. Let me show you how to do it: 1. Go to *Developer ⇒ Visual Basic* in the Ribbon menu (or simply press **Alt+F11**). <center>![ribbon.png](https://steemitimages.com/DQmY8SEQixrGpxE6mRE6XiDxdr64Uq126P2zvitSti3DMZd/image.png)</center> 2. The *Visual Basic for Applications* window will open. Right-click the "VBAProject", corresponding to your workbook, and choose *Insert ⇒ Module*: <center>![module.png](https://steemitimages.com/DQmVU7LrbbA6y8zhBFuqcx8eKUCVGUZXneJhyDzU5GNBrap/image.png)</center> 3. Paste the following code into the newly opened module window: ``` Public Function HttpGet(ByVal requestUrl As String) As String Set http = CreateObject("WinHttp.WinHttpRequest.5.1") With http .Open "GET", requestUrl, True .Send "" .WaitForResponse HttpGet = .ResponseText End With End Function Public Function GetCryptoCurrencyPrice(ByVal name As String, Optional ByVal baseCurrency As String = "EUR", Optional ByVal cacheBuster As Object) As Double GetCryptoCurrencyPrice = -1# json = HttpGet("https://api.coinmarketcap.com/v1/ticker/" & name & "/?convert=" & baseCurrency) For Each Line In Split(json) If found Then GetCryptoCurrencyPrice = CDbl(Mid(Line, 2, Len(Line) - 3)) Exit Function End If If Line = """price_" & LCase(baseCurrency) & """:" Then found = True End If Next End Function ``` 4. Close the *Visual Basic for Application* window (or press **Alt+F11**) to go back to the spreadsheet. You are now free to use the `GetCryptoCurrencyPrice` function in the worksheet, just like any other Excel function. It will query the current prices from the [coinmarketcap.com](https://coinmarketcap.com/) website. The function has three parameters: - The name of the cryptocurrency, as it is named on Coinmarketcap (e.g. Bitcoin is called `bitcoin`, Steem is `steem` and SBD is `steem-dollars`). - The name of the target currency ("EUR", "USD", "AUD", "RUB", "NOK", "SEK", etc). "BTC" also works. - An optional pointer to a cell, changing the value of which will trigger a new query. Here is how you would use it within a typical table: <center>![](https://steemitimages.com/DQmR8bh7hV4hXwthb71XjnXCPTs3Mv8imUBkvi3vWNuSMuY/image.png)</center> Note that the empty cell `A1` is referenced in the formula so that we could trigger a query to refresh the price by simply modifying `A1` (just writing a random character and removing it, for example). Now drag the newly created formula to fill the whole column, add the computations for the total value and voilà - your very own cryptocurrency portfolio management tool. Similar to, say, [Cryptofolio](http://cryptofolio.info/), but more flexible and not limited to cryptocurrencies (on the downside - it is not web-based and won't work on your phone). <center>![](https://steemitimages.com/DQmTXsnNxj2Mo4VDbceEHwUoffu3HUVniq5zzbYm95t1ZZX/image.png)</center>
post_id | 11,420,766 |
---|---|
author | konstantint |
permlink | cryptocurrency-accounting-in-excel |
category | howto |
json_metadata | "{"app": "steemit/0.1", "format": "markdown", "links": ["https://en.wikipedia.org/wiki/Comparison_of_accounting_software", "https://coinmarketcap.com/", "http://cryptofolio.info/"], "image": ["https://steemitimages.com/DQmY8SEQixrGpxE6mRE6XiDxdr64Uq126P2zvitSti3DMZd/image.png"], "tags": ["howto", "excel", "cryptocurrency", "bitcoin", "money"]}" |
created | 2017-08-29 21:48:45 |
last_update | 2017-08-30 08:05:03 |
depth | 0 |
children | 11 |
net_rshares | 397,225,563,122 |
last_payout | 2017-09-05 21:48:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 1.128 SBD |
curator_payout_value | 0.230 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 3,774 |
author_reputation | 360,301,994,866 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 0 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
xeldal | 0 | 44,964,089,409 | 0.4% | ||
ausbitbank | 0 | 162,942,867,753 | 1% | ||
anarcho-andrei | 0 | 194,874,670 | 0.3% | ||
wesleybos | 0 | 0 | 100% | ||
allyouneedtoknow | 0 | 718,405,602 | 0.3% | ||
dugibri | 0 | 498,909,808 | 100% | ||
anonimnotoriu | 0 | 1,473,295,603 | 25% | ||
susueng | 0 | 21,220,836,923 | 20% | ||
ironshield | 0 | 6,770,722,491 | 100% | ||
etartakovsky | 0 | 0 | 100% | ||
gregario | 0 | 415,762,241 | 4.84% | ||
konstantint | 0 | 15,034,507,671 | 100% | ||
talltim | 0 | 4,064,258,693 | 100% | ||
msp-creativebot | 0 | 130,578,961,839 | 11% | ||
maxabit | 0 | 2,614,298,003 | 100% | ||
lturner | 0 | 1,268,267,270 | 100% | ||
stsl | 0 | 3,409,341,448 | 7% | ||
cryptoblock | 0 | 1,056,163,698 | 100% | ||
mellwen | 0 | 0 | 100% | ||
mckibbinusa | 0 | 0 | 100% | ||
quetiak | 0 | 0 | 100% |
Is it possible to update automatically at certain intervals? For example, how do I apply a module like OnTime Now + TimeValue ("00:00:30"), "AddCell"?
post_id | 11,438,876 |
---|---|
author | susueng |
permlink | re-konstantint-cryptocurrency-accounting-in-excel-20170830t030113634z |
category | howto |
json_metadata | "{"app": "steemit/0.1", "tags": ["howto"]}" |
created | 2017-08-30 03:00:51 |
last_update | 2017-08-30 03:00:51 |
depth | 1 |
children | 1 |
net_rshares | 0 |
last_payout | 2017-09-06 03:00:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 150 |
author_reputation | 2,570,395,782,768 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
Of course you can also add logic to recalculate the sheet automatically at regular intervals. One way to do this could be to add a new module with, for example, the following code: ``` Private Running As Boolean Public Sub StartTimer() Running = True Call TimerEvent End Sub Public Sub StopTimer() Running = False End Sub Public Sub TimerEvent() Workbooks("Book1").Worksheets(1).Calculate If Running Then Application.OnTime Now + TimeValue("00:00:10"), "TimerEvent" End If End Sub ``` (Note that you'd need to replace "Book1" with the appropriate name, or simply use `ActiveWorkbook` in place of `Workbooks("Book1")`, although then the timer will be recalculating whatever workbook you have open at the moment). You can start the timer by running the `StartTimer` macro (using the "Run" button) and stop it using `StopTimer`. It might make sense to also add something like this to the code of `ThisWorkbook` module, so that the timer will start and stop automatically: ``` Private Sub Workbook_Open() Call StartTimer End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Call StopTimer End Sub ```
post_id | 11,458,144 |
---|---|
author | konstantint |
permlink | re-susueng-re-konstantint-cryptocurrency-accounting-in-excel-20170830t083538814z |
category | howto |
json_metadata | "{"app": "steemit/0.1", "tags": ["howto"]}" |
created | 2017-08-30 08:35:42 |
last_update | 2017-08-30 08:37:36 |
depth | 2 |
children | 0 |
net_rshares | 0 |
last_payout | 2017-09-06 08:35:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 1,150 |
author_reputation | 360,301,994,866 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
This is a really useful! I am pleased to announce that your post has been featured in Max Curation Edition No.6 published on Steemit. You can take a look at it [HERE](https://steemit.com/community/@maxabit/best-of-steemit-max-curation-edition-no-6-find-gems-on-steemit-2017830t22412437z). Congratulations! Upvoted and resteemed.
post_id | 11,493,726 |
---|---|
author | maxabit |
permlink | re-konstantint-cryptocurrency-accounting-in-excel-20170830t164539434z |
category | howto |
json_metadata | "{"app": "steemit/0.1", "links": ["https://steemit.com/community/@maxabit/best-of-steemit-max-curation-edition-no-6-find-gems-on-steemit-2017830t22412437z"], "tags": ["howto"]}" |
created | 2017-08-30 16:45:42 |
last_update | 2017-08-30 16:45:42 |
depth | 1 |
children | 2 |
net_rshares | 23,015,768,358 |
last_payout | 2017-09-06 16:45:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.059 SBD |
curator_payout_value | 0.017 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 331 |
author_reputation | 4,410,059,454,176 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
konstantint | 0 | 15,034,507,671 | 100% | ||
maxabit | 0 | 7,981,260,687 | 100% |
Thanks for the appreciation!
post_id | 11,502,214 |
---|---|
author | konstantint |
permlink | re-maxabit-re-konstantint-cryptocurrency-accounting-in-excel-20170830t183725257z |
category | howto |
json_metadata | "{"app": "steemit/0.1", "tags": ["howto"]}" |
created | 2017-08-30 18:37:27 |
last_update | 2017-08-30 18:37:27 |
depth | 2 |
children | 1 |
net_rshares | 0 |
last_payout | 2017-09-06 18:37:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 28 |
author_reputation | 360,301,994,866 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
You're welcome!
post_id | 11,677,068 |
---|---|
author | maxabit |
permlink | re-konstantint-re-maxabit-re-konstantint-cryptocurrency-accounting-in-excel-20170901t160930702z |
category | howto |
json_metadata | "{"app": "steemit/0.1", "tags": ["howto"]}" |
created | 2017-09-01 16:09:33 |
last_update | 2017-09-01 16:09:33 |
depth | 3 |
children | 0 |
net_rshares | 0 |
last_payout | 2017-09-08 16:09:33 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 15 |
author_reputation | 4,410,059,454,176 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
Amazing post, thanks a ton.
post_id | 11,494,363 |
---|---|
author | karthik2rock |
permlink | re-konstantint-cryptocurrency-accounting-in-excel-20170830t165309429z |
category | howto |
json_metadata | "{"app": "steemit/0.1", "tags": ["howto"]}" |
created | 2017-08-30 16:53:09 |
last_update | 2017-08-30 16:53:09 |
depth | 1 |
children | 0 |
net_rshares | 14,583,472,441 |
last_payout | 2017-09-06 16:53:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.035 SBD |
curator_payout_value | 0.011 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 27 |
author_reputation | 0 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
konstantint | 0 | 14,583,472,441 | 100% |
This is a very valuable tutorial to anyone with a few types of cryptocurrency. I'm resteeming so my husband can read - he's our account manager and definitely better at Excel than I am, though I'm very intrigued to discover you can add commands to Excel this way.
post_id | 11,535,641 |
---|---|
author | lturner |
permlink | re-konstantint-cryptocurrency-accounting-in-excel-20170831t034413192z |
category | howto |
json_metadata | "{"app": "steemit/0.1", "tags": ["howto"]}" |
created | 2017-08-31 03:44:12 |
last_update | 2017-08-31 03:44:12 |
depth | 1 |
children | 0 |
net_rshares | 22,113,350,667 |
last_payout | 2017-09-07 03:44:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.056 SBD |
curator_payout_value | 0.016 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 263 |
author_reputation | 4,547,553,088,751 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
ironshield | 0 | 7,078,842,996 | 100% | ||
konstantint | 0 | 15,034,507,671 | 100% |
Nice post man! do you think I can apply this to openoffice? I dont know too much about visualbasic :S Thanks a lot! very usefull post!!
post_id | 11,826,702 |
---|---|
author | cryptoblock |
permlink | re-konstantint-cryptocurrency-accounting-in-excel-20170903t121255284z |
category | howto |
json_metadata | "{"app": "steemit/0.1", "tags": ["howto"]}" |
created | 2017-09-03 12:12:54 |
last_update | 2017-09-03 12:12:54 |
depth | 1 |
children | 1 |
net_rshares | 0 |
last_payout | 2017-09-10 12:12:54 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 135 |
author_reputation | 0 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
Yes, you can do the same in OpenOffice as well. Go to *Tools ⇒ Macros ⇒ Organize Macros ⇒ OpenOffice Basic...*, create a new module under your current document, and paste the following, slightly modified, version of the code in the newly opened editor window: ``` Public Function HttpGet(ByVal requestUrl As String) As String Set http = CreateObject("WinHttp.WinHttpRequest.5.1") With http .Open "GET", requestUrl, True .Send "" .WaitForResponse 10 HttpGet = .ResponseText End With End Function Public Function GetCryptoCurrencyPrice(ByVal name As String, ByVal baseCurrency As String, Optional cacheBuster As Variant) As Double GetCryptoCurrencyPrice = -1# json = HttpGet("https://api.coinmarketcap.com/v1/ticker/" & name & "/?convert=" & baseCurrency) For Each Line In Split(json) If found Then GetCryptoCurrencyPrice = CDbl(Mid(Line, 2, Len(Line) - 3)) Exit Function End If If Line = """price_" & LCase(baseCurrency) & """:" Then found = True End If Next End Function ```
post_id | 11,874,447 |
---|---|
author | konstantint |
permlink | re-cryptoblock-re-konstantint-cryptocurrency-accounting-in-excel-20170903t232907870z |
category | howto |
json_metadata | "{"app": "steemit/0.1", "tags": ["howto"]}" |
created | 2017-09-03 23:29:09 |
last_update | 2017-09-03 23:29:09 |
depth | 2 |
children | 0 |
net_rshares | 0 |
last_payout | 2017-09-10 23:29:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 1,111 |
author_reputation | 360,301,994,866 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
Nice article, I've posted a link to it on https://Fresherblock.com (let me know if you'd like an invite)
post_id | 12,026,438 |
---|---|
author | adrianscott |
permlink | re-konstantint-cryptocurrency-accounting-in-excel-20170905t162813632z |
category | howto |
json_metadata | "{"app": "steemit/0.1", "links": ["https://Fresherblock.com"], "tags": ["howto"]}" |
created | 2017-09-05 16:28:12 |
last_update | 2017-09-05 16:29:06 |
depth | 1 |
children | 0 |
net_rshares | 1,492,458,758 |
last_payout | 2017-09-12 16:28:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 104 |
author_reputation | 54,394,570,956 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
konstantint | 0 | 1,492,458,758 | 100% |
Useful and instructive, thanks!
post_id | 23,552,120 |
---|---|
author | mckibbinusa |
permlink | re-konstantint-cryptocurrency-accounting-in-excel-20180104t153957108z |
category | howto |
json_metadata | "{"app": "steemit/0.1", "tags": ["howto"]}" |
created | 2018-01-04 15:40:03 |
last_update | 2018-01-04 15:40:03 |
depth | 1 |
children | 0 |
net_rshares | 0 |
last_payout | 2018-01-11 15:40:03 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 31 |
author_reputation | 15,930,236,457 |
root_title | "Cryptocurrency Accounting in Excel" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |