Skip to main content
Question

How to Aggregate Records by Summing Amounts in Automation Anywhere?


Forum|alt.badge.img

Hi everyone,

I’m new to Automation Anywhere and need help with writing logic to consolidate multiple records by summing their amounts.

I have a data file with several records following the same pattern but with different names. For example:

Alex Dan 145.33 

Alex Dan 1110.00

John Doe 200.50

John Doe 99.50

I want to merge duplicate entries into a single row by summing the amounts:

Alex Dan 1255.33 

John Doe 300.00

What is the best approach to achieve this in Automation Anywhere? Any guidance or sample bot logic would be greatly appreciated!

Thanks in advance!

2 replies

Lu.Hunnicutt
Pathfinder Community Team
Forum|alt.badge.img+11
  • Pathfinder Community Team
  • 66 replies
  • March 25, 2025

Let me tag some folks to help you with this:

@Marc Mueller 

@LnMamou 

@amore17 

@sharath G 


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+10
  • Automation Anywhere Team
  • 534 replies
  • March 25, 2025

Personally, I would do this kind of data manipulation in Excel. But, should you REALLY want to do this in Automation Anywhere, here’s how I would attack the problem:

1. I would use a List variable as an array for the names. This would allow me to quickly look through the names array (List variable) for the matching name and get the index. If one does not match, I would add it to the list and get the index of the added value.

2. Using the index from the name array, I would have another List variable for the totals. The index from the names variable would match the totals variable.

The challenging part is to ensure that you’re keeping the indexes of the two List variables (names and totals) in sync.

Once you’re done looping through all your entries, you can loop through the List variable (names) and using a counter for the index for totals, to export/display all the names/totals.

This could also be done with a single Data Table variable with two columns. If you really want to get fancy, you could do this with a Dictionary variable using the name as the index for the variable and using the variable itself to hold the total.

There are plenty of ways to accomplish this! Sounds like a fun exercise!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings