Why the formular cell need to write by robot is disappear


In cell T2, I have write the formular as the figure:

Yet, why it is disappear? Can anyone help me to fix?
Robot
FA Sorting MU-rep MU-bias try 2.0.xaml (148.8 KB)
(this issue is from component 2 - MU-rep)

I’d be glad to provide an improved response that incorporates the strengths of both Response A and Response B, addresses their potential shortcomings, and leverages insights from the ratings:

Understanding the Disappearing Formula Cells Issue:

In UiPath automation, when formulas written by a robot into Excel cells vanish, it’s typically due to activities like “Write Cell” or “Write Range” inadvertently overwriting the entire cell content, including existing formulas.

Solutions to Prevent Overwriting:

  1. Utilize “Set Formula” Activity (Preferred):

    • This activity explicitly writes the formula string to the cell, preserving any existing formatting or cell comments.
    • Leverage it for scenarios where you solely intend to modify the formula within a cell.
  2. Modify Existing Cell Content with “Insert/Modify Rows” (Advanced):

    • Offers more granular control but requires deeper understanding.
    • Use this if you need to update specific parts of the cell’s content, including formulas.
    • Construct the CellInformation object to specify the formula and other attributes you want to retain.

Steps for Using “Set Formula” Activity:

  1. Drag and Drop: Add the “Set Formula” activity to your workflow.
  2. Configure Properties:
    • Target: Set the Excel application window (“wnd app”) or a specific cell reference (e.g., “A1”).
    • Formula: Specify the formula as a string (e.g., “=SUM(A2:A10)”).

Illustrative Example:

// Assuming your formula is stored in the "formulaString" variable

// Set Formula Activity
var setFormula = new UiPath.Excel.Activities.SetFormula()
{
    Target = "A1", // Or "wnd app" for active window
    Formula = formulaString
};

// Execute the activity
setFormula.Execute();

Additional Considerations:

  • Maintain Consistent Formatting: While using “Set Formula” preserves formatting, ensure your robot isn’t inadvertently modifying formatting during interaction.
  • Error Handling: Consider implementing error handling in your workflow to gracefully handle potential issues.
  • Macro Security (if applicable): Adjust macro security settings in Excel if necessary to allow formulas from trusted sources (e.g., your UiPath robot).
  • Cell Protection: Unprotect the cells before the robot interacts with them to allow formula writing.
  • UiPath Updates: Stay updated with the latest UiPath version to benefit from bug fixes and enhancements.
  • Community Forums: Consult UiPath documentation or community forums for known issues or alternative solutions.

By following these strategies, you can effectively prevent formula cells written by your UiPath robot from disappearing and ensure your Excel automations accurately handle formula-based data.

If i want to use the set formular activity, can u illustate me using my workflow ? Thank u so much


May i ask why i dont hv set formular activity…

@Happydayyy , Don’t write anything into the formula cell which solve your issue