How to highlight duplicate values in a sheet that appears in another sheet - google-sheets

I know how to apply conditional formatting if there are duplicate values in a column and I know how to use a formula to that references values from multiple sheets; however, what I want to do is apply formatting to a value if it is a duplicate in another sheet.
Example: I have sheets "friendlies", "healthcare", "IT" and "marketing" that contain names and contact information. Email addresses are always in column E.
Occasionally someone gets moved from a vertical, healthcare for instance, into the friendlies sheet.
When someone gets added to the friendlies worksheet, I want their email cell (in column E) in the friendlies sheet to turn red to remind me to remove them from the healthcare sheet.
Is it possible create a formula that looks to another sheet for a duplicate? I tried the below with no luck:
=countif(Healthcare!E:E,E1)>1, as well as =countif(Healthcare!E:Healthcare!E,E1)>1 and then finally =countif(Healthcare!E:Healthcare!E,Healthcare!E1)>1
Does anyone have any insights to help?

Presumably in connection with security, conditional formatting across sheets can be a bit of a rigmarole but the CF formula rule is very simple if you are prepared to make use of a helper column.
Taking a similar approach to what you tried, the helper column, say F should be populated with, in say F1, and copied down to suit:
=countif(healthcare!E:E,E1)+countif(IT!E:E,E1)+countif(marketing!E:E,E1)
Then it is just a matter of selecting ColumnE in friendlies and Format - Conditional formatting..., Custom formula is and:
=F1>0
with selecting red formatting of choice and Done.
An alternative to a helper column is to apply named ranges and INDIRECT:
=countif(indirect("hMail"),E1)+countif(indirect("imail"),E1)+countif(indirect("mMail"),E1)
hMail for example the name for ColumnE in healthcare.

Related

Unique Filter multiple sheets with ArrayFormula

I have no idea how to title this post, apologize in advance.
I have several sheets with a number in Column I and a name centered and merged in columns A:H. I want to obtain the name from A:H of the corresponding value within I but do have duplicates, therefore I need the nth value when permitted. The formula I have so far works up to the point it does not autofill down as an ArrayFormula, so when I drag the formula down I get an #REF! error due to the fact that when a duplicate is found it cannot overwrite the formula below.
This will be easier to showcase: LINK TO SHEET.
Essentially, in the main sheet all the values in I:I of all the other sheets are obtained and sorted, then using that column I want to return the name that corresponds to the value, allowing for duplicates to work themselves out. I believe my issues resides in the $B1 part at the end of the formula preventing it from being an array.
=ARRAYFORMULA(UNIQUE(FILTER({Sheet2!$A$1:$A;Sheet3!$A$1:$A;Sheet4!$A$1:$A},{Sheet2!$I$1:$I;Sheet3!$I$1:$I;Sheet4!$I$1:$I}=$B1)))
Cell F2 on the Sheet1 tab:
=QUERY({Sheet2!A:I;Sheet3!A:I;Sheet4!A:I},"select Col1,Col9 where Col9>0 order by Col9 asc",0)
You can read more about query here.

I am trying to use vlookup as a conditional formatting formula

I have a Google sheet that has a roster of people. I want the sheet to automatically color code people on the roster tab that are also present on a second tab that lists people who have dietary restrictions. I thought that conditional formatting would be the way to go, but I can't get the formula to work. I also can seem to get the conditional formatting formula to be relative based on the row. This is the formula that I have so far. A5 is the first cell that contains the person's ID number. The ID numbers are listed in column A on the "Dietary Restrictions" sheet.
=NOT(ISNA(VLOOKUP(A5,'Ghost Students'!A:H,1,FALSE)))
You want to highlight values from A5:A in one sheet (let's call it Roster) if they are present in column A from another sheet (Dietary restrictions).
Since conditional formatting formulas cannot reference other sheets, you have to use INDIRECT in order to reference that.
You can then use MATCH to check if the value is present.
Your formula could be like this:
=MATCH($A5,INDIRECT("'Dietary restrictions'!A2:A"),0)
Output:
Sheet Roster:
Sheet Dietary restrictions:
How about making vlookup formula grabbing data about dietary conditions from another sheet, and then putting conditional formatting.
You can hide information about dietary conditions if you want and apply conditional formatting based on hidden column:
Just tried. Conditional formatting works with hidden columns too.

Condition Formating, how to highlight a cell when it dosn't include text in a list

Good Day
I am wondering what custom formula i should use in condition formatting to highlight a cell when it doesn't include a "part name" i have in a list on sheet2
I want Cell A4:A1000 to turn orange when the text in the cell next to it "is not" on a list in Sheet 2 A2:A100
let me know what additional information you need... sorry
Im currently stuck with something like this....:
F4=indirect('Auto Fill'!A2:A343)
but i need it to not be on the list... which is something that's missing from this formula as well... so maybe:
F4= ISNOT indirect('Autofill'!A2:A343)
This is the inverse of your request - I'll leave it as an exercise to the reader how one would get the opposite.
Basically, you want check if the value of some cell is in the list of valid values. If you were computing this as a sheet value, you would use =COUNTIF. For conditional formatting, the same applies:
=COUNTIF({LOOKUP_RANGE_ABS_REF}, {VAL_TO_CHECK})
=COUNTIF($D$2:$D, B2)
Here's the formula in action:
Note that T-3000 and wheels are not in the "Part List" column, and thus do not match.
Comparing to different worksheet within same workbook
If the data to be compared against is not in the same worksheet, the range reference {LOOKUP_RANGE_ABS_REF} must be wrapped in a call to INDIRECT(), i.e.
=COUNTIF(INDIRECT("{OTHER_WORKSHEET_NAME}!{LOOKUP_RANGE_ABS_REF}"), {VAL_TO_CHECK})
=COUNTIF(INDIRECT("some sheet name!$A$2:$A"), B2)
As per official documentation,
Formulas can only reference the same sheet, using standard notation "(='sheetname'!cell)." To reference another sheet in the formula, use the INDIRECT function.
This is also noted in several other SO questions (albeit using different core formulas besides COUNTIF):
https://stackoverflow.com/a/25753889
https://stackoverflow.com/a/28910087
https://stackoverflow.com/a/36684815
https://stackoverflow.com/a/37634170
(I'm sure there are more.)
Missing from those answers is the caveat that the indirection you've just added is not robust to changes to the value of {OTHER_WORKSHEET_NAME}, e.g. you (or some other editor) changed the actual name of the worksheet.
Unlike traditional entered-on-the-worksheet formulas, there is no "run-time" reference link that will update the static text value you had to enter when you created the Conditional Format rule. This lack of reference-updating is actually one of the useful features of INDIRECT(), so don't expect it to ever change.
Furhtermore, the reference break will not be immediately evident. Any items that were added to your formatted range after the name change had their format computed using the broken reference, but any items added before the name changed will keep their current format. Only when the actual range that is wrapped by INDIRECT is edited will any pre-existing conditional formats be recomputed. Thus, you may not notice that the sheet was renamed until you add a new valid part to the list.
Quick kludge, import what you need (I gave it the name List) from sheet2 (you'll have to grant permission), Select ColumnA and apply a CF formula rule of:
=and(A1<>"",iserror(match(B1,IMPORTRANGE(" k e y ","List"),0)))

Highlight if cell exists in a range in other sheet

I'm trying to highlight a row (or cell, if that's easier) if that value exists in a range in an other sheet in the same document.
Details: In Google Sheets, I have one sheet named "Application", with email addresses in column D. In a different different sheet (named "Accepted") I have the same data copied from the application sheet, also in column D.
I want to highlight the cells with email addresses in the "Application" sheet which has been copied over to the "Accepted" sheet.
I know Conditional formatting with Custom formula is the way to go, but I'm unable to find the correct syntax.
What is the correct formula for this?
In Google Spreadsheets conditional formatting across sheets is not nearly as straightforward as within a single sheet, because of security and therefore authorisation. You may, for speed for example, prefer to copy the content of Accepted into Application to avoid that issue, or write a script instead. At least keep the ranges as small as practical.
However it is possible, though may be slow and require authorisation.
Please clear any conditional formatting from Application ColumnD then:
Select ColumnD in Application, Format, Conditional formatting..., Format cells if... Custom formula is and
=COUNTIFS(IMPORTRANGE("k e y","Accepted!D:D"),D1)>0
with highlighting of your choice and Done.
k e y above represents the unique identification code for Accepted (will look something like 1u4vq8vDne-aKMVdJQPREGOxx7n99FqIb_kuJ_bG-PzM).

Format cells based on current value and another one

Sheet regarding this question.
I have a set of sheets where each person must use a drop down box to select a house they would like to view. We can easily add a house to the list by inserting the address, and a URL into the "houses" sheet and it will be shown in the dropdown list and the results table.
Everything works so far, but if a house becomes unavailable, I want to mark it unavailable on the "houses" sheet, and then all occurrences of that specific house in the dropdown cells and results section should have a red background.
I could use conditional formatting, but this would require me to apply a different formula to each cell and that wouldn't be practical.
I regret not elegant but I think your layout is not well suited to Google Sheets' strengths. The best I can suggest is in say J2 of sheet Choices:
=vlookup(B2,Houses!$A:$C,3,0)
copied down to J30 and J2:J9 copied across to ColumnN. Then select Choices ColumnsB:F and Format - Conditional formatting..., Custom formula is and:
=J1="No"
with formatting of red background Done.
You might want to hide columns J:N.
You should just use conditional formatting.
Step 1: Select Cell B2, go to conditional formatting and create a new rule, "Use a formula to determine which cells to format".
Step 2: Use the following formula:
=VLOOKUP(B2,Houses!$A$3:$C$42,3,FALSE)="No"
Note: This B2 value since it isn't using $, moves dynamically depending on what cells your formula is applied to. The VLOOKUP looks up the B2 value in the depicted range and returns the 'Available' column (column 3 on the Houses sheet). We're matching on "No" specifically, I believe its case sensitive so watch out for that caveat.
Step 3: Set your format to Red.
Step 4: Make sure your 'Applies to' box is pointed to the following range:
=$B$2:$F$9
Personally I hate hard coded ranges like these, you should look into dynamic named ranges. That way you can just reference a named range instead of the A3:C42 range for both your Data Validation dropdown as well as these formulas.

Resources