Data Manipulation in the Excel

I have a sample inputs and attached here. I need to compute the duration column using the formula as IFERROR(DURATION(L2,K2,F2,H2,4,1),0) how to compute the operations in the excel without using the write cell activity. Please kindly suggest the workflow to complete the task.

mtmdate MaturityDate coupon MTM yield Duration
27-08-2024 30-08-2024 0 6.8977117796079256
27-08-2024 21-10-2024 0 7.1268699550128076
27-08-2024 07-07-2025 0 7.5477914082769985
27-08-2024 03-09-2024 0 6.9251069407415343

Happy Automation,
Thanks!

@iswarya_P2

Try this:

Make changes as per your input:

–>Read the Excel file
Excel Application Scope
Read Range: Output to dtData

→ Compute Duration
Add a new column for duration
Assign: dtData.Columns.Add(“Duration”, GetType(Double))

For Each Row in dtData
Assign:
Dim calculatedDuration As Double
Try
'Assuming a function named DURATION is defined elsewhere
calculatedDuration = DURATION(CDate(row(“mtmdate”)), CDate(row(“MaturityDate”)), CDbl(row(“coupon”)), CDbl(row(“MTM yield”)), 4, 1)
Catch ex As Exception
calculatedDuration = 0
End Try

Stop here if you implemented a separate DURATION logic
row("Duration") = calculatedDuration

→ Write the Data Back to Excel
Write Range: dtData

Can you please give the workflow design for clear understanding in the UiPath workflow?

If you want to learn and complete your task you need to implement, we can give only suggestions.