Excel - Sum of values from certain lines


I have an excel list with 3 columns, one contains the customers, the second the information whether they receive a newsletter or not and the third the sales that the customer has generated in the last month.
Bildschirmfoto 2020-03-20 um 14.00.08
I want to evaluate the total sales of customers who receive a newsletter. (Here the answer should be 50)
I would like this value to be output in a variable so that I can continue to work with it later.
Can someone help me?

Best wishes

Save it in data table.
Variable Sum = 0

For each row in data table,
if second column = Yes,
sum = sum + third column

print sum

is it not possible to do it in one Assign function ?

if you can create the formula manually in excel, you can just use the same formula from uipath also

I understand the logic but I don’t know exactly how to do it in UiPath.

I created a DataTable, then I selected the function “for each row” and specified my DataTable.
In the “for each row” activity I selected an If function, but what exactly do I have to write in it?


giv a try on yourDataTableVar.AsEnumerable.Where(Function (row) row(“Newsletter”).toString.Trim.Equals(“yes”)).Sum(function (x) CInt(x(“Sales”).toString))


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