Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

whbunn

macrumors member
Original poster
May 29, 2009
69
17
The script below is used in Excel to get stock prices from Yahoo Finance.

The query gets the stock name and last price and puts in the cell designated when you set up the query.

The name and price are put in the same Excel cell. I would like to have the data put in cells next to each other horizontally. Eg cell A3=Apple, and cell B3 = $110.89. (see below)

How can I modify query to put the multiple facts about a security in separate cells horizontally?

WEB

1

http://finance.yahoo.com/d/quotes?s=AAPL&f=nl1



Screen Shot 2016-12-20 at 3.42.19 PM.png
 

campyguy

macrumors 68040
Mar 21, 2014
3,413
957
AFAIK you want a line feed, or carriage return - in 2011 I used "/r" (without the quotes, of course) in my scripts. I haven't tested this in Excel 2016 but I'd hazard a guess it's still the same. The Excel line feed character is achieved by pressing Option-Enter at the end of your line.

In Windows I use "/r/n" (without the quotes) and Alt-Enter, respectively...
 

whbunn

macrumors member
Original poster
May 29, 2009
69
17
AFAIK you want a line feed, or carriage return - in 2011 I used "/r" (without the quotes, of course) in my scripts. I haven't tested this in Excel 2016 but I'd hazard a guess it's still the same. The Excel line feed character is achieved by pressing Option-Enter at the end of your line.

In Windows I use "/r/n" (without the quotes) and Alt-Enter, respectively...
[doublepost=1482367523][/doublepost]Thanks for your input. Unfortunately I could not get the results I was looking for. All data ie. name and price put in same cell. I create the web query in word.

How would you write this query to get last price and name? If "l1" is price, "n" is name. I need price and name displayed as in original post

I am not a coder, keep it simple.


WEB
1
http://finance.yahoo.com/d/quotes?s=AAPL&f=l1
 

campyguy

macrumors 68040
Mar 21, 2014
3,413
957
No worries. I'm at a loss, sorry. The header you're using ceased in its use in 2011 AFAIK. I'm still using the Win version of 2016 as the Web Query is built in. I'll ask my biz partner when I see him in a couple of days, unless I come up with something before then. My line break proposal did work on my existing scripts, a reason behind my suggestion or I would have kept my lips zipped...
 

whbunn

macrumors member
Original poster
May 29, 2009
69
17
not sure if you need to use the query you are using, but there is an add-in that you can use that will pull down the stock price for stocks from Yahoo finance at predetermined intervals. Take a look at this thread for more info: https://answers.microsoft.com/en-us...-2016-on/20a74032-28c7-4962-8904-61b171b726fb
Thanks for your input. For various reasons I am not moving to excel 2016 yet. I am aware of its feature.

again, thanks
[doublepost=1482409629][/doublepost]
No worries. I'm at a loss, sorry. The header you're using ceased in its use in 2011 AFAIK. I'm still using the Win version of 2016 as the Web Query is built in. I'll ask my biz partner when I see him in a couple of days, unless I come up with something before then. My line break proposal did work on my existing scripts, a reason behind my suggestion or I would have kept my lips zipped...
Thanks for taking the time to reply.

Bill
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.