Hello everyone! I have a (hopefully) quick question. I'm not new to Excel, but I'm not very familiar with many of its lesser known commands or VBA scripting. Here's the scenario:
I'm attempting to model a messy web of water pipes using Excel. On one worksheet (let's call it "Input") I have a list of 300 junctions where pipes connect. Each junction is labeled as a text string (so something like "GW34"). At each listing for each junction, it lists the next junction downstream (also as a text string) in the next column on the sheet. Along with that, I have a quantity of water that is flowing through the pipe (a numerical value) in the next column on that sheet.
On another worksheet (let's call it "Calculations") I want to be able to find the quantity of water combining at each junction by summing the quantity coming from the upstream junctions. So, what I want to be able to do, is find the data on sheet "Input" that references a specific junction to add the water that is combining at that point. In other words, I want to be able to do something like this (in a combination of English and old programming languages):
Dim i as an integer = 1
Dim TotalWater as an integer = 0
For (i=1; go to i=300; i++)
If (theReferencingColumnOnSheetInput on row i = "GW34")
Then (take the value of the water quantity on row i and add it to TotalWater)
End For Loop
Print TotalWater in its specific cell on the sheet of Calculations
So it will basically run through the list (column) of references on sheet "Input" and anytime it finds the name of the junction it adds its water quantity to the TotalWater value and puts it in specific cell on the "Calculations" sheet.
Confused yet? I am. Thanks for any help!
Bookmarks