Wednesday, 8 May 2019

Excel formula to take out quotations


Does anyone know a way to get excel to not include quotations in a value?


I have the formula:


=WEBSERVICE("http://finance.yahoo.com/d/?s="&A3&"&f=p2") 

so that I can pull the % Change in a Stock price from Yahoo finance.


It pulls the number back as "+0.15". the quotations are preventing me from throwing the =NumberValue formula in front of that one so that I can format the cells.


I have the same formula (just a tab bit different URL) for Change in price and it doesn't put quotations around it.



Answer



Use SUBSTITUTE to find and replace text - =SUBSTITUTE(some_text,"""","") will replace all double quotes with nothing. (There are four double quotes in the second parameter because you have to double them inside strings - otherwise Excel interprets it as the end of the string). So you could use:


=SUBSTITUTE(WEBSERVICE("http://finance.yahoo.com/d/?s="&A3&"&f=p2"),"""","")

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...