If you are already using an array to store the items by name then you should use the array to store the amount, in the next row or column. Then you can compare using the array each time, find name and the amount is at the same position.
The logic in the function would become something like, array contains name, find co-ordinate of name. lets say co-ordinate is 3,0 - add 1 to 3,1 (amount stored in next column).