Use excel functions (SUMIFS) in UiPath


I have to add the values of some fields that are in different rows, I must do the sum only if certain criteria that depend on other columns are met, I wanted to use the Excel function (SUMIFS) but I don’t know how to do it from UiPath or what code to use in VB.NET.

Somebody could help me.

Thank you so much.


can you share the sample input and expected output so that we can help


En mis datos de entrada tengo 3 columnas (Tarea, Horas, Inicio de sesión) se deben sumar las horas de acuerdo la tarea y el inicio de sesión.

The result should look like this:

Hi @Nicollebro

Try this:

dtResult = (From row In dtInput.AsEnumerable()
            Group row By Key = New With {
                .Task = row.Field(Of String)("Task"),
                .Login = row.Field(Of String)("Login")
            } Into Group
            Select dtInput.Clone().LoadDataRow(New Object() {
                Group.Sum(Function(row) row.Field(Of Double)("Hours")),
            }, False)).CopyToDataTable()

Note: dtResult is of DataType System.Data.DataTable

Hope it helps!!

Hi @Nicollebro

You can simply try this

(From row In dt.AsEnumerable()
                Group row By Task = row.Field(Of Object)("Task"), Login = row.Field(Of String)("Login") Into Group
                Select dt.Clone().Rows.Add(Task, Group.Sum(Function(x) Convert.ToDouble(x.Field(Of Object)("Hours"))), Login)).CopyToDataTable() (47.9 KB)

Hope this helps!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.