I tried several ways to fill in excel formula “=VERWEIS(2;1/(A1:O1<>”“);A1:O1)” in excel cells via uipath but excel does not recognize it as formula showing #NAME? in the excel cell (tried building datatable and write range (error “range does not exist”), tried via excel application scope and write cell, tried write cell (workbook)…)
Did anyone had a similar problem getting working excel formel into excel via uipath?
Welcome to uipath community
use EXCEL APPLICATION SCOPE and use READ RANGE ACTIVITY and get the output with a variable of type datatable named dt
–now use FOR EACH ROW activity and pass the dt as input
–inside the loop use WRITE CELL activity and mention the range as “C”+(dt.Rows.IndexOf(row)+2).ToString
it can C or any column where you want to use this formula
and mention the value like this
any text that you use to write cell or write range does not write formulas into excel.
You might have to use a custom snippet.
See below a snippet which you can run in a loop to set cells with formulae
app = New Microsoft.Office.Interop.Excel.ApplicationClass
worksheet = CType(workbook.Worksheets(“Sheetname”), Microsoft.Office.Interop.Excel.Worksheet)
Dim rows_Count As Integer = worksheet.UsedRange.Rows.Count
For i As Integer = 0 To rows_count
worksheet.Range(“Column to be entered” + i.ToString).FormulaLocal =“Formula to be entered here with = sign”
app.DisplayAlerts = False
range = Nothing
worksheet = Nothing
workbook = Nothing
app = Nothing
Catch ex As Exception
Can you check the format once again @bijo153? I hope the formula itself is wrong. Make sure the formula which is working in excel is assigned to a string variable and then pass it to the activity write range
You can use the activity invoke code for c# or vb.net, and use start process for VB Script or call the script file directly, or if it is VBA (Macro) you can use Invoke VBA or Execute macro (using Excel app scope)