Use for each loop to count amount of times a string appears in an array?

I am currently trying to make an “store” full of items which give the player different stats. such as health etc. I have done this by making the blueprints pull their stats based off if an item is in their “Inventory” array. The problem is if they get the same item twice. I would like to be able to count the amount of times and item is in their inventory so I can give them the stats required. Such as if you get for example - 2 10hp items with the same name it counts them separatley as right now I have it with a true false branch with the Boolean

being a “contains” within an array.

Just create a counter variable, set it to 0 in the beginning, go through the Inventory with a ForEachLoop, and if Item == “Skean”, then increase this variable by 1. After completing, you’ll have the number of times the item occur in your array.

I did that but now it caused a new problem. The goal was to count the total of items then multiply it by the damage so I can add that number to the total damage. It should add 20 damage every time I buy the item but what ends up happening is it goes from 20 - 60- 100 because every time I trigger it; it loops and counts the amount currently in the inventory + what it has already added.

But your ForEachLoop makes no sense now. If it contains Skean, then you loop through the whole array and increase Skean in every iteration, so that you add the length of the array to Skean even if the array only contains it one time.
I’d suggest first going through some basic tutorials which teach you the usage of variables and loops.

Anyways, make sure to set your variable to 0 before looping, so that the new increments won’t be added to your previous value.