How to loop through all players and detect if one has an item?

I want to make a scoreboard that gives +1 money for every emerald you have, but I want it to be automatic. Is there a way to continuously check through every player to see if they have an item?