Use excel functions (SUMIFS) in UiPath

Hello,

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.

@Nicollebro

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

cheers

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.
image

The result should look like this:
image

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() {
                Key.Task,
                Group.Sum(Function(row) row.Field(Of Double)("Hours")),
                Key.Login
            }, 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()

BlankProcess10.zip (47.9 KB)

Hope this helps!!

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