How would you take an array such as this:
arr1 = [[1150-500101-1000005530, 2750.0],
[1150-500101-1000005530, 275.0],
[1150-500101-1000008371, 825.0],
[1150-500101-1000014950, 550.0],
[1150-500101-1000019105, 589.0],
[1150-500101-1000019111, 589.0],
[1150-500101-1000019111, 275.0]]
and merge duplicate values from the first value of each array (arr1[i][0])
in order to get something like this:
reducedArr1 = [[1150-500101-1000005530, 3025.0],
[1150-500101-1000008371, 825.0],
[1150-500101-1000014950, 550.0],
[1150-500101-1000019105, 589.0],
[1150-500101-1000019111, 864.0]]
These values are changing constantly as they are pulled from a Google Sheet.
I have tried to find similar problems like this but haven’t found anything that applies without assigning a key. What I am really looks for is a SUMIF made for two dimensional arrays so I can add this new array to a Google Sheet report.
Thanks
New contributor
zuter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.