import openpyxl, sys sys.stdout.reconfigure(encoding='utf-8') wb=openpyxl.load_workbook(r'충청남도_서천군.xlsx'); ws=wb.active # find rows where B is None within data and show context none_rows=[r for r in range(3,328) if ws.cell(r,2).value is None] print('B=None rows count:', len(none_rows)) print(none_rows) print('--- sample context (D E F G H) ---') for r in none_rows[:15]: vals=[] for c,n in [(6,'F'),(7,'G'),(8,'H'),(11,'K'),(12,'L')]: v=ws.cell(r,c).value if v is not None: vals.append(f'{n}={str(v)[:18]}') print(f'R{r} prevB={ws.cell(r-1,2).value} | '+' | '.join(vals)) # also check max B value bmax=max((ws.cell(r,2).value for r in range(3,328) if isinstance(ws.cell(r,2).value,int))) print('max B=',bmax)