1

I have some data in a google spreadsheet. It looks like-

+----+--------------+---------+
|user|cos_similarity|item_rank|
+----+--------------+---------+
|  u1|   0.004437351|        1|
|  u1|  0.0043772724|        2|
|  u1|   0.004322561|        3|
|  u1|   0.004322561|        3|
|  u2|   0.004557799|        1|              
|  u2|   0.004471699|        1|               
|  u2|  0.0043906723|        1|              
|  u2|  0.0043018474|        2|         
|  u2|  0.0042955037|        3|         
+----+--------------+---------+

I want to color-code the spreadsheet (all the rows) conditioned on the values present in a column named 'item_rank'.

So the whole row gets it's color from the value in the 'item_rank' column. The colors are supposed to reflect groups which I am defining by the value in a particular column.

Expected output-

Rows 1, 5, 6 should be having the same color because they have 'item_rank'=1.
Rows 2, 8 should be having the same color because they have 'item_rank'=2.
Rows 3, 4, 9 should be having the same color because they have 'item_rank'=3.

How do I achieve this?

n0obcoder
  • 649
  • 8
  • 24
  • Does this answer your question? [Conditional formatting based on another cell's value](https://stackoverflow.com/questions/20545961/conditional-formatting-based-on-another-cells-value) – Marios Dec 23 '20 at 13:09

1 Answers1

3

use this formula variation for range A2:C:

=$C2=1

enter image description here

player0
  • 124,011
  • 12
  • 67
  • 124
  • 1
    whats the significance of 2 in C2? solution worked btw – n0obcoder Dec 23 '20 at 16:44
  • 1
    @n0obcoder thats the starting position/row. so C2 is starting row of range C2:C (or A2:C in your case) – player0 Dec 23 '20 at 17:07
  • how can I write custom rule for odd and even values. Suppose I want the rows to be colored in 2 colors only. yellow if the item_rank for that row is odd, else green. What do I achieve this? @player0 – n0obcoder Dec 24 '20 at 08:36
  • @n0obcoder can you share a copy of your sheet with some example of desired result? – player0 Dec 24 '20 at 08:39
  • 1
    The issue has been resolved. I used the custom formula '=isodd(Value($C2))' for coloring all the rows with odd value in 'item_rank' column. – n0obcoder Dec 24 '20 at 09:35