Import Text Data Then Chart Results?

  • Thread starter Thread starter John Gregory
  • Start date Start date
You can use Data->Text to columns to split this data into columns whic
can be plotted.

Make sure you choose the "Text" format for importing the date column
else Excel can ruin date formats.

- Leni
 
Hi John

If you copy the web address to clipboard, then in excel select File
Open, and paste the address in:

http://www.federalreserve.gov/releases/h10/Summary/indexnc_m.txt

Excel will open the file directly. It is easiest to select fixed width
then delete to column break that excel tries to insert between th
month and year by clicking on that line at screen 2 of the text t
columns wizard. This should automatically give you proper date format
in the 1st column.

Incidentally, are you sure this isn't available as an excel file? S
louis fed has an excellent range of data in excel format. If like m
you're an economic data junkie, you may find this macro useful, which
use to import a wide range of from the st lois fed site.

I store these sheets in a a workbook that also charts them, but its to
big to post here. Let me know if you'd like it e-mailed (its 1.4M
tho)

If you run this code, I'd also recomment using a shorter array of fil
names to download at first (2 ior 3 files), just to check it for spee
and errors.

Sub download_fred_files()
Application.DisplayAlerts = False 'turn alerts off
page_names = Array("cdsp", "hsn1f", "houst", "indpro", "isratio"
"mfgoph", "mich", "napm", "neworder", "rsafs", "rrsfs", "tcu"
"umcsent", "afcedef", "afdef", "afexpnd", "afrecpt", "dgic96", "fpic1"
"gdpc1", "cpiaucsl", "ce16ov", "emratio", "helpwant", "payems", "pop"
"unrate", "bopbca", "bopbgs")
file_path = "http://research.stlouisfed.org/fred2/series/"
file_extension = ".xls"
this_workbook_name = ActiveWorkbook.Name
error_message = ""

For n = 0 To UBound(page_names)
file_to_copy = file_path & page_names(n) & "/downloaddata/"
page_names(n) & file_extension


'MsgBox file_to_copy
On Error Resume Next 'do not stop macro if file not found
SN = ActiveWorkbook.Sheets.Count - 1
Workbooks.Open Filename:=file_to_copy
If Error <> "" Then error_message = error_message & Chr(10)
Error
'If Error = "" Then error_message = error_message & Chr(10)
Error
If Error = "" Then
fnc = ActiveWorkbook.Name
ActiveSheet.Name = page_names(n) 'names the sheet with th
workbook name
ActiveSheet.Cop
After:=Workbooks(this_workbook_name).Sheets(SN) 'copies to new sheet a
end of workbook
Windows(fnc).Close
Else
error_message = error_message & Chr(10) & page_names(n) &
file not found!!" 'identifies missing files
End If

Next 'next file
If error_message <> "" Then MsgBox error_message
Application.DisplayAlerts = True 'turn alerts back on
End Su
 
Nicky, did you get my message that gave you an email to send your file this
morning?
 
I'm havin' a little trouble here. I'm not able to paste that address in the
window. Here's what I'm doin':



Target spread sheet is open with cursor at A1. I select Data/Import Text
File and set Files of Type to "Text Files." I then attempt to paste the URL
I copied from the browser that used just after opening Excel but the mouse
won't paste. The cursor goes to the File Name block but the mouse buttons
won't let me paste in the URL.



This path isn't making sense 'cause the Import Test File "Look in" box is
pointing to "My Documents". I'm trying to go a website.



I'm upside down here, Help please.
 
Please disregard the prior message concerning my difficulty in pasting the
URL. I got the web page transferred.


John Gregory said:
I'm havin' a little trouble here. I'm not able to paste that address in the
window. Here's what I'm doin':



Target spread sheet is open with cursor at A1. I select Data/Import Text
File and set Files of Type to "Text Files." I then attempt to paste the URL
I copied from the browser that used just after opening Excel but the mouse
won't paste. The cursor goes to the File Name block but the mouse buttons
won't let me paste in the URL.



This path isn't making sense 'cause the Import Test File "Look in" box is
pointing to "My Documents". I'm trying to go a website.



I'm upside down here, Help please.
 
Hi John,
Glad it worked ok
I haven't received an e-mail - you could try again, or leave a messag
for me at excelforum if you want to to sent the spreadsheet
 
Forgive me, Nicky. I'm lost. You offerred to send me a copy of the spread
you use to gather econ data. I'd sure like to see what you've done. I don't
know how to reach you on that website so just use this as an email address:
(e-mail address removed).

Also, I don't know if I supposed to just copy the macro you gave me into a
new one I make. If so, do I just label a macro, hit enter, right click to
bring up the code, delete it and insert what you gave me?
 
Back
Top