Excel summation according to diff categories

Hi,

I have 4 types of vaccines on excel, I have the price of each vaccine.
I would need to use UiPath to sum up the total number of vaccines for each category and the total price.
How do I do that?
What are the variables and which activity do I use etc?

Thanks

Hi @Brandon_Quek

You can use this Linq query-

// Assuming the category column is named “Category” and the price column is named “Price” in the DataTable
// Make sure to replace “vaccineData” with the actual name of your DataTable variable

// Calculate the total number of vaccines for each category
Dim totalVaccinesByCategory = From row In vaccineData.AsEnumerable()
Group row By category = row.Field(Of Integer)(“Category”) Into Group
Select New With {
.Category = category,
.TotalVaccines = Group.Sum(Function(row) row.Field(Of Integer)(“Quantity”))
}

// Calculate the total price for each category
Dim totalPriceByCategory = From row In vaccineData.AsEnumerable()
Group row By category = row.Field(Of Integer)(“Category”) Into Group
Select New With {
.Category = category,
.TotalPrice = Group.Sum(Function(row) row.Field(Of Decimal)(“Price”))
}

Thanks!!

can u guide me along the way? I am new to UiPath

Hi @Brandon_Quek - Can you share your sample input excel

@Brandon_Quek - Please check the attached workflow for your understanding

SampleWorkflow.zip (10.5 KB)

Thank you very much