Thomas Gardner
Thomas Gardner

Reputation: 67

Coloring cells based on numbers in string

In my sheet, on column A I have a string of numbers divided by commas. Then there are 12 numbered columns, each with its own hour. How can I shade the cells if their column's number is listed in column A?

Here is an example of what I am hoping to achieve.

  | A     | B        | C        | D        | E
1 |       | 1        | 2        | 3        | 4
2 | 1,2,4 | (shaded) | (shaded) |          | (shaded) 
3 | 2,3   |          | (shaded) | (shaded) |

Upvotes: 0

Views: 33

Answers (1)

Max Makhrov
Max Makhrov

Reputation: 18717

  1. Select the whole range
  2. Apply conditional fofmatting
  3. select custom formula: =MATCH(B$1,SPLIT($A2,","),0)>0

enter image description here

Upvotes: 1

Related Questions