How to refer to current cell (or this cell) in conditional format? - google-sheets

I'm in cell T6 and use this code:
=if(isblank(T6),,1)
so basically if it's not empty then convert to 1
example: if the user enters 'hi' or 'test' or 123 or whatever except blank spaces then I want the cell value to be 1
The above code is not working as I get #REF! error. If I refer to another cell, it works fine, but if I refer to the current cell, I got an error. The T6 is the current cell I want to put the script. Can someone show the correct code?

the formula you use is correct. the issue here is that you are creating a circular dependency by referring to a cell from the cell you are in and those happen to be same. the right course of action, in this case, is to use the formula in any other cell than T6 to track the user input of T6.

Related

apps script sheets : First and last non-empty cell of the current row

I'm looking for a script that allows me to find the first nonblank cell of the current row (regardless of which row I'm in).
Once this cell is found, I would like to give it attributes like for example with setBorder.
I would then like to do the same with the last non-blank cell of the current row.
Finally, I would like to give another attribute to the cells in which I have data.
All this on the current row I'm on.
I hope someone can help me :) if I was not clear enough in my request, I remain at your disposal.
I thank you in advance.
good to you.

How do I create a variable with a formula in a cell but when i call it everything that isnt absolute changes its row number to the current row?

This is the formula I wish to call as a variable.
I wish to call this variable within a formula because its used 4 times in a single larger formula. The problem is when I call it, despite it being the same text it doesn't work I suspect because the cell coordinates don't change to the row its being called to, is there anything that can be done?

Referencing cell value in formula vs cell address (for output like =FORMULATEXT()

I created a sheet that outlines what I'm looking for help on, would be so grateful for any help
https://docs.google.com/spreadsheets/d/1pTUgZnAJEnQy5pS3v5X8WrYGQFEwiuxcuk0Q5aC09zE/edit#gid=0
I basically want the output that =FORMULATEXT() gives but I want to reference the values inside the cell vs the cell address. What's the easiest way to do it?
values inside the cell vs the cell address
'=substitute(substitute(FORMULATEXT(E7),"B7","value_1"),"B8","value_2")'
based on my understanding.. this is what you r looking for.. just replace FORMULATEXT() cell address for the next use..
Please share if it works/not/understandable. ( :

How to use ISBLANK and AND operator

I got the 2 cell, and maybe one or another has some value.
I another cell, I want to refer to a third on if the first cell AND the second cell is blank.
So here my try, unsuccesfull:
=IF(AND(ISBLANK(H67),ISBLANK(I67));=G67;"")
So the logical is: if H67 is blank AND I67 is blank, put the value of the cell H67, else put blank string in this cell.
Where i'm making a mistake?
Thkx!
You have a typo. Don't include the = in front of G67.
=IF(AND(ISBLANK(H67);ISBLANK(I67)); G67; "")

Sum of cells above the current one, including any rows inserted later

Now sure there may be better ways to do this but these are just questions of curiosity.
What is the placement of a cell itself called? Its address? Its placement?
Let's say I wanna add all the costs in D26 to D28 and show it in D29(total cell). I can just put in D29
=SUM(D26:28)
but let's say I'm constantly adding rows above under D28 but before D29. So instead I wanna make it so that the total cell can self-identify itself, then find the cell right above it, then add everything from D26 to the cell above the total cell.
=SUM(D26:28)
That is basically what I am trying to achieve.
Please answer if possible in a way that works for google spreadsheets.
This can be done with
=sum(D26:indirect("D"&(Row()-1)))
where indirect("D"&(Row()-1)) references the cell in column D with row number one less than the current row.
"D28" is called the address of a cell (in "A1 format", to be precise). The function indirect takes a string as its argument and returns the reference to the cell with the address given by that string.

Resources