With respect to highlighting to search for duplicates of sequential values, the desired formula
=AND(B1<>"",B2=B1)
With a range starting with B2 (aka, B2: B1048576)
- , -, 1.8.3 openpyxl, 1.9.
from openpyxl import Workbook
from openpyxl.style import Color, Fill
wb = Workbook()
ws = wb.active
ws['B1'] = 1
ws['B2'] = 2
ws['B3'] = 3
ws['B4'] = 3
ws['B5'] = 7
ws['B6'] = 4
ws['B7'] = 7
redFill = Fill()
redFill.start_color.index = 'FFEE1111'
redFill.end_color.index = 'FFEE1111'
redFill.fill_type = Fill.FILL_SOLID
dxfId = ws.conditional_formatting.addDxfStyle(wb, None, None, redFill)
ws.conditional_formatting.addCustomRule('B2:B1048576',
{'type': 'expression', 'dxfId': dxfId, 'formula': ['AND(B1<>"",B2=B1)']})
wb.save('test.xlsx')
:
:
(: B, B1) > 1
, :
($ B $2: $2, 2) > 1
, :
(1: 2, 2) > 1
RC - openpyxl excel RC-, , . , excel R1C1 A1 , R1C1 A1, .