Kindly find the below screenshots FYR. i am able to sum all the rows in the column but please help me to sum only 3600 rows and also need to divide the sum value in the last row of the column. Please note rows are dynamic in my excel it is not constant
Where do i have to mention the column name of the sum which i wanted ? bcz it is giving the sum of company code column as below but i wanted sum of “Amount in profit center local curr” which is corresponding to company code where the company code is equal to 3600,
but i wanted sum of Amount in profit center local curr colum as below
Dt.AsEnumerable().Where(Function(w) w("Company Code").ToString.Trim.Equals("3600")).Sum(Function(s) Convert.ToDouble(s("Amount in profit center local curr").ToString.Trim))
Could you try that and let us know if it works out for you?
I can create a sequence for you if you would be so kind as to provide a sample file.
You can either compute it in the Bot Memory and output in into Excel or grab the values from Excel Cells and then compute it within the bot memory before outputting it into Excel.
Since we have computed the Sum of company code ‘3600’ and have it handy, now I am assuming that you want to divide that by the total sum.
If that is the case, then you can do this->
Dt.AsEnumerable().Where(Function(w) w("Company Code").ToString.Trim.Equals("3600")).Sum(Function(s) Convert.ToDouble(s("Amount in profit center local curr").ToString.Trim))/Dt.AsEnumerable().Sum(Function(s) Convert.ToDouble(s("Amount in profit center local curr").ToString.Trim))