How to Highlight all duplicate occurrences - google-sheets

I'am using this in Conditional formatting:
=if(B:B="","",or(COUNTIF(B:B, B1) > 1, NOT(COUNTIF(B$1:B1, B1) = 1), COUNTIF(B1:B, B1) >= 2))
Can anyone suggest else ?

Select the names dataset (excluding the headers)
Click the Format option in the menu
In the options that show up, click on Conditional
formatting.
Click on the ‘Add another rule’ option
Make sure the range (where we need to highlight the duplicates) is correct. In case it isn’t, you can change it from the ‘Apply to range’ section
Click on the ‘Format cells if’ drop-down and then click on the ‘Custom formula is’ option
In the field below, enter the following formula:
=COUNTIF($A$2:$C$10,A2)>1
From the ‘Formatting style’ options, specify the formatting in which you want to highlight the duplicate cells. By default, it will use the green color, but you can specify other colors as well as styles such as bold or italics.
Click on Done

Hopefully this article can help with your problem:
How to Highlight Duplicates In Google Sheets (Easy Steps)
It provides good information and details on the type of query you are making.
To summarize, the formula =countif($X$1:$R$2,X1)>1 should provide what you are looking for. Where X1 and X2 are the cells you are searching between given that you are looking for duplicates within a single column. This solution is the solution detailed further in section one of the linked article.

Related

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 based on cells matching a column of another sheet

I've got a spreadsheet made on Google Sheets that contains 11 sheets, and each sheet is a set of things that I'm considering buying.
Some sets contain the same individual pieces as something else.
For example item A might be on sheet A and sheet D.
I'd like to make some kind of formula to highlight all duplicates, so that when I was looking through the sheet I could see whether buying item A will help me complete more than just the set that I'm looking at. So I can look at a set and if it's mostly green I know there's more value in buying it as almost all of the contents will also go towards another set.
I know how to do it so that they glow if they match on the same sheet.
$A2=$B2
However I'm not sure how to do it across sheets, or how I'd include if statements. As the colour would have to change if it matches any cells in column A on any sheet. They're also not in the same order on different sheets so while item A might be in A3 on sheet A, it might be in A17 on sheet D.
I'm not sure how possible something like this is, but I'd appreciate any help.
Google Sheets does not allow direct references to cells in other sheets in conditional formatting formulas. But this can be circumvented with indirect:
= A2 = indirect("Sheet2!A2")
formats the current cell (A2) if it's the same as the contend of A2 on Sheet2.
But you want to check whether the content is duplicated anywhere in column A of another sheet. This can be done with match: select the column A2:A of the present sheet, and add conditional formatting with custom formula
=match(A2, indirect("Sheet2!A2:A"), 0) > 0
Here match returns either the position of found element (a positive number) or #N/A, and the formula evaluates to True in the former case only.
Although the formula says "A2", it can be applied at once to any range that has A2 as its upper left corner.

Google sheet - Formating another cell, based on drop-down

I have two columns A and B
I'm trying to format A based on drop-down selection from B
I did:
"Custom formula is": =$B:$B="Waiting"
Background Color: red
Range: A:B
but it does not seems to work unless I write "Completed", in stead of having a drop-down in the B cell.
Does that mean, drop-down is not supported in this case?
https://docs.google.com/spreadsheets/d/1xWijibYk__jHku9UIi4tIjIb607wSbfDbdCj8K2-gt4
Conditional Formatting rules applied to a range work like dragging a formula, adapting relative references.
That means if you want to apply a conditional formatting on A1:A20 if column B is "Waiting" you need to use the rule =B1="Waiting",

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 :)

Format entire row if a particular cell in the row is not empty

I want to format the whole row depending on if a particular cell in that is empty or not. I want conditional formatting to go through all rows and say add a background color if column C in that row is not empty.
How do I fix this?
For illustration assuming "whole row" is ColumnsA:Z inclusive, please try Format - Conditional formatting..., Custom formula is:
=$C1<>""
with formatting of your choice and Range: A:Z.
I was able to do this by selecting the range I want the conditional formatting to apply to (for instance, A:P if you want to apply colour to columns A through P), and then selecting "Custom formula is" and adding =LEN($C:$C)>0. Then you just need to select the colour you want to apply.
The new Google Sheets can do some of this.
Follow the instructions here: https://support.google.com/drive/answer/78413?hl=en
Summary: Format menu => Conditional formatting => "Text contains" drop down menu, select "Custom formula is" => Type "=isblank(C2)" => Add background color => Add range (like: A2:D2)
Although it does not solve completely the question, you will be able to define one rows color based on a cell's value.
Hope it helped.
P.s: While I was testing it I have encountered some bugs in this feature so it may very well happen that it won't be really useful. We'll see...
Adding to pnuts' solution, if you're skipping header rows you need to start the enumeration skipping them, as well.
For Example: If you're skipping 1 row, the new formula would be:
$C2<>""
Little late of an answer but hopefully it will help anyone searching:
=IF(a2="",false,true)
And select your range to format, with A2 being something in the range (not sure if this matters).
Works for conditional formatting.

Resources