I have stocks from US and Canadian Companies.
I would like to be able to enter the stock symbol and select the exchange in the adjacent column and put the google finance formula and get the current ticker price.
Currently the only way I can get this done is by manually entering the exchange. For Example:
=googlefinance("tse:enb","Name") gets me the name of the stock symbol. I want to be able to enter the ticker symbol in one column and exchange in another column and get the desired output (name in this example) in another column.
Is there a better way to do this?
you could solve this issue by setting up your sheet as follows:
Exchange
Ticker
Symbol
Name
NASDAQ
APPL
=JOIN(":", A2, B2)
=GOOGLEFINANCE(C2, "Name")
and then just duplicating the formulas down as required, to make it easy for copy and pasting, I have put the formulas separately below
Symbol: =JOIN(":", A2, B2)
Name: =GOOGLEFINANCE(C2, "Name")
If this wasn't what you were looking for, please let me know and I'll try to help again.
Related
I need some sort of guidance on what would be the best way of accomplishing such kind of task in SAS EG environment (on a 9.4 server). Let's say I have table named ITEM_EVALUATION like in the following example. The missing evaluations (rows: 4,5 and 6) should be filled in by the user. Although there may be better solutions, I would prefer if SAS iterated over the missing rows, give the user the row information (item) and take the input (evaluation) then update the table by that input.
Since this task is going to be a part of another sas eg project (egp), I need to do it within this project, so please advise...
ITEM_EVALUATION.sas7bdat
ROW
ITEM
EVALUATION
1
car
owned
2
house
rent
3
cat
none
4
phone
5
job
6
vacation
7
Make sure your dataset occurs in your project. (Drag it to a flow, for instance.)
Ask your user to double click any empty cell in the table and accept to go to edit mode.
If the empty cells are rare, the user can enter a filter missing(ITEM) or missing(EVALUATION) on top of the data to find them.
If that is too complex for your user, Enterprise Guide is not the tool for this person.
I am trying to add data to a Map with Danish postcodes, e.g. 1000-9000 (we have four digits in Denmark).
When I add that into a Map, it scatters all over the world, as Power BI do not recognize it as Danish locations, even my Power BI is setup in Danish and the Map has Danish spelled city names.
I tried to add the regions Jylland, Fyn, Sjælland as a country hierarchy, but doing that moved Jylland (Jutland) as a place in Norway...
I also tried to use city names instead of post codes, but then a city shows up in Sweden...
It does not change whether the post code format is Text or Number format, and I have no option to use a Location format in the query.
Can anyone help me use Danish post codes for Map visualization? : )
Thanks
Ok, I solved it myself!
I found the place in the modelling part where I could force PowerBI to accept my city names, region names etc. and it now works.
More detailed: go into the middle of the three left side windows called Data (not Report, not Model), and click on the column you want to change format of. Then find the Tools section and change the Data Category to for example Address, or Country etc. Hope that helps
OK...not looking for code just yet. I'm making a change on how I handle a list of colleges.
I had one column in my a_players table called Offers. It was basically a CSV of Colleges that I exploded and sorted, but I would have to go in directly to the table to add to it. I want more flexibility and detail, including timestamp (Date), so I created a Colleges table and for each scholarship offer, an Offers table. All of this shows up on a Player's Profile.
Below is the query. The problem I'm having is how to handle the data from Offers table. I do have a FOREACH loop set up, which is how I handled the exploded and sorted from the CSV.
$query = "SELECT *,p.id as pid,p.city,p.school FROM a_players p
LEFT JOIN a_players_offers po
ON p.id = po.playerID
LEFT JOIN a_colleges c
ON po.collegeID = c.id
When I have a WHILE loop with the query results, if a kid has six offers, it prints all the profile information six times, including the College name. When I have an IF loop, it only prints the Player Profile once, but it also just prints the first college.
I think if I get some direction, I can produce the code myself. I just can't seem to find any samples when I have searched.
GROUP_CONCAT is the pathway for this, if anyone else comes across this with the same problem.
I am trying to calculate what the balance of an invoice was at a certain period where
BAL = Invoice.AMT - sum(adj.amts).
The adjustments amounts (adj.amts) are MV and have associated dates.
Therefore, I want to be able to have pass data via prompt for ACCTG.PERIOD.
SUBR('-IFS',SUBR('-LES',ACCTG.PERIOD,REUSE('ADJ.DATES')),'1','')
I also tried
SUBR('-IFS',SUBR('-LES',<<A,ACCTG.PERIOD>>,REUSE('ADJ.DATES')),'1','')
and that did not work.
This cannot be in a paragraph.
This has to be done in an attribute otherwise audit gets all crazy. And I have to use the generic subroutines like IFS and LES.
If I get what you are saying, I think you can use the WHEN statement with SORT to get what you are after provided your dictionary is properly associated or you can figure out how to associate the Multi-values inline.
SORT FILE WHEN ADJ.DATES LT "YOURDATE" AND ADJ.AMTS GT 0 BREAK.ON #ID TOTAL ADJ.AMTS DET.SUP
This example would sort the contents of FILE which assumes that FILE has 2 multivalue fields call ADJ.DATES and ADJ.AMTS and that they are a Date and Decimal type. It then finds all the associations in each record that meet that criteria and totals ADJ.AMTS for each record. The ID.SUP suppress the details.
Good Luck.
Is there any way to group a table by a text field, having in count that this text field is not always exactly the same?
Example:
select city_hotel, count(city_hotel)
from hotels, temp_grid
where st_intersects(hotels.geom, temp_grid.geom)
and potential=1
and part=4
group by city_hotel
order by (city_hotel) desc
The output I get is the expected, for example, City name and count:
"Vassiliki ";1
"Vassiliki";1
"Vassilias, Skiathos";1
"Vassilias";5
"Vasilikí";25
"Vasiliki";23
"Vasilias";1
But I'd want to group more this field, and get only one "Vasiliki" (or an array with all, this is not a problem) and a count of all the cells containing something similar between them.
I do not know if could this be possible. Maybe some function to text analysis or something similar?
SELECT COUNT(*), `etc` FROM table GROUP BY textfield LIKE '%sili%';
// The '%' is a SQL wildcard, which matches as many of any character as required.
You could do something like the above, choosing a word for the 'like' that best fits the spellings that your users have used.
Something that can help with that would be to do a
SELECT COUNT(*), textfield FROM table GROUP BY textfield ORDER BY textfield;
And selecting the most 'average' spelling for your words.
Otherwise you're starting to get into a bit of language processing, and for that you will want to write some code outside of SQL.
This would be something like https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance
To find word's that are the same within an arbitrary margin of error.
There is a MySQL implementation here that you should be able to transpose as needed
https://stackoverflow.com/a/6392380/1287480
(credit https://stackoverflow.com/a/3515291/1287480)
.
(Personal thoughts on the topic)
You Really Really want to think about limiting the input from users that can give you this issue in the first place. It's far far better to give the users a list of places to select from, than it is to push potentially 'dirty' information into your database. That eventually always winds up with you trying to clean the information at a later time. A problem that has kept many people employed for many years.