SugarCereal191126
SugarCereal191126

Reputation: 41

Highlight multiple rows based on a single cell with blanks in between conditional formatting triggers?

https://docs.google.com/spreadsheets/d/17CRAqPp_1FXQJAN7KtWMnLvmp54_jvBbrB1rES-yBbM/edit#gid=1220119768

The first sheet is an example of what I'd like, the second sheet is a fresh, un-colored sheet.

I'm trying to highlight 3 rows based on if the first cell located in the first row contains some value.

In this specific case, I have a workout routine type (upper body, lower body, etc) and the routine name on one line. It's rest information the next two lines. I want the rests to highlight with the routine name/routine type.

Since the routine type is rotated, as seen on the example sheet, the 2nd and 3rd cells after the type are effectively blank.

I think the closest solution may be this stackoverflow link, but this is an apps script and I'd prefer a conditional format. While I wait for an answer here, I will experiment with an OR statement, something like

OR($A1="Upper",$A1 - 1= "Upper", $A1 - 2 = "Upper").

Bonus: if possible, I would also like this rule to apply to just two rows but this is not necessary. If you look at the example sheet, "Static Holds" is just two lines.

Edit: This is close to what I want. Except, it only highlights the first cell in the row and not the entire row. Does anyone know how to reconfigure this to work across an entire row?

=IFS($A1="Upper",1,INDIRECT(ADDRESS(ROW()-1, COLUMN()))="Upper",1,INDIRECT(ADDRESS(ROW()-2, COLUMN()))="Upper",1)

Upvotes: 1

Views: 180

Answers (2)

player0
player0

Reputation: 1

try on range A1:F:

=(INDEX(IFNA(VLOOKUP(ROW(A1), IF($A:$A<>"", {ROW(A:A), $A:$A}), 2, 1)))="upper")*($B1<>"")

=(INDEX(IFNA(VLOOKUP(ROW(A1), IF($A:$A<>"", {ROW(A:A), $A:$A}), 2, 1)))="lower")*($B1<>"")

=(INDEX(IFNA(VLOOKUP(ROW(A1), IF($A:$A<>"", {ROW(A:A), $A:$A}), 2, 1)))="back")*($B1<>"")

enter image description here

Upvotes: 1

player0
player0

Reputation: 1

you can do it with 3 rules offset by a row:

enter image description here

enter image description here

Upvotes: 0

Related Questions