Looping through takes too too long to complete

How can I optimize my bot. Its taking forever using For Each.

My challenge:
sample.xlsx (96.5 KB)

On the attached excel, data1 sheet I’m supposed to read it and sumif using name and item sum the amount, as output “Sumif” sheet. Here is the first delay. over an hour.
Second bit, I’m supposed to loop through each name and fill in the summed ammount and the person who paid as per “Anant sheet”. Anant represents the first person name trimmed.
In both above I’m using for each to loop through.

Could there be a much faster approach using invoke code.

Hey @Jonathan_Mbiriri

You can use GroupBy and Sum queries available for us in Vb.Net Linq.

Kindly explore and try the above.

If you still need more help or face any challenges, let us know so that we can provide a sample.

Hope that helps.


please follow this video and try ,

Still stuck, any help

1 Like

Want it to do a sumifs from an entire excel listing

Okay @Jonathan_Mbiriri

Will provide you a sample, soon today.


please follow those links and you can get to know how to use VBA script and macro

1 Like