I want to format an entire row if the value in column A starts with specific words.
This code checks if cell A# equals 'Totals' and formats the entire row:
testformat = wb.add_format({'bg_color': '#D9D9D9', 'font_color': 'red'})worksheet.conditional_format(0,0,10, 10, {"type": "formula","criteria": '=INDIRECT("A"&ROW())="Totals"',"format": testformat})
However here is my modified code to check if the cell value equals 'Totals' or starts with 'A1', 'A2', or 'A3'. returns an error when I try to open the file:
worksheet.conditional_format(0,0,10, 10, {"type": "formula","criteria": '=OR(COUNTIF(INDIRECT("A"&ROW()),{"Totals","A1*","A2*","A3*"}))',"format": testformat})
I tested the formulas in Excel and they work fine (returning TRUE
) but why is there a problem with the second formula.