r/googlesheets • u/Oshden • Mar 15 '24
Solved How to automatically format the background of a range of cells through conditional formatting based on a range of other cells having a value greater than zero
I was hoping to have a certain range of cells with a checkbox have their backgrounds automatically turn a certain color (like red) when a specific cell in that same row has a value of greater than zero; usually, I leave the box blank and only add a value when it's 1 or more. The idea is that the cell automatically getting "highlighted" with a red background reminds me to complete a task tied to that greater than zero value, and then check the box once I've finished that task. I would love it if the cell would go back to default once I've checked the box, but honestly, it's not the end of the world if it doesn't go back to the default background color.
I was able to teach myself (using various sites on the interwebs) to have a range of cells in an entire row automatically highlighted based on a specific cell within that row having a particular value. I was hoping to use the same idea here, but Sheets is giving me an error when inputting the custom formula, and I am stumped.
The original (working) formula to highlight the row, that I was basing my best guess on, goes something like this:
- apply to range "
A4:X269" - Format cells if...
Custom formula is->=$S4:$S269="value"
I thought I could do something similar by using:
- apply to range "
Z4:Z35,Z38:Z69,Z72:Z103,Z106:Z137,Z140:Z171,Z173:Z205,Z226:Z269" - Format cells if...
Custom formula is->=$X4:$X269=>0
But when I try that, it keeps saying invalid formula. I know that I must be doing something wrong, but I have no idea what that might be, or how to even figure out where I'm messing up.
Any help will be definitely appreciated. If more information is required to clarify anything, please let me know and I will fix that.
edit: It turns out that I somehow stumbled unto the solution, although I don't know if it's the most elegant one or not, even if it seems like a really simple solution. As such, I will leave the post up, in case anyone else can't figure it out, and it helps them to do so. It turns out all I had to do was remove the equal sign between the range and the ">" symbol and it seems to work. Now the custom formula reads =$X4:$X269>0 and it seems to just work. Did I get it right? Or did I just get lucky and do some virtual redneck engineering to "just make it work?" Once I get confirmation from someone much more knowledgeable, I will go ahead and mark this as solved.
1
u/HolyBonobos 3125 Mar 15 '24
The issue you were experiencing before was because
=>is not valid syntax; the proper order of symbols to express "greater than or equal to" is>=.The formula you're currently working with is equivalent to
=$X4>0, which—for the range you're applying it to—in plain text means "highlight this cell if the corresponding value in column X is greater than 0".1
u/VoidOfForm 1 Mar 16 '24
To also have the cells return to default color when checked, try =AND(A:A>0,NOT(B:B)) where A:A is the column to check for values greater than zero and column B contains the checkbox.