How to import price from Bloomberg? - regex

From this website
https://www.bloomberg.com/profile/company/AAGB:MK
I want to extract the value for stock AAGB:MK.
In my Google Sheets, this is my formula.
=IMPORTXML("https://www.bloomberg.com/profile/company/AAGB:MK","//a[#span class='priceText__0feeaba3']")
It fails to extract.
Can someone please help me?

try this:
=REGEXEXTRACT(INDEX(IMPORTDATA(
"https://www.bloomberg.com/profile/company/AAGB:MK"), 100, 1),
"price%22%3A(.*)%2C%22priceChange")

Related

I need help applying a formula to every row in a Google sheet

I have a google sheet that gets updated from a Google Form. Unfortunately, Google forms insert a new row for every response so I can't get the formula applied to every row automatically.
I found a workaround using arrayformulas here: https://www.labnol.org/google-form-formulas-050520#auto-number-form-responses-with-a-unique-id
and tried this:
=ArrayFormula(
IFS(
ROW(L:L)=1, "Invoice amounts",
LEN(L:L)=0, IFERROR(1/0),
LEN(L:L)>0, ARRAYFORMULA(JOIN(",",REGEXEXTRACT(SPLIT(ROW(L:L),","), "[0-9]{4}")))
)
)
But that produces this error
screenshot
I would be grateful if anyone can help or suggest an alternative.
Here is the sheet link: https://docs.google.com/spreadsheets/d/166jmHFHQoa6Q88AEJy39w8yfXShg7ml6Q_YRckP3oEk/edit?usp=sharing
try:
=ARRAYFORMULA({"Invoice amounts"; IF(L2:L="",,
REGEXREPLACE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(LEN(
SPLIT(REGEXREPLACE(L2:L, "[A-Za-z\(\)-\.]", ), " "))>3,
SPLIT(REGEXREPLACE(L2:L, "[A-Za-z\(\)-\.]", ), " ")&",", )),,9^9))), " |,$", ))})

How to import money data using IMPORTXML?

I'm trying using ImportXML with XPath code to get currency rate, but this code not working.
=IMPORTXML("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"; "/gesmes:Envelope/Cube/Cube/Cube[#currency='USD']#rate")
=REGEXEXTRACT(QUERY(
IMPORTDATA("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
"where Col1 contains 'USD'"; 0); "rate='(.*)'")

Regex in google sheets - Extract parts of URL between slashes

I have difficulties with extracting parts of URL.
What I need is to know what category the product is(jeans, socks, tshirts), and a subcategory what color the product is(blue, black, white)
https://www.examplewebsite.com/shop/jeans/blue/123456
https://www.examplewebsite.com/shop/socks/black/234567
https://www.examplewebsite.com/shop/tshirst/white/4321
What is the best way to extract this in google sheets?
Please try:
=index(split(A1,"/"),,4)
and
=index(split(A1,"/"),,5)
copied down to suit.
={"PRODUCT", "CATEGORY";
INDEX(SPLIT(A2:A, "/"), , 4),
INDEX(SPLIT(A2:A, "/"), , 5)}

Add leading '$' to google charts

I am working with Google Charts. I need to add a '$' before the values on the y-axis as well as the value in the bubbles.
Is there a setting for this?
take care,
lee
UPdate,
Here is the data being used by the charts:
'Month','Semi-Detached in Toronto E04','Semi-Detached in Toronto E08','Condominium Townhouse in Toronto E04','Condominium Townhouse in Toronto E08', ],
['7/2011', 4354000,15305800,6776500,495000],['8/2011', 700000,10514418,7060786,0],['9/2011', 6854800,17805400,12087300,0],['10/2011', 7287400,14248900,16206500,0],['11/2011', 2696245,9733270,12698090,0],['12/2011', 1965800,6054500,8854390,0],['1/2012', 2450968,9012200,5500100,0] ]);
I've tried adding '$' before the values as well as '%24' as suggested before, but both throw syntax errors. And the values cannot be quoted without throwing a Google Charts error '
Data column(s) for axis #0 cannot be of type stringĂ—'.
Thanks everyone for your input. I found a question that was 99.9% the same:
How to set tooltips to display percentages to match axis in Google Visualization Line Chart?
Try using %24 which is the urlencoded form for $.
Use:
var formatter = new google.visualization.NumberFormat({prefix: '$'});
Check the example here:
https://developers.google.com/chart/interactive/docs/examples#interaction_example
More details here:
https://developers.google.com/chart/interactive/docs/reference#numberformatter

ColdFusion CFchart and feedback form

I am creating a feedback form system where users can fill in feedback forms and admin users will be able to run reports against the answers. I am trying to use cfchart to display the results in an easy to read manner for the administrators.
Here is my code:
&ltcfquery name="getFeedbackresults" datasource="#application.dsn#">
SELECT ff.feedbackFormId
,ff.feedbackFormName
,ff.feedbackFormDescription
,ff.activeFrom
,ff.activeTo
,ff.feedbackCountry
,ffq.question
,ffa.answer
,ffq.feedbackQuestionTypeId
,count(answer) AS distinctAnswer
FROM feedbackForm ff
,feedbackFormQuestion ffq
,feedbackFormInstance ffi
,feedbackFormAnswer ffa
WHERE ff.feedbackFormId = ffq.feedbackFormId
AND ff.feedbackFormId = ffi.feedbackFormId
AND ffi.feedbackFormInstanceId = ffa.feedbackFormInstanceId
AND ffa.feedbackQuestionId = ffq.feedbackQuestionId
AND ffq.feedbackQuestionTypeId not in (2,3)
GROUP BY ff.feedbackFormId, ff.feedbackFormName, ff.feedbackFormDescription, ff.feedbackCountry, ffq.question, ff.activeFrom, ffq.feedbackQuestionTypeId, ff.activeTo, ffa.answer
ORDER BY question
&lt/cfquery>
&ltcfoutput>
&lth2>#getFeedbackresults.feedbackFormName# Results&lt/h2>
&lth3>Description:
&ltp>#getFeedbackresults.feedbackFormDescription#&lt/p>
&ltul>
&ltli>&ltstrong>Active From: &lt/strong>#getFeedbackresults.activeFrom#&lt/li>
&ltli>&ltstrong>Active To: &lt/strong>#getFeedbackresults.activeTo#&lt/li>
&ltli>&ltstrong>Country: &lt/strong>#getFeedbackresults.feedbackCountry#&lt/li>
&lt/ul>
&lt/cfoutput>
&ltcfdump var="#getFeedbackresults#">
&ltcfchart format="flash" xaxistitle="Questions" yaxistitle="Answers" show3d="yes" chartheight="400" chartwidth="400">
&ltcfoutput query="getFeedbackresults" group="answer">
&ltcfchartseries type="bar" serieslabel="#answer#">
&ltcfchartdata item="#question#" value="#distinctAnswer#">
&lt/cfchartseries>
&lt/cfoutput>
&lt/cfchart>
The problem I am having is that the chart is displaying each list of answers in every series. I tried to upload an image but as I am a new user I'm not allowed. If anyone would like the image I can send it to them.
Any help would be greatfully appreciated.
You need to sort your query by the answer column if that's what you're going to group by. Your current ORDER BY is "question". Once you're sorting the same value that you're using for the group attribute on your cfoutput, you should be good to go.