Set Formula
Sets a formula in a specific cell in the active Excel sheet.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing the node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If ContinueOnError property is true, no error is caught when the project is executed even if the Catch node is used.
Input
- File Descriptor - File descriptor of the Excel file. This is the identifier returned by the Open Excel node.
- Cell - Cell address where the formula will be set (e.g.,
A1,B5,D10). - Formula - Excel formula to set. Must start with
=(e.g.,=SUM(A1:A10),=B1*C1).
Output
This node has no output.
Options
This node has no additional options.
Example
Setting a SUM formula:
// File Descriptor: message.excel_fd
// Cell: "A11"
// Formula: "=SUM(A1:A10)"
Setting a calculation formula:
// Cell: "D2"
// Formula: "=B2*C2"
// Multiplies values in B2 and C2
Setting a conditional formula:
// Cell: "E5"
// Formula: "=IF(D5>100,\"High\",\"Low\")"
Setting formulas dynamically:
// Cell: "F" + message.row_number
// Formula: "=E" + message.row_number + "*0.1"
// Creates formulas like =E5*0.1, =E6*0.1, etc.
Common Excel formulas:
// SUM: "=SUM(A1:A10)"
// AVERAGE: "=AVERAGE(B1:B10)"
// COUNT: "=COUNT(C1:C10)"
// IF: "=IF(D1>50,\"Pass\",\"Fail\")"
// VLOOKUP: "=VLOOKUP(E1,A:B,2,FALSE)"
// CONCATENATE: "=CONCATENATE(A1,\" \",B1)"
Tips
- The formula must start with
=(equals sign). - Use Excel's standard formula syntax and functions.
- Formulas are calculated immediately upon setting.
- Use quotes within formulas carefully - escape them in your code if needed.
- Cell references are relative unless you use absolute references (e.g.,
$A$1). - Test formulas manually in Excel first to ensure they work correctly.
Common Errors
| Error | Solution |
|---|---|
| Cell cannot be empty | Provide a valid cell address (e.g., A1, B5) |
| Formula cannot be empty | Provide an Excel formula |
| Invalid formula syntax | Ensure the formula starts with = and uses correct Excel syntax |
| Invalid File Descriptor | Ensure the Open Excel node was executed first |
| #NAME? error in cell | Formula contains an unrecognized function name |
| #REF! error in cell | Formula contains an invalid cell reference |