How to calculate data of different columns and keep the unqualified ones in another excel sheet


#1

Hi guys, i have an excel sheet with over 10000 rows, and each row has 6 columns, for each row, i need the data meet the requirement: data in column6=data of column1+data of column 2-data of column3, and i cannot make sure the data in excel is number, some of them may be string, how should i do this in uipath studio?
what i think about this: read range-build datatable, and then for each row, add data row, then using if activity, put the calculation in condition, remove data row of the qualified ones, and write the exceptional ones by write range. i am not clear about this logic, or how exactly should i using these activity?
Hope sb can help me about this, thanks very much.


#2

You cannot remove the qualified ones in foreach directly. In foreach you can add them to a datarow list.After your foreach, iterate the list and remove the rows from datatable.


#3

You can use the datatable.Select(Decimal.Parse(Column6) = (Decimal.Parse(Column1) + Decimal.Parse(Column2) - Decimal.Parse(Column3)).CopyToDatatable(). This will give a datatable with all the qualified rows and if you use not equal to instead of equal to it will give you not qualified rows.
Refer to this post, which says something similar:-


#4

@vvaidya thanks, i’ll try this


#5

@Sachin_Desai thank u very much