Here’s a ‘no fuss, no muss’ way to grab the latest exchange rates and use them in Excel. No need to lookup a rate and type it in, let Excel do all that work for you.
You might expect Excel to do this out of the box. After all, Microsoft has been banging on about Internet integration for years and their main rival, Google, has an exchange rate function in their spreadsheets (see GoogleFinance() ).
Real Time Excel
Real-Time Excel – get live stock prices, currency rates and more includes working spreadsheets for this tip and many other examples of getting live information into Excel.
There are many places on the web which supply exchange rate information in a computer readable format. Excel can grab that data and put it into cells for the worksheet. For this article, we set some limitations:
- No VBA code or addons. This removes security concerns or hassles. Our example uses a simple .xlsx worksheet.
- Simple system that’s easy to explore and understand.
- Free access to the exchange rate information
- Xrates in XML format (which Excel understands).
Microsoft once provided a connection to their MSN data source but that’s been dropped.
For our examples, we’ll use data from FloatRates.com because their XML data format is simple and uncomplicated compared to others. The web link is simple, needs no changing parameters and no registration.
For the latest US Dollar exchange rates go to http://www.floatrates.com/daily/usd.xml this is an XML data feed which looks like a web page via a XML style sheet. Choose ‘View Source’ in your browser to see the underlying data which is what Excel will copy into a worksheet.
FloatRates.com web page (left) and source page as XML (right)
FloatRates.com also has exchange rates with other currencies as a base.
New Zealand: http://www.floatrates.com/daily/nzd.xml
For the full list go to http://www.floatrates.com/feeds.html
The standard recommendation for web data importing is Data | Get External Data | From Web which works for web pages with tables (the <TABLE> tag) but that doesn’t work if the XML data is changed with a style sheet.
So, we dig a little deeper to Get External Data | From Other Sources | From XML data import. This tells Excel to ignore the style sheet formatting and use the XML data only.
Paste the web link (complete with http:// or preferably https:// prefix) in the Select Data Source dialog. See above for a list of options.
Excel will warn if there’s no XML schema available, that’s OK, let Excel create one for you. An XML schema is the structure of the XML data feed which, officially, should always be supplied. In practice, many XML feeds don’t have a schema because it’s obvious from the feed itself.
Next, tell Excel where to put the data, most likely a New worksheet.
Before clicking OK, check out the Properties.
Name: make sure the Query name is self-explanatory
Refresh Control: Make the refresh rate suitable to the data feed. In this case the data is only updated every 12 hours, so there’s no point in refreshing every hour (the default).
Now there’s a worksheet with 92 current conversions from US Dollar to international currencies in your worksheet.
Use Vlookup() to grab the exchange rate you want for your calculation.
Note: Vlookup requires the source data to be sorted on the column you’ll be using for the lookup. Do that from the Data | Sort tab.
You have to re-sort the list after each time the data is refreshed. Real-Time Excel – get live stock prices, currency rates and more shows how to get around that Excel limitation.
Check your calculation!
It’s too easy to get an exchange rate ‘turned around’. Even experts can get the Buy and Sell rates for a currency confused. Here’s a snippet of the ‘USD dollar’ rate feed.
These rates apply if you have US dollars and what you’ll get if you buy the other currency. For example, if you have USD$1 you’ll get 0.89 Euro, 77 UK pence or $1.311 Aussie dollars.
The common mistake is the multiply the rate given when you want to buy (convert into) the base currency. That’s wrong and will give you very misleading answers.
Reverse xrate: if you want to convert from other currencies to the base currency (US dollars in this case) divide the rate into 1. ( = 1/rate ). Do that by making a ‘parallel’ column that converts the rate.
Now you can convert from and to the base currency. Just make sure you choose the correct column/rate!
Double check: check your worksheet logic by doing tests against one of the many currency conversion web sites.
That’s just the basics of online data import into Excel for currency conversions. Real-Time Excel – get live stock prices, currency rates and more has useful extra info you should get with the currency data. Also, other online data that Excel can grab.
Office Watch has the latest news and tips about Microsoft Office. Independent since 1996. Delivered once a week.