Excel Formula Operations - Excel Formula MCP
Contents
[
Hide
]
Excel Formula Operations
Excel Formula MCP provides powerful Excel formula automation with AI integration. Apply Excel formulas to single cells or multiple cells in batch operations.
Available Tools
apply_formula
- Apply Excel formulas to single cells with Excel Formula MCPapply_formula_batch
- Apply Excel formulas to multiple cells in batch using AI Excel
Single Formula Operations
Apply Formula with Equals Sign
{
"tool": "apply_formula",
"parameters": {
"filepath": "reports/calculations.xlsx",
"sheet_name": "Data",
"cell": "D2",
"formula": "=B2*C2"
}
}
Apply Formula without Equals Sign
{
"tool": "apply_formula",
"parameters": {
"filepath": "reports/calculations.xlsx",
"sheet_name": "Data",
"cell": "E2",
"formula": "SUM(B2:D2)"
}
}
Common Excel Formulas
{
"tool": "apply_formula",
"parameters": {
"filepath": "reports/analysis.xlsx",
"sheet_name": "Summary",
"cell": "F2",
"formula": "=AVERAGE(A2:E2)"
}
}
Batch Formula Operations
Calculate Sales Report Totals
{
"tool": "apply_formula_batch",
"parameters": {
"filepath": "reports/sales-report.xlsx",
"sheet_name": "Sales Data",
"formulas": [
{ "cell": "E2", "formula": "=C2*D2" },
{ "cell": "E3", "formula": "=C3*D3" },
{ "cell": "E4", "formula": "=C4*D4" },
{ "cell": "E5", "formula": "=SUM(E2:E4)" }
]
}
}
Financial Report with Tax Calculations
{
"tool": "apply_formula_batch",
"parameters": {
"filepath": "reports/financial-report.xlsx",
"sheet_name": "Sheet1",
"formulas": [
{ "cell": "D2", "formula": "=B2*C2" },
{ "cell": "D3", "formula": "=B3*C3" },
{ "cell": "D4", "formula": "=B4*C4" },
{ "cell": "E2", "formula": "=D2*0.1" },
{ "cell": "E3", "formula": "=D3*0.1" },
{ "cell": "E4", "formula": "=D4*0.1" },
{ "cell": "F2", "formula": "=D2+E2" },
{ "cell": "F3", "formula": "=D3+E3" },
{ "cell": "F4", "formula": "=D4+E4" },
{ "cell": "D5", "formula": "=SUM(D2:D4)" },
{ "cell": "E5", "formula": "=SUM(E2:E4)" },
{ "cell": "F5", "formula": "=SUM(F2:F4)" }
]
}
}
Mixed Formula Syntax
{
"tool": "apply_formula_batch",
"parameters": {
"filepath": "reports/analysis.xlsx",
"sheet_name": "Data",
"formulas": [
{ "cell": "F4", "formula": "=D4*2" },
{ "cell": "F5", "formula": "D5*2" },
{ "cell": "F6", "formula": "=D6*2" },
{ "cell": "G4", "formula": "=D4+10" },
{ "cell": "G5", "formula": "=D5+10" },
{ "cell": "G6", "formula": "=D6+10" },
{ "cell": "G7", "formula": "=SUM(G4:G6)" }
]
}
}
Common Excel Functions
Mathematical Functions
SUM(range)
- Sum values in rangeAVERAGE(range)
- Calculate averageMIN(range)
- Find minimum valueMAX(range)
- Find maximum valueCOUNT(range)
- Count numeric cells
Logical Functions
IF(condition, true_value, false_value)
- Conditional logicAND(condition1, condition2)
- Logical ANDOR(condition1, condition2)
- Logical OR
Text Functions
CONCATENATE(text1, text2)
- Join textLEFT(text, num_chars)
- Extract left charactersRIGHT(text, num_chars)
- Extract right charactersLEN(text)
- Text length
Best Practices
- Formula Syntax: Both
=SUM(A1:A10)
andSUM(A1:A10)
work - Cell References: Use absolute references (
$A$1
) when needed - Error Handling: Test formulas with simple data first
- Batch Operations: Use batch operations for multiple similar formulas
- Formula Validation: Verify results after applying formulas
Error Handling
Empty Formulas Array
{
"tool": "apply_formula_batch",
"parameters": {
"filepath": "test.xlsx",
"sheet_name": "Sheet1",
"formulas": []
}
}
Result: Validation error for empty array
Invalid Formula
{
"tool": "apply_formula",
"parameters": {
"filepath": "test.xlsx",
"sheet_name": "Sheet1",
"cell": "A1",
"formula": "=INVALID_FUNCTION(A1)"
}
}
Result: Formula syntax error