python - How do I apply conditional formatting on a pair of rows in Excel? -
i using python , xlwings insert data in excel worksheet. data looks below in excel:
b c d e 1 10 20 5 15 30 2 15 10 12 15 20 3 empty 4 22 11 5 8 9 5 10 5 12 2 9 6 empty
my aim each pair of rows: 1,2 , 4,5 , change background colors of cells based on number on each column smaller.
examples:
a1 < a2, a1 black , a2 red.
b1 > b2, b1 red , b2 black.
d1 = d2, d1, d2 both black.
i use xlwings.range("sheet1", "a1").color = (..., ..., ...)
talking use excel that.
my formula conditional formatting following:
=and($b1>$b2, isnumber($b1), isnumber($b2))
it formats correctly first cell of pair, ex. b1 not b2.
Comments
Post a Comment