Highlight entry if not 17 numeric digits - google-sheets

Basically, I'm part of a community and when someone applies for membership, they have to provide a Player ID in their application. When we accept their application, we copy information into a Google Spreadsheet about them such as Player ID's and GUID. We want a way of indicating on our spreadsheet if the Player ID is incorrect. If the number put in is less than 17 digits in length or is any bigger, it would indicate that it's wrong by either formatting the cell to be a light red or it being replaced with "ERROR". I just need something that would indicate if it's incorrect.

Go to Format tab in the google spreedsheet, then go to Conditional Formatting, then in the Apply to range box, put down your range, say A1:A30 the range where you want to apply your formatting. Then, in the Format cells if, choose Custom formula is, the last one in the dropdown list. Then put this formula in the formula box just below it:
=and(not(len(A1)=17),not(isblank(a1)))
then in the formatting style, choose any color that suits you. Then click DONE. It should work!
Update
in a helper column, say column B, you can put this formula in B1 and copy down until the last row:
=If(isblank(A1),"",(IF(LEN(A1)=17,"OK","ERROR")))
this should work

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

Issue with conditional formatting cell range based on exact match text in one cell

We track workshop registrations in a google sheet and I'm trying to conditionally format a range of cells (A7:P14) based on the text in cell E7 (Eng DLO, Eng TBC, Sp DLO, Sp TBC).
I used the formula
=COUNTIF($E7:$E, "Eng DLO")
and A7:S14 turned the selected color (light purple). When I then added conditional formatting to turn dark purple with the formula
=COUNTIF($E7:$E, "Eng TBC")
the color wouldn't change when I changed the value in E7 from Eng DLO to Eng TBC.
I know the issue is that I need it to EXACTLY MATCH the text and I tried incorporating EXACT into the COUNTIF formula, but it would only highlight E7 or just A7:P7 instead of the whole selected range in the conditional format (A7:P14).
Here is a sample sheet with what I am hoping it will eventually look like once I get the conditional formatting to actually work (I removed the conditional formatting). https://docs.google.com/spreadsheets/d/1Bn9FVTHE1OO49p4PKo6j0Qd3c0NX6pUq3vp0pHFNGVI/edit?usp=sharing
Got a couple other issues here:
The 7 is a floating reference, so you need to fix it with $. This is the reason your formula isn't working. In the next row, it would start counting in cell E8. With the $, it works, but less efficiently than it could, which brings me to point 2.
If you're only referencing one cell, just check for equality against that one cell.
To the Eng TBC, you would use
=EXACT($E$7, "Eng TBC")
Just to demonstrate a point, without the dollar sign, the next rows cells would have been checking against this:
=EXACT($E8, "Eng TBC")
Which of course would have been empty.
A More Flexible Solution
Since you probably don't want to keep having to reformat per set of cells, you can use a ROW-based approach to tackle the issue. This one, for example, assumes 8 seats per group.
=EXACT("Eng DLO",INDIRECT("E"&(8 * INT((ROW() - 7) / 8) + 7)))
Every 8 rows, it references the next multiple of 7. (Yes, INT is FLOOR, but shorter.)

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.

How to alternate colors based on first column of google sheet

So I have a spread sheet that has a bunch of data in it... The first column is the state, second is a name. What I want to do is have the rows alternate blue/red/blue/red (to make it easy to read) but I don't want it to alternate EVERY row like evens/odds. What I want is for each state to have a different color. So all the rows with AL blue, then CA red, CT blue, etc... This is just a basic example. Obviously here I could just hardcode the 50 states, but is there any way to automate this process so that basically every time the state changes, I switch colors?
State Name
AL John
CA Bill
CA Joe
CA Chad
CT Mary
VA Beth
VA Dani
In Google Sheets you can count how many unique names there are down to the current cell and test if it's an odd number
=isodd(countunique(A$2:A2))
Apply this to the range as a custom formula in conditional formats with the first fill colour.
Then apply
=iseven(countunique(A$2:A2))
as another rule with the second fill colour.
In Excel it's more difficult to do this, would end up with something like
=ISODD(SUM(--(FREQUENCY(MATCH(A$2:A2,A$2:A2,0),MATCH(A$2:A2,A$2:A2,0))>0)))
and
=ISEVEN(SUM(--(FREQUENCY(MATCH(A$2:A2,A$2:A2,0),MATCH(A$2:A2,A$2:A2,0))>0)))
Note this only works if the data is sorted by state as in your test data.
You can use Format as a table with the following procedure:
Open the worksheet.
Select the cell range that you want to shade, or
press Ctrl+A to select the whole worksheet.
Click the Home tab.
In the Styles group, click Format as Table, and then click the style of
formatting that you want.
In the Format as Table dialog box, click OK.
Also, as an alternative you can use Conditional Formatting.

How to duplicate (not extend) conditional formatting rule?

I have a conditional formatting rule (color scale) applied to a row (e.g. A1:Z1). I want the to duplicate this rule for another row, but when I use Paste Special -> Paste Conditional Formatting Only (or Paint Format tool), it simply makes the color scale rule to apply to the sum of ranges (e.g. A1:Z2). The problem is that it won't process ranges separately, it will just join them into a single range and find the biggest / smallest number over the joint range, rather than in individual ranges.
The same applies if the range is defined in format "A1:Z1,A2:Z2".
What I want is just to avoid defining the same color scale rule for different rows manually.
Note that Google Sheets behaves here differently from MS Excel. In Excel I get the desired behaviour very easily and intuitively: I create a rule for a row, select it, copy, then paste special formatting only. For a scale from smallest red to biggest green, this is the output:
!Excel colour scale example]1
If I do the same steps in Google Sheets, the output is quite different:
It is clear that GS does not duplicate a rule, but simply adds a new range to the computed joint range the original rule applies to.
Is there a way in GS to do the same conditional rule duplication that Excel does, or I just have to re-create it manually?
Click any cell covered by the original conditional formatting
In the menu, pick format/conditional formatting...; this opens a side panel with all conditional formats that apply to that cell
Click the format you want to duplicate
Do not edit anything yet
Click "Add another rule" on the bottom. This will save any changes you made to your original format ... and open a new clone.
Change the range on the newly created clone.
Repeat 5 and 6 until you enter the last range
Click "Done".
I am not saying I LIKE this answer, but it is the only solution I can come up with:
Apply Custom Formatting using a Custom formula for each color value. In your example, this means 6 entries in the Custom Formatting. For each one, use the below formula. For the Highest value, use:
=A1=LARGE($A1:$G, 1)
For the second highest value, use:
=A1=LARGE($A1:$G, 2)
Increment the last number for each ranking, setting a color for each as well. I hope your range to Z does not mean you are color coordinating that many items. My concern there would be not just having that many conditional format items, but having that many colors be meaningful.
There is also the MAX() and MIN() functions if you just want the highest and lowest.
=A1=MAX($A1:$G)
or
=A1=MIN($A1:$G)
as well as MEDIAN() and SMALL() which is the opposite of LARGE(). In case you want the X largest and Smallest, or Maximum, Minimum, and Median.

Resources