Dynamic Conditional formating based with a custom formula - google-sheets

Ok, it's a bit of a head scratcher for me.
I am working on a work load spreadsheet and I need to highlight people with different colours depending on their workload so that I could see at glance who's loaded too much and who still has capacity.
Capacity number is just a number of project she or he can handle can be 3 to 5. I store this data in a separate sheet "Resources".
3 colours of load are enough
The problem I am facing is conditional formatting in GS doesn't support pulling data from a separate sheet. Id' rather keep all the raw data outride of the main Overview sheet. But if it's impossible maybe helper columns next to each group of workers would work as well
However, it's important be able to copy the whole row and paste at the end for new projects.
Plus I have difficulty to figure out how to create a formula that works for all names, rather than creating colour conditions for each single name.
Any suggestions?
Here is an example spreadsheet of table and bellow what I envision it should like. I need to be able to see in the Overview sheet at glance who's at their capacity. So as you can see Bobbie is on 6 projects, so he has to be RED. Tom is only on one project and the colour should be something like blue or green. Hope that makes sense https://docs.google.com/spreadsheets/d/12hJlsH8PndCYrrhgCoL5oUghHQMLL1bgIWomSpEfdEA/edit?usp=sharing

Okay, I think I found a way to do this. However, it needs a couple of Conditional format rules if you want to do a kind of gradian.
The good thing is that it will not require to be linked to a name. Even if you change the names, it will not affect it.
The rule will look something like this:
The one that has a capacity of up to 5 will look like this after adding the rules:
For the ones for developers, I added the 3 columns at the same time, so the formula takes the 3 columns for the capacity count.
I edited the Sheet called "Copy of Overview." I added the formatting for the C and D columns.
Reference:
Use conditional formatting rules in Google Sheets

Quick fix
Try this if you want the conditional formatting done in Resources tab.
Adjust the minpoint and maxpoint in Conditional format rules pannel accordingly
Helper table
Paste this formula anywhere to get the helper table with the count of each worker occurrence in the range C2:F
= ArrayFormula({
"Name", "Work Load";
FILTER(UNIQUE(FLATTEN(Overview!C2:F)),UNIQUE(FLATTEN(Overview!C2:F))<>"",UNIQUE(FLATTEN(Overview!C2:F))<>"-"), IF(
FILTER(UNIQUE(FLATTEN(Overview!C2:F)),UNIQUE(FLATTEN(Overview!C2:F))<>"",UNIQUE(FLATTEN(Overview!C2:F))<>"-")="",,
COUNTIF(FILTER(FLATTEN(Overview!C2:F),FLATTEN(Overview!C2:F)<>""), FILTER(UNIQUE(FLATTEN(Overview!C2:F)),UNIQUE(FLATTEN(Overview!C2:F))<>"",UNIQUE(FLATTEN(Overview!C2:F))<>"-")))})
Conditional formatting & formulas - Simple
Similar to Giselle Valladares, answer "2022-08-12 22:00:41Z"
Simple but have a Limitation: a single white space is also highlighted
Color "Formatting style"
Apply to range
Formula
Green
C2:G
=COUNTIF(C2:F,C2)=1
Blue
C2:G
=COUNTIF(C2:F,C2)=2
yellow
C2:G
=COUNTIF(C2:F,C2)=3
Red
C2:G
=COUNTIF(C2:F,C2)>=4
Conditional formatting & formulas - Complex
Try this
Color "Formatting style"
Apply to range
Formula
Green
C2:G
=ArrayFormula(REGEXMATCH(Overview!C2:G23, TEXTJOIN("|",,FILTER(FILTER(FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-"),FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")<>""),FILTER(IF( FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")="",, COUNTIF(FILTER(FLATTEN(Overview!C2:G),FLATTEN(Overview!C2:G)<>""), FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-"))),IF( FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")="",, COUNTIF(FILTER(FLATTEN(Overview!C2:G),FLATTEN(Overview!C2:G)<>""), FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")))<>"")=1))))
Blue
C2:G
=ArrayFormula(REGEXMATCH(Overview!C2:G, TEXTJOIN("|",,FILTER(FILTER(FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-"),FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")<>""),FILTER(IF( FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")="",, COUNTIF(FILTER(FLATTEN(Overview!C2:G),FLATTEN(Overview!C2:G)<>""), FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-"))),IF( FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")="",, COUNTIF(FILTER(FLATTEN(Overview!C2:G),FLATTEN(Overview!C2:G)<>""), FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")))<>"")=2))))
yellow
C2:G
=ArrayFormula(REGEXMATCH(Overview!C2:G, TEXTJOIN("|",,FILTER(FILTER(FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-"),FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")<>""),FILTER(IF( FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")="",, COUNTIF(FILTER(FLATTEN(Overview!C2:G),FLATTEN(Overview!C2:G)<>""), FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-"))),IF( FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")="",, COUNTIF(FILTER(FLATTEN(Overview!C2:G),FLATTEN(Overview!C2:G)<>""), FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")))<>"")=3))))
Red
C2:G
=ArrayFormula(REGEXMATCH(Overview!C2:G23, TEXTJOIN("|",,FILTER(FILTER(FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-"),FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")<>""),FILTER(IF( FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")="",, COUNTIF(FILTER(FLATTEN(Overview!C2:G),FLATTEN(Overview!C2:G)<>""), FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-"))),IF( FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")="",, COUNTIF(FILTER(FLATTEN(Overview!C2:G),FLATTEN(Overview!C2:G)<>""), FILTER(UNIQUE(FLATTEN(Overview!C2:G)),UNIQUE(FLATTEN(Overview!C2:G))<>"",UNIQUE(FLATTEN(Overview!C2:G))<>"-")))<>"")>3))))

The problem was:
First, you applied your conditional formatting to whole columns when your first row is a header.
Second, your NB.SI formulas had the same problem as the first one but also you didn't lock your ranges with "$".
So for managers, the formula must apply to the range C2:C (not C:C) and be written like that:
=NB.SI($C$2:$C,C2)>5
The ">5" must be modified according to the colors you want.
For the Designer, you can add the function "IF" to the formula as Daniella has more capabilities like this:
=SI($G2<>"Daniella";NB.SI($G$2:$G,G2)>3,NB.SI($G$2:$G,G2)>4)

Related

Conditional formatting based on a range of names

I'm trying to make conditional formatting that changes the color of a cell (Red, Blue, Green) based on a range of names on a different sheet. What I have is three lists of names that are either Red, Blue or Green. When I make a list with these names on a separate sheet I want the formatting to change their color to the ones assigned.
The formatting I want to make is something along the lines of "IF the value (name) in this cell is the same as the value (name) in any of cell in a range on another sheet it should change the color automatically.
Here is a link to a sheet where I tried to set it up they way I wanted it to look but I still can't get the formatting to work
https://docs.google.com/spreadsheets/d/1i1DM8X6gyRNMUmYBAtuupeuCUA1iB4LhMDwkD7PHi8w/edit?usp=share_link
I was trying the conditional formatting tool with formulas but I kept getting errors with the formulasenter image description here The picture is in Swedish because google sheets would keep defaulting back to it regardless how much I tried.
One thing is that Conditional Formatting doesn't allow you to directly refer to another sheet. You can do work it around via INDIRECT.
And to compare to several texts, you should not choose the option text contains, but you can find useful REGEXMATCH and TEXTJOIN:
=REGEXMATCH(A2;TEXTJOIN("|";1;INDIRECT("'Name sheet'!A2:A11")))
=REGEXMATCH(A2;TEXTJOIN("|";1;INDIRECT("'Name sheet'!B2:B11")))
=REGEXMATCH(A2;TEXTJOIN("|";1;INDIRECT("'Name sheet'!C2:C11")))

Google sheet formula =$G1=

I am trying to go get the conditional formatting to color the entire line, based on a text answer.
I have used "custom formula is" and =$G1=TRUE before, where I have a tickbox, so I tried to change the formula to =$G1=JA but this did not work.
I have a drop-down menu in column G with options JA - NEI - KANSKJE that I want to use the formula on, to color out the entire line.
I want green lines if JA, red lines if NEI etc.
Note: the words are yes, no & maybe in Norwegian
Try
=$G1="JA"
and see if that works?

Highlight cells a different colour for each number of occurrences of a string

I have a sheet where we choose what people will be assigned to each job. The job assignment will be on "Sheet" (in my sample spreadsheet). I would like the list of people on the "Pick List" sheet to be highlighted a different colour for every time they are assigned in "Sheet" more than once. I would like one assignment to be green, 2 assignments to be yellow, and 3 or more assignments to be red. I have attached the sample spreadsheet where I have tried a few solutions that are not working. Any help is greatly appreciated.
Sample Spreadsheet
The easiest way to do this is with conditional formatting.
On Sheet, select A1.
Right click and select conditional formatting.
You will need three rules. They will all be custom formulas (find under format cells if).
First enter =countif(A:A,A:A)=1 in custom formula is. Apply to range should be A1:A. Set formatting style to Green. Click Done.
then click add another rule. Custom formula will be =countif(A:A,A:A)=2. Apply to same range. Formatting style to Yellow.
Add another rule =countif(A:A,A:A)>=3 for Red.
You really don't need Pick List unless you just want to validate against it. If you do want to validate, you can
right click A1.
choose Data Validation and enter your Pick List range 'Pick List'!A1:A.
Drag A1 Down in Sheet.

Conditional Formatting with lots of data

Anyway, I have a table in Google Spreadsheets that has a set of rows which each contain a name (Column A) and two Yes or No values (Columns G and H).
I would like a way to conditionally format the rows. I have been trying to learn the formatting but I feel this is well out of my league. The way I would like it all to be formatted is only in Column A. If G says "Yes" and H is empty, then yellow. If G says "Yes" and H says "No", red. If G says "Yes" and H says "Yes", green.
If it helps, here is a chart:
G H
Y -- Yellow
Y N Red
Y Y Green
An explanation of how it all works would also be much appreciated but if you only have the solution on how to do it, I will gladly take that.
METHOD 1 - Conditional Formatting Only
The easiest way to do this, using Conditional Formatting is as follows:
Select "Format >> Conditional Formatting":
These IF statements will be used color the cells Yellow, Red, and Green, respectively.
=IF(AND(G2="Yes",H2=""),"True")
=IF(AND(G2="Yes",H2="NO"),"True")
=IF(AND(G2="Yes",H2="YES"),"True")
METHOD 2 - New Column, using f(x), and Conditional Formatting
The code used to generate the text "Yellow," "Red," and "Green" is as follows (broken up in 2 lines only for easier readability):
=IF(AND(B2="Yes",C2=""), "Yellow",IF(AND(B2="Yes",C2="No"), "Red",
IF(AND(B2="Yes",C2="Yes"), "Green")))
This is a nested IF statement that will examine your "Yes"/"No"/null column cells. This statement looks for the conditions you specified and returns either "Yellow," "Red," or "Green" in a separate column.
Since your IF statement will output either "Yellow," "Red," or "Green," all you'll have to do is set your Conditional Formatting to look for these words and color the cell accordingly.
A great resource to learn more is the Google spreadsheet function list.
I've got it for you. It can be made using the conditional formatting in Google Sheet.
A Screen Shot attached
Right click your cell A, apply conditional formatting
Just apply it across your range in column A1:A500 something
and choose the "Format cells if..." and choose custom formula
(Just click Add another rule after each one so you don't have to repeat the range)
=IF(AND(G60="Yes",H60=""),"True") //Change the color to Yellow
=IF(AND(G60="Yes",H60="No"),"True") // Change the color to red
=IF(AND(G60="Yes",H60="Yes"),"True") // Change the color to green
You will have 3 rules of conditional formating
replace G60 and H60 with the starting row number
Edit ------------------ Forgot to add the explanation
The formula
IF(AND(G60="Yes",H60=""),"True")
"IF" is to check IF something is this or not. I added the "AND" so that we could put in 2 condition, since we need both conditions to be satisfied. and therefore the formula above in written form would be
IF(IF) BOTH(AND) G60 and H60 is "Yes" and "Empty" respectively, then it is True. So it will become the color I chose.
There might be another way to write the codes but this works :)

Google Sheets Conditional Formatting based on two cells

I have a sheet where I would like to turn a row a color based on the value of two cells. I already have conditional formatting based on one cell of the cells I want to use for the two cell formatting.
I am using =AND($J:$J="Cancel",$L:$L="Yes") for the two cell formatting but it doesnt seem to work. Not sure if the first one =$J:$J="Cancel" is negating the formatting of the other or if if my formula is just bad.
Any advice would be appreciated.
if the trick is that you want the whole row to be colored that way, then all you need to modify is the "range" to apply it too, so you enter something like the start column and then just give it a row number as the second half of the range, without the column argument: A1:10001
That exact formula you listed =AND($J:$J="Cancel",$L:$L="Yes") worked for me when using the "custom formula" option:

Resources