# Excel Outlier Detection And Highlighting

识别 Excel 中的超限数值与错误单元格并进行高亮标注。

- Repository: https://github.com/OpenSenseNova/SenseNova-Skills (6002 stars)
- Category: Documents
- License: MIT
- Last updated: 2026-10-29
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add OpenSenseNova/SenseNova-Skills --skill excel-outlier-detection-and-highlighting -g -a claude-code -y`
Codex: `npx skills add OpenSenseNova/SenseNova-Skills --skill excel-outlier-detection-and-highlighting -g -a codex -y`
Cursor: `npx skills add OpenSenseNova/SenseNova-Skills --skill excel-outlier-detection-and-highlighting -g -a cursor -y`
Gemini CLI: `npx skills add OpenSenseNova/SenseNova-Skills --skill excel-outlier-detection-and-highlighting -g -a gemini-cli -y`

## Description

识别 Excel 中的超限数值与错误单元格并进行高亮标注。

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Outlier_Coloring

> This sub-skill covers one capability of the Excel workflow. For reading/counting/Parquet optimization, see the parent workflow SKILL.md.

Step1 使用正则表达式提取限值，并结合上下文逻辑识别总传热系数超限的行。
```python
import re

exceed_rows = []
target_col = 0  # 假设特征列在第一列
value_col = 8   # 假设数值列在第九列

for i, row in df.iterrows():
    row_str = str(row.iloc[target_col]) if pd.notna(row.iloc[target_col]) else ""
    
    # 正则表达式精准提取限值，例如 "限值0.5"
    if '限值' in row_str:
        match = re.search(r'限值([\d.]+)', row_str)
        if match:
            current_limit = float(match.group(1))
            
    # 识别计算结果行并进行对比
    if '共计' in row_str:
        try:
            actual_val = float(row.iloc[value_col])
            # 向上回溯寻找结构名称（实战技巧：遍历还原上下文）
            structure_name = "未知结构"
            for j in range(i-1, max(0, i-15), -1):
                prev_val = str(df.iloc[j, 0])
                if any(kw in prev_val for kw in ['系数', '围护']):
                    structure_name = prev_val
                    break
            
            # 提取最近的限值进行对比
            limit_val = None
            for j in range(i-1, max(0, i-15), -1):
                check_str = ' '.join([str(x) for x in df.iloc[j, :] if pd.notna(x)])
                limit_match = re.search(r'限值([\d.]+)', check_str)
                if limit_match:
                    limit_val = float(limit_match.group(1))
                    break
            
            if limit_val and actual_val > limit_val:
                exceed_rows.append({
                    'row_index': i,
                    'name': structure_name,
                    'value': actual_val,
                    'limit': limit_val,
                    'diff': actual_val - limit_val
                })
        except (ValueError, TypeError):
            continue
```

Step2 遍历指定 Sheet 查找包含 '#DIV/' 等异常错误的单元格，并记录坐标。
```python
# 针对特定 Sheet（如 Sheet3）检测公式错误
ws_error = wb['Sheet3']
error_cells = []

The rest: https://github.com/OpenSenseNova/SenseNova-Skills/blob/HEAD/skills/sn-da-excel-workflow/capability/excel-cell-coloring/outlier-coloring/SKILL.md
