format rows in google sheets based on conditional range - google-sheets

I have a data set with 77 rows. One of the columns (let's call it C) contains a name value. I would like to highlight the row if the name in column C is found in a list of names in another column.
Currently, I'm able to check only a single value, instead of a list of values. In conditional format rules, I'm able to enter the following formula
=$C:$C=$GU$1
This, of course, only checks the value against the first name in column GU. I tried to add :$GU$100 to the condition, but that won't work as the condition is now checking if the entry is the same as the entire value from GU1:GU100.
I thought I might try to use a FIND() method to see if the substring were in the larger string. To do that, I attempted the following:
=$C:$C=IF(ISNUMBER(FIND($C$1,$GU$1:$GU$100)),1,0)
While this did not return an error, it also did not highlight any rows. I'm unsure how to format one row based on whether or not the value in that row is an entry in a list elsewhere. Any ideas?

Please select your 'entire row' range (here assumed ColumnsA:G) and Format, Conditional formatting..., Format cells if..., Custom formula is:
=match($C1,$H:$H,0)
choose your Formatting style and Done. Where ColumnH is assumed to have your list.

You can add conditional formatting like this with the custom function option and applying to column C, pretending that the list with names your matching against is in column J:
=IF(ISTEXT(VLOOKUP(C1:C,J:J,1,false)),TRUE,FALSE)

Related

Lookup and fetch multiple delimited partner names

I have list of partner name codes, delimited by space. Like the one shown in below,
I have another table(E:F), from where I have to map them to show the partner names like the column C, perhaps i am not able to understand how to make it happen,
I have tried using this formula which brings only one partner name but when there are multiple it does not shows up, do i need to add another function like TEXTJOIN or what I am doing wrong here.
=IFERROR(VLOOKUP(IFERROR(REGEXEXTRACT(A2,JOIN("|",FILTER($E$2:$E,$E$2:$E<>""))),""),$E$2:$F,2,0),"")
Link To GS
See my sheet ("Erik Help"). The following formula is in cell B1:
=ArrayFormula({"PARTNER NAMES";IF(A2:A="",,REGEXREPLACE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IFERROR(VLOOKUP(SPLIT(A2:A," ",0,1),D:E,2,FALSE)&",")),,COLUMNS(SPLIT(A2:A," ",0,1))))),",$",""))})
This one formula produces the header (which you can change within the formula itself as you like) and all results for all rows.
IF(A2:A="",,...) means if a cell in Col A is blank, then the result in the same row of Col B will also be blank (i.e., null).
SPLIT (the first time in the formula) will split the Col-A values at the spaces.
VLOOKUP will try to find each split value in the D:E list. If found, the full name will replace the initials. If not found, IFERROR will return null.
You will see &",". That is appending a comma to any full names that are returned.
TRANSPOSE(QUERY(TRANSPOSE...),,COLUMNS())) is what many call "QUERY Smash." It basically, flips the remaining results of the VLOOKUP into columns instead of rows, turns everything into headers (to get them in one cell per column) and then flips them back to row orientation.
TRIM gets rid of spaces where no names were found in the full list.
REGEXREPLACE(... ,",$","") replaces any final comma that has no name after it with null.

Last value of a column in Google Sheets

I was trying to use the following function;
=INDEX(D:D,COUNTA(D:D),1),
in order to get the last currency value of a column, but it returns #ERROR!.
The value im trying to extract
As I montly update this spreadsheet, it would make it very convenient if would etract the last value in the column, e.g. the value marked in the image.
Is there a way (in Google Sheets) to find the last non-empty cell in this column, such that when I update the spreadsheet with a new "last value" it would return that value?
The index(counta()) pattern will fail when the data is sparse, i.e., when there are blank values in the column.
The index(match()) pattern will fail when the data contains a value that is not a number.
To find the last non-blank value in column D, regardless of data type, use the +sort(row()) pattern:
=+sort(D1:D; not(isblank(D1:D)) * row(D1:D); false)
The formula uses semicolons as argument separators to make it work in any locale.
If the column has only currency (ie number) values then you can use something like:
=INDEX(D1:D, MATCH(999^99, D1:D))
or try:
=SORTN(D:D; 1;;ROW(D:D)*(D:D<>""); )

Google Sheets Fill Down with Formula

I have a very hard problem to solve, which must be completed with a formula (not a script).
Basically, the Raw input column needs to be dynamically filled down until it hits the next piece of text.
Here's an example file with includes the expected output.
https://docs.google.com/spreadsheets/d/1ibqCvY39NlhCRWsbBdxKITUUpVpp9wXdEz44T-pHDY0/
Is it even possible to achieve?
Thanks
This will work based on your ask, assuming that A2 is never blank, place this in the first row of data (not header):
=ArrayFormula(IF(A2:A<>"", A2:A, B1:B))
It checks to see if there is a value in column A, if there is, it fills that column, if not, it copies the cell above.
Delete everything in Column B (including the header) and place the following formula in B1:
=ArrayFormula({"Header";VLOOKUP(FILTER(ROW(A2:A),ROW(A2:A)<=MAX(FILTER(ROW(A2:A),A2:A<>""))),FILTER({ROW(A2:A),A2:A},A2:A<>""),2,TRUE)})
Here is a basic explanation of how this formula works:
A virtual array is created between the curly brackets { }; this virtual array contains a header and all results. You can change the header name to whatever you like.
VLOOKUP looks up every row number that is less than or equal to the highest row number that contains text in A2:A. Each of these qualifying rows is looked up in a second array that contains only the row numbers and Column-A data from non-blank rows, returning the data itself. Since rows are in perfect ascending order and the last parameter of VLOOKUP is set to TRUE, all blank rows in the first array will "fall backward" to find the most recent row that did have something in Column A.

Is it possible to assign conditional formatting to a named range in Google Sheets?

I'd like to apply a conditional formatting rule to a named range. Is that even possible? How do I do that? When trying to enter the Name of the Range to the Field where you set up the range the rule applies to it won't accept my input.
Also with INDIRECT it does not work:
this is not possible in Google Sheets
for the custom formula you need to wrap it into INDIRECT formula like:
I think it is not possible, it is not documented in official docs.
Range names:
Can contain only letters, numbers, and underscores.
Can't start with a number, or the words "true" or "false."
Can't contain any spaces or punctuation.
Must be 1–250 characters.
Can't be in either A1 or R1C1 syntax. For example, you might get an error if you give your range a name like "A1:B2" or "R1C1:R2C2."
The following works for my specific use case, where the named range is an "unknown" number of rows.
In this case, A1 is a column heading, and is not part of the named range.
A2:A5 is currently assigned to the named range, CitationType.
Conditional formatting is applied to A1:A based on the formula:
=and(row(A1)>1,row(A1)<=1+rows(indirect("CitationType")))
I did not find an easy way (without scripting) to get the address details of a named range, allowing for "arbitrary" usage in conditional formatting.
For custom formulas in Sheets conditional formatting, the formula usually accesses a column value in the first row of the format range. Named range values can be used in custom formulas using INDIRECT function.
example from my case ... a list of "brackets" in a tournament. Bracket rows are coloured depending on what bracket the row is for (e.g. brackets 1-10), that value is in the E column.
The formula specifies the appropriate column in the first row of the range (row is relative as conditional formatting iterates over the range). Since my range is B2:G1005, the formula references cell $E2 (the bracket ID) and compares it to the bracket id stored in a named-range location (BID_1), so custom formula is:
=$E2=INDIRECT("BID_1")
(if bracket matches the ID assigned to bracket 1 -- colour the cells grey with bolded black text).
Screenshot of conditional formatting using a named range

Google spreadsheets: conditional formatting with custom formula based on values from different sheet

I have a google spreadsheet with two sheets. On the first sheet, the items are listed in column A, and their types are in column B.
On the second sheet, I reference to the first sheet's column A with the formula: =UNIQUE(Sheet1!A:A).
Then I want to color the items in the 2nd sheet based on the item type (1st sheet's column B*). I try to add conditional formatting using the formula =Sheet1!$B:$B="Type1", but when I try to save rules, it says the formula is invalid.
What would be the correct formula for this case?
You cannot reference cells directly in the conditional format formula. Also, I do not think that formula would work.
First, you need the VLOOKUP function to get the object's type.
Here's an example of using this function. The difference would be that the corresponding data in the first parameter would be preceded by the sheet name in your case.
See this image:
As you can see, VLOOKUP searchs for the item from D in the matrix A2:B4, and then returns the corresponding value (the value in the same row) in the second column of the matrix, which is column B.
So if you to apply this formula to conditional formatting, you would have:
=VLOOKUP($D$2:$D;$A$2:$B$4;2)="Dragon"
The first parameter of VLOOKUP has to be a range, and I started it from D2 so it would not match the header. In your case, it would become:
=VLOOKUP($D$2:$D;Sheet1!$A$2:$B$4;2)="Dragon"
But as you cannot use references directly, you need to use the INDIRECT function. It receives a cell range as a string and returns a reference to that range. It's the same as using references directly, but in this case you add an extra step (go figure). So the formula finally becomes:
=VLOOKUP($D:$D;INDIRECT("$A$2:$B$4");2)="Dragon"
You can choose any range to apply the format if you are using the new version of Spreadsheets. You could, for example, color the entire row or just a single cell.

Resources