Skip to content
Agentmart
Submit a tool

formula-operations

公式运算规范 — .Formula 写入、常用公式模板、纠错方法、WPS 特有限制

Skill by claude-office-skills

IndexedMIT★ 9
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/claude-office-skills-formula-operations

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

公式运算规范 — .Formula 写入、常用公式模板、纠错方法、WPS 特有限制

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/formula-operations

What's inside

Skill name
formula-operations
Description
公式运算规范 — .Formula 写入、常用公式模板、纠错方法、WPS 特有限制
License
MIT
Instructions
67 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

## 公式写入规范

### 核心原则:用 .Formula 写公式,不用 .Value2 写计算结果

```javascript
// ✅ 正确:写入公式,Excel 自动计算
ws.Range("D2").Formula = "=B2*C2";
ws.Range("D20").Formula = "=SUM(D2:D19)";

// ❌ 错误:用 JS 算好再写入值(用户无法调参)
ws.Range("D2").Value2 = b2 * c2;
```

### 公式拖填(批量写入)

```javascript
// 方法1: 逐行写入(最可靠)
for (var r = 2; r <= lastRow; r++) {
  ws.Range("D" + r).Formula = "=B" + r + "*C" + r;
}

// 方法2: 首行写入 + AutoFill
ws.Range("D2").Formula = "=B2*C2";
ws.Range("D2").AutoFill(ws.Range("D2:D" + lastRow));
```

### 常用公式模板

| 场景 | 公式 |
|------|------|
| 求和 | `=SUM(B2:B100)` |
| 条件求和 | `=SUMIF(A2:A100,"条件",B2:B100)` |
| 多条件求和 | `=SUMIFS(C2:C100,A2:A100,"条件1",B2:B100,">0")` |
| 计数 | `=COUNTA(A2:A100)` |
| 条件计数 | `=COUNTIF(A2:A100,"条件")` |
| 平均值 | `=AVERAGE(B2:B100)` |
| 查找匹配 | `=VLOOKUP(查找值,表区域,列号,0)` |
| 灵活查找 | `=INDEX(返回区域,MATCH(查找值,查找区域,0))` |
| 条件判断 | `=IF(条件,"是","否")` |
| 嵌套判断 | `=IF(A2>90,"优",IF(A2>60,"及格","不及格"))` |
| 百分比 | `=B2/SUM(B$2:B$100)` |
| 环比增长 | `=(B3-B2)/B2` |
| 排名 | `=RANK(B2,B$2:B$100)` |
| 文本拼接 | `=A2&"-"&B2` |

### 公式纠错方法

```javascript
// 读取公式内容(不是值)
var formula = ws.Range("D2").Formula;

// 常见错误及修复思路
// #VALUE! → 数据类型不匹配,检查是否文本混在数字中
// #REF!   → 引用了被删除的单元格
// #NAME?  → 函数名拼写错误或不存在
// #DIV/0! → 除数为零,用 =IF(B2=0,0,A2/B2)
// #N/A    → VLOOKUP 找不到值,用 =IFERROR(VLOOKUP(...),"未找到")
```

### WPS 特有注意事项

- WPS 中 `.FormulaR1C1` 可能不稳定,优先用 `.Formula`(A1 格式)
- 数组公式 `{=...}` 在 WPS 加载项中支持有限,优先用辅助列拆解
- 跨工作表引用格式:`='表名'!A1`
- 公式中的中文引号会导致错误,确保用英文双引号

From claude-office-skills/claude-office-plugin, MIT.

More from claude-office-skills/claude-office-plugin

Signals

Stars
9
Forks
3
Open issues
0
Last commit (this folder)
Feb 26, 2026 (8 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from claude-office-skills

Cite this page

formula-operations skill. Agent Mart. https://agentmart.dev/skills/claude-office-skills-formula-operations (last updated 2026-10-24)