Google Sheets Countif function does not highlight the whole row - google-chrome

The Condition formatting 'Countif' did not highlight the whole row even adding $.
=Countif($H$3:$H$9,H3)>1
Did I miss something?
Thanks.

Apply to range: H3:I10
Formula: =Countif($H$3:$H$10,$H3)>1

Related

Change text in a negative number in Google sheets with apps Script

From an export file I get the following data in a column.
€9,08
€ 8,67-
€6,82
€10,87
€ 7,23-
The negative ones are text and the positive ones are numbers.
I want the text rows to be a negative number.
Can someone help me how I can solve this. Thank you very much for the help.
GJM
Select the column and try to replace with RegExp:
If you want a script, for the simplest case it could be this:
function myFunction() {
SpreadsheetApp.getActiveSheet()
.getRange('A:A')
.createTextFinder('(.+?)(-)')
.useRegularExpression(true)
.replaceAllWith('$2$1');
}
It will make the same changes in column 'A'.

using formulas and hyperlink in the same cell

So the main idea is I want to put a Hyperlink on a cell that contains a formula, But google sheet don't like that.
I had 2 ideas.
1- Put the formula in cell A1 and the output of that formula is dumped into cell A2 which is gonna be Hyperlinked.
(I tried to use FILTER to pull data into the Hyperlinked cell but it would give me a #REF! error:Array result was not expanded because it would overwrite data in A2.)
2- Use some sort of apps-script of which I have very little understanding of, so I didn't find any scripts relating to my question.
I didn't understand the reason why you can't put a Hyperlink AND a formula in the same cell, But as far as I understood:
Hyperlink is a formula it self → =HYPERLINK(url, [link_label])
So instead of Hyperlinking our cell using the UI, we can use the formula form to Hyperlink the cell and use our formula in the place of [link_label] which is gonna be the name of our cell:
=HYPERLINK( url , [link_label])
=HYPERLINK("google.com", SUM(B2:B5 ))

How to use cell value instead of number

Im sorry I dont even know how to correctly phrase this question.
The line of code I need to edit is this;
sheet.getRange(targetcell).setValue('=INDEX(QUERY(IMPORTHTML("http://www.futbin.com/consumables/Position%20Change","table",2),"select Col2"),1)');
However instead of row 1, I want to use the value from cell G1. So, something like this;
sheet.getRange(targetcell).setValue('=INDEX(QUERY(IMPORTHTML("http://www.futbin.com/consumables/Position%20Change","table",2),"select Col2"),G1)');
However, this throws an error.
Could anyone advise how I can use the value in G1 instead of it being fixed?
Thank you.
Try .setFormula instead of .setValue ...
sheet.getRange(targetcell).setFormula('=INDEX(QUERY(IMPORTHTML("http://www.futbin.com/consumables/Position%20Change","table",2),"select Col2"),G1)');
If there were a column G from the table that results from that IMPORTHTML function then you would use this:
sheet.getRange(targetcell).setValue('=INDEX(QUERY(IMPORTHTML("http://www.futbin.com/consumables/Position%20Change","table",2),"select Col7"),1)');
Because G is column 7
However, there is only 3 columns from that IMPORTHTML. You can check this by entering the formular into a Google Sheet:
=IMPORTHTML("http://www.futbin.com/consumables/Position%20Change","table",2)
I suggest playing around with your formula in SHeets and once you've got what you want, go back into AppsScript.

Set default value after form submit in google sheets

I want to set a cell to a default value as soon as a form is submitted to a spreadsheet (I want to add a value after the last value from that the spreadsheet gives me).
Since upon a form submit it erases all the values in the row, I can't have a formula in this cell, I think I'd have to do it with AppScripts.
I tried doing it with onFormSubmit but I did not get very far with it. Is there a way to do this?
If the formula is going to be the same for each row, you could add an ARRAYFORMULA version of your formula in the second row of your Responses sheet. By putting your formula in the second row you can still add a header to that column.
For example, if you wanted to get the first three characters of whatever is in Column B, in the second row of the column you want your formula in (in your Form Responses sheet), you could use:
=ARRAYFORMULA(IF(B2:B="","",LEFT(B2:B,3)))
If it's just a default value you want in that column, then use something like this:
=ARRAYFORMULA(IF(B2:B="","",your_default_value))
Good luck!

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.