Search code examples
google-sheetsgoogle-sheets-formula

Google Sheets - Conditional formatting based off of particular cells in a grid


I'm working on a "football squares" spreadsheet that I'm trying to automate as much as possible. My sheet has a 10x10 grid with numbers 0-1, randomly organized, above the top row and along the right side. I also have a "scoreboard" where each team's scores are to be typed in at the end of each quarter. The second number of each team's score for each quarter decides who the winner is for that quarter. For instance, at the end of Q1 if team 1 has 8 and team 2 has 0, the person's name in the cell at the intersection of the column with 8 and the row with 0 is the winner for that quarter. I'm successfully using the following formula to return the winners of each quarter in cells I16 through I20:

=IF(ISBLANK(O$4),"",VLOOKUP(value(RIGHT(H$24,1)),$B$3:$L$13,MATCH(VALUE(LEFT($H24,1)),$C$3:$3,0)+1,FALSE))

What I'm struggling with is applying conditional formatting to the grid so that only the winner of each quarter is highlighted green in the grid. It's not as straightforward as matching the names in I16:120 with names in the grid because a name can appear multiple times in the grid. For instance, if the winner of the 8-0 scenario in paragraph one is "Joshua Hernandez" and Joshua Hernandez also appears under 4-6 I only want the 8-0 cell formatted.

I'm probably doing a horrible job explaining this but here's a link to the sheet, if anyone wants to take a look: https://docs.google.com/spreadsheets/d/1hyeXLvhnp6lwmj7FkKhulo_6pXZog9cUXtSO8QMR7wU/edit?usp=sharing

Hopefully looking at it helps it make sense! TIA!

I tried the formula:

=AND(MATCH(VALUE(right($H$24, 1)), $C$3:$L$3, 0) + 2 = ROW(), MATCH(VALUE(left($H$24, 1)), $B$3:$B$13, 0) + 1 = COLUMN())

But it just highlights a random (at least seemingly random) cell each time I change the score numbers.


Solution

  • You may try this for Q1 with value picked up from Cell_H24:

    Apply to range: C4:L13

    Custom formula is: =address(row(),column(),4)=address(xmatch(--right($H$24),$B$4:$B$13)+3,xmatch(--left($H$24),$C$3:$L$3)+2,4)

    enter image description here