Google sheets query with text - google-query-language

This is probably a very stupid question but I can't seem to find an answer for it anywhere. I'm trying to use a simple COUNTA query but I also want text to appear so something like this
"Amount = "=COUNTA(B16:B25)

=(your text) & (your formula output)
="Amount: " & COUNTA(A:A)
should work.

Related

SSDT using multiple input fields in expression to create hyperlink

I am building an expression for a hyperlink in SSDT but I am trying to build it with 2 field inputs.
Here is what I started with in the expression box and it works.
="http://s1324.com/Report&Car=Toyota&Model=Celica"
Then i substituted Celica for &Fields!Model.Value and that URL worked. (where Fields!Model.Value = Celica)
="http://s1324.com/Report&Car=Toyota&Model="&Fields!Model.Value
Now i am trying to also substitute the word Toyota for a Car value (where Fields!Car.Value = Toyota) but i cant seem to complete the entire correct url
="http://s1324.com/Report&Car="&Fields!Car.Value"&Model="&Fields!Model.Value
Is there a way to use 2 inputs to create a URL?
Thanks
You've missed the ampersands in the middle part. Try this
="http://s1324.com/Report&Car=" & Fields!Car.Value & "&Model=" & Fields!Model.Value
If you put spaces between operators it's easier to read

How to use a conditional array formula in Google Sheets?

I want my spreadsheet user to be able to choose between two different options for an array formula. I have tried to put it in an IF statement but I can't get it to work. I do not want to cut and paste it down the column because I want it to be applies when a new row is added. I don't really know what I'm doing but I've been fiddling with it for a couple of hours now. Here is the code I currently have:
=IF($B$6="alternating days",ARRAYFORMULA(IF(ISBLANK(indirect("OVERVIEW!$A" & row())),IF($C2:C="l","l","d"),IF($C2:C="l","d","l"))),IF($B$6="weekdays/weekends",ARRAYFORMULA(IF(ISBLANK(indirect("OVERVIEW!$A" & row())),IF($C2:C="l","l","d"),IF(OR(WEEKDAY
(indirect("OVERVIEW!$A" & row()))=1,WEEKDAY(indirect("OVERVIEW!$A" & row()))=7),"l","d"))),"none"))
It's a long formula so please scroll along.
I attempted to have the ARRAYFORMULA at the beginning but it wouldn't let me reference just $B$6.
Thanks for any help you can provide.
I recommend something like this:
=ARRAYFORMULA(IF($B$6="alternating days",if(isodd(row(indirect("C4:C"&counta(OVERVIEW!A3:A)+3))),"l","d"),IF($B$6="weekdays/weekends",ARRAYFORMULA(IF(WEEKDAY(OVERVIEW!A3:A)=1,"d",if(WEEKDAY(OVERVIEW!A3:A)=7,"d","l"))))))
If the days are alternating, use odd rows to alternate the letter, otherwise just combine 2 IF statements to determine if it is a weekday or not.

VB.net JSON If Using Textbox text in statment

Hi there im currently having an issue where the following code will work
If(jResults("items")("head") Is Nothing, "", jResults("items")("head")("icon").ToString())
however if i try to substitute a value with a textbox i cant get it to work
If(jResults("items")( + itemtypelbl.Text + ) Is Nothing, "", jResults("items") ("itemtypelbl.Text")("icon").ToString())
any help would be greatly appreciated
If your code is exactly as you have in your question, the problem is the lack of anything before the first + and after the second +. You need to have an operand either side of an operation like +.
EDIT: I also just saw that the name of the textbox should not be in quotes, as you are trying to access a variable property, not a hard-coded string.
Here is what I think your code should be:
If(jResults("items")(itemtypelbl.Text) Is Nothing, "", jResults("items") (itemtypelbl.Text)("icon").ToString())

SSRS: Can you have the label of a (pie) chart be both the category AND the Percent

I have a pie chart in SSRS. It contains many categories so it is kinda hard to read. What I would like to do is include the category AND the percent in the label, but I am not sure how to do this.
You can include the category by setting the label to [CategoryName] (this is the default).
You can include the percent by changing that to #PERCENT.
But I cannot seam to figure out how to include both.
Is there a VBA formula that I can add that will give me both?
You can actually just shove #PERCENT into a larger string.
Some simple data:
And a simple chart based on this:
The expression used for the labels is:
=Fields!grp.Value & ": " & "#PERCENT{P2}"
Here {P2} is controlling the formatting. You should be able to adapt to your scenario.
Alternatively, for greater control you can just add the relevant % calculation in the label expression; in the above case this would be:
=Fields!grp.Value
& ": "
& Format(Sum(Fields!val.Value) / Sum(Fields!val.Value, "MyDataSet"), "P2")
Which in this case gives identical results to the above.
As explained here, you can use the #LEGENDTEXT chart keyword to write the text that corresponds to the text of the legend item into the label.

google spreadsheet importxml, chop off part of query

I have a simple ImportXml function in Google spreadsheet:
=ImportXml( "http://www.google.com/finance?q=0322.hk", "//span[#class='chr']" )
but it is giving me 2 cells of data, the cell direction underneath it is a =Continue(blah blah)... automatically placed by Google.
Here is the HTML code associated with this page. Looks like it has 2 items. I've replaced "<" & ">" with "(" & ")"
(span class="ch bld")(span class="chr" id="ref_673324_c")-0.45(/span)
(span class="chr" id="ref_673324_cp")(-2.02%)(/span)
How do I change my ImportXml function so that I'm only importing the "-0.45" without the "(-2.02%)?
I've also found that the INDEX command works... useful too if you want the 2nd (-2.02%) item in the results. One important note, though, is that you've got to first transpose the output of ImportXML or it won't work.
=INDEX( TRANSPOSE (ImportXML (...)), {num}) where num is the desired result.
I found a work around... I put =NOEXPAND function infront of it and it works. but if anybody has another solution let me know.