I tried your solution and I don't think it works for my game. The issue is that I want to be able to have the global variable tell the formula which resource is being used. This way when it does upgrade I Can change what resources it needs to get to the next level.
When the building levels it is going to change what resource and quantity is required for next level, so right now "UpgradeResource" is set to wood, but next level it will be turned into say, water. So I really need to figure out a way that when the compare variable reads "UpgradeResource" it actually points to the "Wood" Global variable.