I’m trying to sum a column within a datatable but not all the fields. E.g. the datatable consists of column, project name, project number, document type, debit amount and credit amount. I want to sum all the value except those with document type ‘journal’. Also, I’ve tried several formulas posted but I don’t know how to apply the where in the formula.
I think firstly, you should take out rows with document type is ‘journal’. so for that, I’ll suggest you to use Filter DataTable activity as shown in below shot.
As remove radio button is selected it’ll remove rows which has document type is ‘journal’.
Don’t forget to specify input datatable (dt1) & output datatable (dt2).
Now, you have filtered datatable you can use following query to get sum.
Are you looking for something like this excel_uipathforum.zip (501.9 KB) ?
The datatable is obtained from a Excel file please unzip and execute the main file only.
Thanks for the advice, the sum code is not working. I assigned sum to string but i get the following validation error: “Option strict on disallows implicit conversions from ‘double’ to ‘string’”
Not exactly, I want the sum of the all the rows in a column except the rows that have a document type of ‘journal entry.’ Your answer would be subtracting the values in the debit and credit column of each row. I want to add all the dollar values in the debit column.